[jboss-cvs] JBossAS SVN: r107634 - in projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata: ds and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 16 18:16:52 EDT 2010
Author: maeste
Date: 2010-08-16 18:16:52 -0400 (Mon, 16 Aug 2010)
New Revision: 107634
Added:
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserTestCase.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/jbossra/
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/jbossra/JbossRaParserTestCase.java
Removed:
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/JbossRaParserTestCase.java
Log:
JBJCA-385 JBJCA-400 refactoring test suite classes to proper packages
Copied: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserTestCase.java (from rev 107633, projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ds/DsParserTestCase.java 2010-08-16 22:16:52 UTC (rev 107634)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.common.metadata.ds;
+
+import org.jboss.jca.common.api.metadata.ds.DataSources;
+import org.jboss.jca.common.metadata.ds.DsParser;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.jboss.util.file.FileSuffixFilter;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ *
+ * A RaParserTestCase.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class DsParserTestCase
+{
+ /**
+ * shouldParseAnyExample
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseAnyExample() throws Exception
+ {
+ FileInputStream is = null;
+
+ //given
+ File directory = new File(Thread.currentThread().getContextClassLoader().getResource("ds").toURI());
+ for (File xmlFile : directory.listFiles(new FileSuffixFilter("-ds.xml")))
+ {
+ System.out.println(xmlFile.getName());
+ try
+ {
+ is = new FileInputStream(xmlFile);
+ DsParser parser = new DsParser();
+ //when
+ DataSources ds = parser.parse(is);
+ //then
+ assertThat(ds.getDatasource().size() + ds.getXaDataSource().size(), is(1));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+ }
+
+}
Copied: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/jbossra/JbossRaParserTestCase.java (from rev 107633, projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/JbossRaParserTestCase.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/jbossra/JbossRaParserTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/jbossra/JbossRaParserTestCase.java 2010-08-16 22:16:52 UTC (rev 107634)
@@ -0,0 +1,315 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.common.metadata.jbossra;
+
+import org.jboss.jca.common.api.metadata.jbossra.JbossRa;
+import org.jboss.jca.common.api.metadata.jbossra.jbossra20.JbossRa20;
+import org.jboss.jca.common.metadata.jbossra.JbossRaParser;
+import org.jboss.jca.common.metadata.jbossra.jbossra10.JbossRa10Impl;
+import org.jboss.jca.common.metadata.jbossra.jbossra20.JbossRa20Impl;
+import org.jboss.jca.common.metadata.ra.common.RaConfigPropertyImpl;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.junit.Assert.assertThat;
+
+/**
+ *
+ * A RaParserTestCase.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class JbossRaParserTestCase
+{
+ /**
+ * shouldParseJbossRa10WithSingleProperty
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa10WithSingleProperty() throws Exception
+ {
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("jboss-ra-1.0-single-attribute.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ JbossRaParser parser = new JbossRaParser();
+ //when
+ JbossRa jbossRa = parser.parse(is);
+ //then
+ assertThat(jbossRa, instanceOf(JbossRa10Impl.class));
+ assertThat(jbossRa.getRaConfigProperties().size(), is(1));
+ assertThat(
+ jbossRa
+ .getRaConfigProperties()
+ .get(0)
+ .equals(
+ RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
+ "ra-config-property-value0",
+ "ra-config-property-type0", null)), is(true));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ /**
+ *
+ * shouldParseJbossRa10WithOutProperties
+ *
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa10WithOutProperties() throws Exception
+ {
+
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("jboss-ra-1.0-no-attributes.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ JbossRaParser parser = new JbossRaParser();
+ //when
+ JbossRa jbossRa = parser.parse(is);
+ //then
+ assertThat(jbossRa, instanceOf(JbossRa10Impl.class));
+ assertThat(jbossRa.getRaConfigProperties().size(), is(0));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ /**
+ *
+ * shouldParseJbossRa10WithMultipleProperties
+ *
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa10WithMultipleProperties() throws Exception
+ {
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("jboss-ra-1.0-multiple-attributes.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ JbossRaParser parser = new JbossRaParser();
+ //when
+ JbossRa jbossRa = parser.parse(is);
+ //then
+ assertThat(jbossRa, instanceOf(JbossRa10Impl.class));
+ assertThat(jbossRa.getRaConfigProperties().size(), is(2));
+ assertThat(
+ jbossRa
+ .getRaConfigProperties()
+ .get(0)
+ .equals(
+ RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
+ "ra-config-property-value0",
+ "ra-config-property-type0", null)), is(true));
+ assertThat(
+ jbossRa
+ .getRaConfigProperties()
+ .get(1)
+ .equals(
+ RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name1",
+ "ra-config-property-value1",
+ "ra-config-property-type1", null)), is(true));
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ /**
+ * shouldParseJbossRa20WithSingleProperty
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa20WithSingleProperty() throws Exception
+ {
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("jboss-ra-2.0-single-attribute.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ JbossRaParser parser = new JbossRaParser();
+ //when
+ JbossRa jbossRa = parser.parse(is);
+ //then
+ assertThat(jbossRa, instanceOf(JbossRa20Impl.class));
+ assertThat(jbossRa.getRaConfigProperties().size(), is(1));
+ assertThat(
+ jbossRa
+ .getRaConfigProperties()
+ .get(0)
+ .equals(
+ RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
+ "ra-config-property-value0",
+ "java.lang.Boolean", null)), is(true));
+ assertThat(((JbossRa20) jbossRa).getBeanValidationGroups().size(), is(1));
+ assertThat(((JbossRa20) jbossRa).getBootstrapContext(), is("bootstrap-context0"));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ /**
+ *
+ * shouldParseJbossRa20WithOutProperties
+ *
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa20WithOutProperties() throws Exception
+ {
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("jboss-ra-2.0-no-attributes.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ JbossRaParser parser = new JbossRaParser();
+ //when
+ JbossRa jbossRa = parser.parse(is);
+ //then
+ assertThat(jbossRa, instanceOf(JbossRa20Impl.class));
+ assertThat(jbossRa.getRaConfigProperties().size(), is(0));
+ assertThat(((JbossRa20) jbossRa).getBeanValidationGroups().size(), is(0));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ /**
+ *
+ * shouldParseJbossRa20WithMultipleProperties
+ *
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa20WithMultipleProperties() throws Exception
+ {
+
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("jboss-ra-2.0-multiple-attributes.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ JbossRaParser parser = new JbossRaParser();
+ //when
+ JbossRa jbossRa = parser.parse(is);
+ //then
+ assertThat(jbossRa, instanceOf(JbossRa20Impl.class));
+ assertThat(jbossRa.getRaConfigProperties().size(), is(2));
+ assertThat(
+ jbossRa
+ .getRaConfigProperties()
+ .get(0)
+ .equals(
+ RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
+ "ra-config-property-value0",
+ "java.lang.Boolean", null)), is(true));
+ assertThat(
+ jbossRa
+ .getRaConfigProperties()
+ .get(1)
+ .equals(
+ RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name1",
+ "ra-config-property-value1",
+ "java.lang.Boolean", null)), is(true));
+ assertThat(((JbossRa20) jbossRa).getBeanValidationGroups().size(), is(2));
+ assertThat(((JbossRa20) jbossRa).getBootstrapContext(), is("bootstrap-context0"));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ // @Test
+ // public void shouldParseJbossRa10WithTonsOfProperties() throws Exception
+ // {
+ // //given
+ // File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ // .getResource("jboss-ra-1.0-tons-attributes.xml").toURI());
+ // JbossRaParser parser = new JbossRaParser();
+ // //when
+ // JbossRa jbossRa = parser.parse(new FileInputStream(xmlFile));
+ // //then
+ // assertThat(jbossRa, instanceOf(JbossRa10.class));
+ // assertThat(jbossRa.getRaConfigProperties().size(), is(200000));
+ // assertThat(
+ // jbossRa
+ // .getRaConfigProperties()
+ // .get(0)
+ // .equals(
+ // RaConfigProperty.buildRaConfigProperty("ra-config-property-name0",
+ // "ra-config-property-value0",
+ // "ra-config-property-type0", null)), is(true));
+ // assertThat(
+ // jbossRa
+ // .getRaConfigProperties()
+ // .get(1)
+ // .equals(
+ // RaConfigProperty.buildRaConfigProperty("ra-config-property-name1",
+ //"ra-config-property-value1",
+ // "ra-config-property-type1", null)), is(true));
+ // }
+
+}
Deleted: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java 2010-08-16 22:16:07 UTC (rev 107633)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java 2010-08-16 22:16:52 UTC (rev 107634)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.common.metadata.ra;
-
-import org.jboss.jca.common.api.metadata.ds.DataSources;
-import org.jboss.jca.common.metadata.ds.DsParser;
-
-import java.io.File;
-import java.io.FileInputStream;
-
-import org.jboss.util.file.FileSuffixFilter;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/**
- *
- * A RaParserTestCase.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public class DsParserTestCase
-{
- /**
- * shouldParseAnyExample
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseAnyExample() throws Exception
- {
- FileInputStream is = null;
-
- //given
- File directory = new File(Thread.currentThread().getContextClassLoader().getResource("ds").toURI());
- for (File xmlFile : directory.listFiles(new FileSuffixFilter("-ds.xml")))
- {
- System.out.println(xmlFile.getName());
- try
- {
- is = new FileInputStream(xmlFile);
- DsParser parser = new DsParser();
- //when
- DataSources ds = parser.parse(is);
- //then
- assertThat(ds.getDatasource().size() + ds.getXaDataSource().size(), is(1));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
- }
-
-}
Deleted: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/JbossRaParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/JbossRaParserTestCase.java 2010-08-16 22:16:07 UTC (rev 107633)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/JbossRaParserTestCase.java 2010-08-16 22:16:52 UTC (rev 107634)
@@ -1,315 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.common.metadata.ra;
-
-import org.jboss.jca.common.api.metadata.jbossra.JbossRa;
-import org.jboss.jca.common.api.metadata.jbossra.jbossra20.JbossRa20;
-import org.jboss.jca.common.metadata.jbossra.JbossRaParser;
-import org.jboss.jca.common.metadata.jbossra.jbossra10.JbossRa10Impl;
-import org.jboss.jca.common.metadata.jbossra.jbossra20.JbossRa20Impl;
-import org.jboss.jca.common.metadata.ra.common.RaConfigPropertyImpl;
-
-import java.io.File;
-import java.io.FileInputStream;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.junit.Assert.assertThat;
-
-/**
- *
- * A RaParserTestCase.
- *
- * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
- */
-public class JbossRaParserTestCase
-{
- /**
- * shouldParseJbossRa10WithSingleProperty
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseJbossRa10WithSingleProperty() throws Exception
- {
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("jboss-ra-1.0-single-attribute.xml").toURI());
- is = new FileInputStream(xmlFile);
- JbossRaParser parser = new JbossRaParser();
- //when
- JbossRa jbossRa = parser.parse(is);
- //then
- assertThat(jbossRa, instanceOf(JbossRa10Impl.class));
- assertThat(jbossRa.getRaConfigProperties().size(), is(1));
- assertThat(
- jbossRa
- .getRaConfigProperties()
- .get(0)
- .equals(
- RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
- "ra-config-property-value0",
- "ra-config-property-type0", null)), is(true));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
-
- /**
- *
- * shouldParseJbossRa10WithOutProperties
- *
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseJbossRa10WithOutProperties() throws Exception
- {
-
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("jboss-ra-1.0-no-attributes.xml").toURI());
- is = new FileInputStream(xmlFile);
- JbossRaParser parser = new JbossRaParser();
- //when
- JbossRa jbossRa = parser.parse(is);
- //then
- assertThat(jbossRa, instanceOf(JbossRa10Impl.class));
- assertThat(jbossRa.getRaConfigProperties().size(), is(0));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
-
- /**
- *
- * shouldParseJbossRa10WithMultipleProperties
- *
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseJbossRa10WithMultipleProperties() throws Exception
- {
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("jboss-ra-1.0-multiple-attributes.xml").toURI());
- is = new FileInputStream(xmlFile);
- JbossRaParser parser = new JbossRaParser();
- //when
- JbossRa jbossRa = parser.parse(is);
- //then
- assertThat(jbossRa, instanceOf(JbossRa10Impl.class));
- assertThat(jbossRa.getRaConfigProperties().size(), is(2));
- assertThat(
- jbossRa
- .getRaConfigProperties()
- .get(0)
- .equals(
- RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
- "ra-config-property-value0",
- "ra-config-property-type0", null)), is(true));
- assertThat(
- jbossRa
- .getRaConfigProperties()
- .get(1)
- .equals(
- RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name1",
- "ra-config-property-value1",
- "ra-config-property-type1", null)), is(true));
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
-
- /**
- * shouldParseJbossRa20WithSingleProperty
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseJbossRa20WithSingleProperty() throws Exception
- {
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("jboss-ra-2.0-single-attribute.xml").toURI());
- is = new FileInputStream(xmlFile);
- JbossRaParser parser = new JbossRaParser();
- //when
- JbossRa jbossRa = parser.parse(is);
- //then
- assertThat(jbossRa, instanceOf(JbossRa20Impl.class));
- assertThat(jbossRa.getRaConfigProperties().size(), is(1));
- assertThat(
- jbossRa
- .getRaConfigProperties()
- .get(0)
- .equals(
- RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
- "ra-config-property-value0",
- "java.lang.Boolean", null)), is(true));
- assertThat(((JbossRa20) jbossRa).getBeanValidationGroups().size(), is(1));
- assertThat(((JbossRa20) jbossRa).getBootstrapContext(), is("bootstrap-context0"));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
-
- /**
- *
- * shouldParseJbossRa20WithOutProperties
- *
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseJbossRa20WithOutProperties() throws Exception
- {
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("jboss-ra-2.0-no-attributes.xml").toURI());
- is = new FileInputStream(xmlFile);
- JbossRaParser parser = new JbossRaParser();
- //when
- JbossRa jbossRa = parser.parse(is);
- //then
- assertThat(jbossRa, instanceOf(JbossRa20Impl.class));
- assertThat(jbossRa.getRaConfigProperties().size(), is(0));
- assertThat(((JbossRa20) jbossRa).getBeanValidationGroups().size(), is(0));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
-
- /**
- *
- * shouldParseJbossRa20WithMultipleProperties
- *
- * @throws Exception in case of error
- */
- @Test
- public void shouldParseJbossRa20WithMultipleProperties() throws Exception
- {
-
- FileInputStream is = null;
- try
- {
- //given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("jboss-ra-2.0-multiple-attributes.xml").toURI());
- is = new FileInputStream(xmlFile);
- JbossRaParser parser = new JbossRaParser();
- //when
- JbossRa jbossRa = parser.parse(is);
- //then
- assertThat(jbossRa, instanceOf(JbossRa20Impl.class));
- assertThat(jbossRa.getRaConfigProperties().size(), is(2));
- assertThat(
- jbossRa
- .getRaConfigProperties()
- .get(0)
- .equals(
- RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name0",
- "ra-config-property-value0",
- "java.lang.Boolean", null)), is(true));
- assertThat(
- jbossRa
- .getRaConfigProperties()
- .get(1)
- .equals(
- RaConfigPropertyImpl.buildRaConfigProperty("ra-config-property-name1",
- "ra-config-property-value1",
- "java.lang.Boolean", null)), is(true));
- assertThat(((JbossRa20) jbossRa).getBeanValidationGroups().size(), is(2));
- assertThat(((JbossRa20) jbossRa).getBootstrapContext(), is("bootstrap-context0"));
-
- }
- finally
- {
- if (is != null)
- is.close();
- }
- }
-
- // @Test
- // public void shouldParseJbossRa10WithTonsOfProperties() throws Exception
- // {
- // //given
- // File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- // .getResource("jboss-ra-1.0-tons-attributes.xml").toURI());
- // JbossRaParser parser = new JbossRaParser();
- // //when
- // JbossRa jbossRa = parser.parse(new FileInputStream(xmlFile));
- // //then
- // assertThat(jbossRa, instanceOf(JbossRa10.class));
- // assertThat(jbossRa.getRaConfigProperties().size(), is(200000));
- // assertThat(
- // jbossRa
- // .getRaConfigProperties()
- // .get(0)
- // .equals(
- // RaConfigProperty.buildRaConfigProperty("ra-config-property-name0",
- // "ra-config-property-value0",
- // "ra-config-property-type0", null)), is(true));
- // assertThat(
- // jbossRa
- // .getRaConfigProperties()
- // .get(1)
- // .equals(
- // RaConfigProperty.buildRaConfigProperty("ra-config-property-name1",
- //"ra-config-property-value1",
- // "ra-config-property-type1", null)), is(true));
- // }
-
-}
More information about the jboss-cvs-commits
mailing list