PageRenderTime 49ms CodeModel.GetById 17ms app.highlight 24ms 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/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
23package org.jboss.as.test.integration.jca.metrics;
24
25
26import org.jboss.arquillian.container.test.api.Deployment;
27import org.jboss.arquillian.container.test.api.RunAsClient;
28import org.jboss.arquillian.junit.Arquillian;
29import org.jboss.as.test.integration.management.jca.DsMgmtTestBase;
30import org.jboss.as.test.smoke.modular.utils.ShrinkWrapUtils;
31import org.jboss.shrinkwrap.api.Archive;
32import org.junit.Test;
33import org.junit.runner.RunWith;
34
35import static junit.framework.Assert.assertEquals;
36
37/**
38 * XA datasource configuration and metrics unit test.
39 *
40 * @author <a href="mailto:vrastsel@redhat.com">Vladimir Rastseluev</a>
41 */
42@RunWith(Arquillian.class)
43@RunAsClient
44public class DriverCfgMetricUnitTestCase  extends DsMgmtTestBase{
45
46	@Deployment
47    public static Archive<?> getDeployment() {
48    	setBaseAddress("jdbc-driver", "name");
49        return ShrinkWrapUtils.createEmptyJavaArchive("dummy");
50    }
51
52    @Test
53    public void testDriverAttributes()throws Exception {
54    	setModel("complex-driver.xml");
55    	assertEquals("name",readAttribute(baseAddress,"driver-name").asString());
56    	assertEquals("DsClass",readAttribute(baseAddress,"driver-datasource-class-name").asString());
57    	assertEquals("XaDsClass",readAttribute(baseAddress,"driver-xa-datasource-class-name").asString());
58        removeDs();
59    }
60
61    @Test
62    public void testEmptyDriver()throws Exception {
63    	setModel("empty-driver.xml");
64    	assertEquals("name",readAttribute(baseAddress,"driver-name").asString());
65        removeDs();
66    }
67
68    @Test(expected=Exception.class)
69    public void testDriverWoName()throws Exception {
70    	setBadModel("wrong-wo-name-driver.xml");
71    }
72
73    @Test(expected=Exception.class)
74    public void testDriverWithNoName()throws Exception {
75    	setBadModel("wrong-empty-name-driver.xml");
76    }
77
78    @Test(expected=Exception.class)
79    public void test2DriverClasses()throws Exception {
80    	setBadModel("wrong-2-driver-classes.xml");
81    }
82
83    @Test(expected=Exception.class)
84    public void test2DSClasses()throws Exception {
85    	setBadModel("wrong-2-ds-classes-driver.xml");
86    }
87
88    @Test(expected=Exception.class)
89    public void test2XADSClasses()throws Exception {
90    	setBadModel("wrong-2-xa-ds-classes-driver.xml");
91    }
92}