PageRenderTime 42ms CodeModel.GetById 31ms app.highlight 9ms 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/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
 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.assertFalse;
 36import static junit.framework.Assert.assertTrue;
 37
 38/**
 39 * XA datasource configuration and metrics unit test.
 40 *
 41 * @author <a href="mailto:vrastsel@redhat.com">Vladimir Rastseluev</a>
 42 */
 43@RunWith(Arquillian.class)
 44@RunAsClient
 45public class XaDataSourceCfgMetricUnitTestCase  extends DsMgmtTestBase{
 46
 47	@Deployment
 48    public static Archive<?> getDeployment() {
 49    	setBaseAddress("xa-data-source", "DS");
 50        return ShrinkWrapUtils.createEmptyJavaArchive("dummy");
 51    }
 52
 53    @Test
 54    public void testDefaultXaDsAttributes()throws Exception {
 55    	setModel("xa-basic-attributes.xml");
 56    	assertTrue(readAttribute(baseAddress,"use-ccm").asBoolean());
 57        assertTrue(readAttribute(baseAddress,"use-java-context").asBoolean());
 58        assertFalse(readAttribute(baseAddress,"spy").asBoolean());
 59        removeDs();
 60    }
 61
 62    @Test(expected=Exception.class)
 63    public void testNoXaDsProperties()throws Exception {
 64    	setBadModel("wrong-no-xa-ds-properties.xml");
 65    }
 66
 67    @Test
 68     public void testDefaultXaDsProperties()throws Exception {
 69    	setModel("xa-default-properties.xml");
 70        assertTrue(readAttribute(baseAddress,"wrap-xa-resource").asBoolean());
 71        removeDs();
 72    }
 73
 74    @Test
 75    public void testBooleanPresenceProperties()throws Exception {
 76    	setModel("xa-bool-pres-properties.xml");
 77    	assertTrue(readAttribute(baseAddress,"no-tx-separate-pool").asBoolean());
 78        assertTrue(readAttribute(baseAddress,"interleaving").asBoolean());
 79        assertTrue(readAttribute(baseAddress,"set-tx-query-timeout").asBoolean());
 80        assertTrue(readAttribute(baseAddress,"share-prepared-statements").asBoolean());
 81        removeDs();
 82    }
 83
 84    @Test
 85    public void testFalseBooleanPresenceProperties()throws Exception {
 86    	setModel("xa-false-bool-pres-properties.xml");
 87    	assertFalse(readAttribute(baseAddress,"no-tx-separate-pool").asBoolean());
 88        assertFalse(readAttribute(baseAddress,"interleaving").asBoolean());
 89        assertFalse(readAttribute(baseAddress,"set-tx-query-timeout").asBoolean());
 90        assertFalse(readAttribute(baseAddress,"share-prepared-statements").asBoolean());
 91        removeDs();
 92    }
 93
 94    @Test
 95    public void testTrueBooleanPresenceProperties()throws Exception {
 96    	setModel("xa-true-bool-pres-properties.xml");
 97    	assertTrue(readAttribute(baseAddress,"no-tx-separate-pool").asBoolean());
 98        assertTrue(readAttribute(baseAddress,"interleaving").asBoolean());
 99        assertTrue(readAttribute(baseAddress,"set-tx-query-timeout").asBoolean());
100        assertTrue(readAttribute(baseAddress,"share-prepared-statements").asBoolean());
101        removeDs();
102    }
103
104    @Test(expected=Exception.class)
105    public void testWrongXa2SecurityDomainsProperty()throws Exception {
106    	setBadModel("wrong-xa-2-security-domains.xml");
107    }
108
109    @Test(expected=Exception.class)
110    public void testWrongXaResTimeoutProperty()throws Exception {
111    	setBadModel("wrong-xa-res-timeout-property.xml");
112    }
113
114}