PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Java | 92 lines | 53 code | 13 blank | 26 comment | 0 complexity | eb95ce6c918908a1b1d86c2ee4920cff 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.assertEquals;
  32. /**
  33. * XA datasource configuration and metrics unit test.
  34. *
  35. * @author <a href="mailto:vrastsel@redhat.com">Vladimir Rastseluev</a>
  36. */
  37. @RunWith(Arquillian.class)
  38. @RunAsClient
  39. public class DriverCfgMetricUnitTestCase extends DsMgmtTestBase{
  40. @Deployment
  41. public static Archive<?> getDeployment() {
  42. setBaseAddress("jdbc-driver", "name");
  43. return ShrinkWrapUtils.createEmptyJavaArchive("dummy");
  44. }
  45. @Test
  46. public void testDriverAttributes()throws Exception {
  47. setModel("complex-driver.xml");
  48. assertEquals("name",readAttribute(baseAddress,"driver-name").asString());
  49. assertEquals("DsClass",readAttribute(baseAddress,"driver-datasource-class-name").asString());
  50. assertEquals("XaDsClass",readAttribute(baseAddress,"driver-xa-datasource-class-name").asString());
  51. removeDs();
  52. }
  53. @Test
  54. public void testEmptyDriver()throws Exception {
  55. setModel("empty-driver.xml");
  56. assertEquals("name",readAttribute(baseAddress,"driver-name").asString());
  57. removeDs();
  58. }
  59. @Test(expected=Exception.class)
  60. public void testDriverWoName()throws Exception {
  61. setBadModel("wrong-wo-name-driver.xml");
  62. }
  63. @Test(expected=Exception.class)
  64. public void testDriverWithNoName()throws Exception {
  65. setBadModel("wrong-empty-name-driver.xml");
  66. }
  67. @Test(expected=Exception.class)
  68. public void test2DriverClasses()throws Exception {
  69. setBadModel("wrong-2-driver-classes.xml");
  70. }
  71. @Test(expected=Exception.class)
  72. public void test2DSClasses()throws Exception {
  73. setBadModel("wrong-2-ds-classes-driver.xml");
  74. }
  75. @Test(expected=Exception.class)
  76. public void test2XADSClasses()throws Exception {
  77. setBadModel("wrong-2-xa-ds-classes-driver.xml");
  78. }
  79. }