PageRenderTime 59ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/jboss-as-7.1.1.Final/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/metrics/XaDataSourceCfgMetricUnitTestCase.java

#
Java | 114 lines | 73 code | 15 blank | 26 comment | 0 complexity | 8d0646079e8e95d14391554b199a66f8 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2011, Red Hat, Inc., and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.as.test.integration.jca.metrics;
  23. import org.jboss.arquillian.container.test.api.Deployment;
  24. import org.jboss.arquillian.container.test.api.RunAsClient;
  25. import org.jboss.arquillian.junit.Arquillian;
  26. import org.jboss.as.test.integration.management.jca.DsMgmtTestBase;
  27. import org.jboss.as.test.smoke.modular.utils.ShrinkWrapUtils;
  28. import org.jboss.shrinkwrap.api.Archive;
  29. import org.junit.Test;
  30. import org.junit.runner.RunWith;
  31. import static junit.framework.Assert.assertFalse;
  32. import static junit.framework.Assert.assertTrue;
  33. /**
  34. * XA datasource configuration and metrics unit test.
  35. *
  36. * @author <a href="mailto:vrastsel@redhat.com">Vladimir Rastseluev</a>
  37. */
  38. @RunWith(Arquillian.class)
  39. @RunAsClient
  40. public class XaDataSourceCfgMetricUnitTestCase extends DsMgmtTestBase{
  41. @Deployment
  42. public static Archive<?> getDeployment() {
  43. setBaseAddress("xa-data-source", "DS");
  44. return ShrinkWrapUtils.createEmptyJavaArchive("dummy");
  45. }
  46. @Test
  47. public void testDefaultXaDsAttributes()throws Exception {
  48. setModel("xa-basic-attributes.xml");
  49. assertTrue(readAttribute(baseAddress,"use-ccm").asBoolean());
  50. assertTrue(readAttribute(baseAddress,"use-java-context").asBoolean());
  51. assertFalse(readAttribute(baseAddress,"spy").asBoolean());
  52. removeDs();
  53. }
  54. @Test(expected=Exception.class)
  55. public void testNoXaDsProperties()throws Exception {
  56. setBadModel("wrong-no-xa-ds-properties.xml");
  57. }
  58. @Test
  59. public void testDefaultXaDsProperties()throws Exception {
  60. setModel("xa-default-properties.xml");
  61. assertTrue(readAttribute(baseAddress,"wrap-xa-resource").asBoolean());
  62. removeDs();
  63. }
  64. @Test
  65. public void testBooleanPresenceProperties()throws Exception {
  66. setModel("xa-bool-pres-properties.xml");
  67. assertTrue(readAttribute(baseAddress,"no-tx-separate-pool").asBoolean());
  68. assertTrue(readAttribute(baseAddress,"interleaving").asBoolean());
  69. assertTrue(readAttribute(baseAddress,"set-tx-query-timeout").asBoolean());
  70. assertTrue(readAttribute(baseAddress,"share-prepared-statements").asBoolean());
  71. removeDs();
  72. }
  73. @Test
  74. public void testFalseBooleanPresenceProperties()throws Exception {
  75. setModel("xa-false-bool-pres-properties.xml");
  76. assertFalse(readAttribute(baseAddress,"no-tx-separate-pool").asBoolean());
  77. assertFalse(readAttribute(baseAddress,"interleaving").asBoolean());
  78. assertFalse(readAttribute(baseAddress,"set-tx-query-timeout").asBoolean());
  79. assertFalse(readAttribute(baseAddress,"share-prepared-statements").asBoolean());
  80. removeDs();
  81. }
  82. @Test
  83. public void testTrueBooleanPresenceProperties()throws Exception {
  84. setModel("xa-true-bool-pres-properties.xml");
  85. assertTrue(readAttribute(baseAddress,"no-tx-separate-pool").asBoolean());
  86. assertTrue(readAttribute(baseAddress,"interleaving").asBoolean());
  87. assertTrue(readAttribute(baseAddress,"set-tx-query-timeout").asBoolean());
  88. assertTrue(readAttribute(baseAddress,"share-prepared-statements").asBoolean());
  89. removeDs();
  90. }
  91. @Test(expected=Exception.class)
  92. public void testWrongXa2SecurityDomainsProperty()throws Exception {
  93. setBadModel("wrong-xa-2-security-domains.xml");
  94. }
  95. @Test(expected=Exception.class)
  96. public void testWrongXaResTimeoutProperty()throws Exception {
  97. setBadModel("wrong-xa-res-timeout-property.xml");
  98. }
  99. }