Repository: tomee Updated Branches: refs/heads/tomee-1.7.3-prepare cdc211848 -> 525670753
EOL Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/8a62db64 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/8a62db64 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/8a62db64 Branch: refs/heads/tomee-1.7.3-prepare Commit: 8a62db6444599a6350759bc27d174de9f9445cb8 Parents: cdc2118 Author: [email protected] <[email protected]> Authored: Thu Dec 3 15:38:51 2015 +0100 Committer: [email protected] <[email protected]> Committed: Thu Dec 3 15:38:51 2015 +0100 ---------------------------------------------------------------------- .../main/java/org/superbiz/dsdef/Persister.java | 84 +++--- .../dsdef/DataSourceDefinitionTest.java | 220 +++++++-------- .../org/superbiz/AlternateDataSourceTest.java | 202 +++++++------- .../org/superbiz/AlternateDriverJarTest.java | 248 ++++++++--------- .../src/test/resources/META-INF/resources.xml | 70 ++--- .../java/org/superbiz/mtom/AbstractService.java | 52 ++-- .../main/java/org/superbiz/mtom/EjbService.java | 68 ++--- .../java/org/superbiz/mtom/PojoService.java | 64 ++--- .../main/java/org/superbiz/mtom/Request.java | 86 +++--- .../main/java/org/superbiz/mtom/Response.java | 92 +++---- .../main/java/org/superbiz/mtom/Service.java | 70 ++--- .../org/superbiz/mtom/AbstractServiceTest.java | 94 +++---- .../java/org/superbiz/mtom/EjbServiceTest.java | 58 ++-- .../java/org/superbiz/mtom/PojoServiceTest.java | 60 ++-- .../myfaces/startup/ExtValLifecycleFactory.java | 274 +++++++++---------- ...cdi.core.api.projectstage.ProjectStageHolder | 34 +-- .../main/java/org/superbiz/rest/Greeting.java | 48 ++-- 17 files changed, 912 insertions(+), 912 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java ---------------------------------------------------------------------- diff --git a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java index df4f4ae..6e62ca0 100644 --- a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java +++ b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java @@ -1,42 +1,42 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.dsdef; - -import javax.annotation.Resource; -import javax.annotation.sql.DataSourceDefinition; -import javax.inject.Named; -import javax.sql.DataSource; - -@DataSourceDefinition(transactional = true, - url = "jdbc:h2:mem:persister", - className = "org.h2.jdbcx.JdbcDataSource", - user = "sa", - password = "", - name = "persister", - initialPoolSize = 1, - maxPoolSize = 3 -) -@Named -public class Persister { - - @Resource(name = "persister") - private DataSource ds; - - public DataSource getDs() { - return ds; - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.dsdef; + +import javax.annotation.Resource; +import javax.annotation.sql.DataSourceDefinition; +import javax.inject.Named; +import javax.sql.DataSource; + +@DataSourceDefinition(transactional = true, + url = "jdbc:h2:mem:persister", + className = "org.h2.jdbcx.JdbcDataSource", + user = "sa", + password = "", + name = "persister", + initialPoolSize = 1, + maxPoolSize = 3 +) +@Named +public class Persister { + + @Resource(name = "persister") + private DataSource ds; + + public DataSource getDs() { + return ds; + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java ---------------------------------------------------------------------- diff --git a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java index 1b392e2..58c2612 100644 --- a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java +++ b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java @@ -1,110 +1,110 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.dsdef; - -import org.apache.openejb.resource.jdbc.dbcp.DbcpManagedDataSource; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.ejb.embeddable.EJBContainer; -import javax.inject.Inject; -import javax.naming.NamingException; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -public class DataSourceDefinitionTest { - - private static EJBContainer container; - - @Inject - private Persister persister; - - @BeforeClass - public static void start() { - container = EJBContainer.createEJBContainer(); - } - - @Before - public void inject() throws NamingException { - container.getContext().bind("inject", this); - } - - @AfterClass - public static void stop() { - container.close(); - } - - @Test - public void checkDs() throws SQLException { - final DataSource ds = persister.getDs(); - assertNotNull(ds); - assertThat(ds, instanceOf(DbcpManagedDataSource.class)); - - final DbcpManagedDataSource castedDs = (DbcpManagedDataSource) ds; - - final String driver = castedDs.getDriverClassName(); - assertEquals("org.h2.jdbcx.JdbcDataSource", driver); - - final String user = castedDs.getUserName(); - assertEquals("sa", user); - - final String url = castedDs.getUrl(); - assertEquals("jdbc:h2:mem:persister", url); - - final int initPoolSize = castedDs.getInitialSize(); - assertEquals(1, initPoolSize); - - final int maxIdle = castedDs.getMaxIdle(); - assertEquals(3, maxIdle); - - final Connection connection = ds.getConnection(); - assertNotNull(connection); - - execute(connection, "CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"); - execute(connection, "INSERT INTO TEST(ID, NAME) VALUES(1, 'foo')"); - connection.commit(); - - final PreparedStatement statement = ds.getConnection().prepareStatement("SELECT NAME FROM TEST"); - statement.execute(); - final ResultSet set = statement.getResultSet(); - - assertTrue(set.next()); - assertEquals("foo", set.getString("NAME")); - } - - @Test - public void lookup() throws NamingException { - final Object o = container.getContext().lookup("java:persister"); - assertNotNull(o); - assertEquals(persister.getDs(), o); - } - - private void execute(final Connection connection, final String sql) throws SQLException { - connection.prepareStatement(sql).execute(); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.dsdef; + +import org.apache.openejb.resource.jdbc.dbcp.DbcpManagedDataSource; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.ejb.embeddable.EJBContainer; +import javax.inject.Inject; +import javax.naming.NamingException; +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +public class DataSourceDefinitionTest { + + private static EJBContainer container; + + @Inject + private Persister persister; + + @BeforeClass + public static void start() { + container = EJBContainer.createEJBContainer(); + } + + @Before + public void inject() throws NamingException { + container.getContext().bind("inject", this); + } + + @AfterClass + public static void stop() { + container.close(); + } + + @Test + public void checkDs() throws SQLException { + final DataSource ds = persister.getDs(); + assertNotNull(ds); + assertThat(ds, instanceOf(DbcpManagedDataSource.class)); + + final DbcpManagedDataSource castedDs = (DbcpManagedDataSource) ds; + + final String driver = castedDs.getDriverClassName(); + assertEquals("org.h2.jdbcx.JdbcDataSource", driver); + + final String user = castedDs.getUserName(); + assertEquals("sa", user); + + final String url = castedDs.getUrl(); + assertEquals("jdbc:h2:mem:persister", url); + + final int initPoolSize = castedDs.getInitialSize(); + assertEquals(1, initPoolSize); + + final int maxIdle = castedDs.getMaxIdle(); + assertEquals(3, maxIdle); + + final Connection connection = ds.getConnection(); + assertNotNull(connection); + + execute(connection, "CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"); + execute(connection, "INSERT INTO TEST(ID, NAME) VALUES(1, 'foo')"); + connection.commit(); + + final PreparedStatement statement = ds.getConnection().prepareStatement("SELECT NAME FROM TEST"); + statement.execute(); + final ResultSet set = statement.getResultSet(); + + assertTrue(set.next()); + assertEquals("foo", set.getString("NAME")); + } + + @Test + public void lookup() throws NamingException { + final Object o = container.getContext().lookup("java:persister"); + assertNotNull(o); + assertEquals(persister.getDs(), o); + } + + private void execute(final Connection connection, final String sql) throws SQLException { + connection.prepareStatement(sql).execute(); + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDataSourceTest.java ---------------------------------------------------------------------- diff --git a/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDataSourceTest.java b/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDataSourceTest.java index 252429e..2a5a346 100644 --- a/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDataSourceTest.java +++ b/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDataSourceTest.java @@ -1,101 +1,101 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz; - -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -import javax.annotation.Resource; -import javax.ejb.EJB; -import javax.ejb.Stateless; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; - -@RunWith(Arquillian.class) -public class AlternateDataSourceTest { - - @Deployment - public static WebArchive createDeployment() { - - return ShrinkWrap.create(WebArchive.class, "test.war") - .addClasses(DataSourceTester.class) - .addAsResource(new ClassLoaderAsset("META-INF/ejb-jar.xml"), "META-INF/ejb-jar.xml"); - //We are using src/test/conf/tomee.xml, but this also works - .addAsResource(new ClassLoaderAsset("META-INF/resources.xml"), "META-INF/resources.xml"); - //Or even using a persistence context - .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml"); - } - - @EJB - private DataSourceTester tester; - - @Test - public void testDataSourceOne() throws Exception { - Assert.assertEquals("Should be using 10.10.1.1 - (1458268)", "10.10.1.1 - (1458268)", tester.getOne()); - } - - @Test - public void testDataSourceTwo() throws Exception { - Assert.assertEquals("Should be using 10.9.1.0 - (1344872)", "10.9.1.0 - (1344872)", tester.getTwo()); - } - - @Test - public void testDataSourceBoth() throws Exception { - Assert.assertEquals("Should be using 10.10.1.1 - (1458268)|10.9.1.0 - (1344872)", "10.10.1.1 - (1458268)|10.9.1.0 - (1344872)", tester.getBoth()); - } - - @Stateless - public static class DataSourceTester { - - @Resource(name = "DatabaseOne") - DataSource dataSourceOne; - - @Resource(name = "DatabaseTwo") - DataSource dataSourceTwo; - - public String getOne() throws Exception { - return getVersion(dataSourceOne); - } - - public String getTwo() throws Exception { - return getVersion(dataSourceTwo); - } - - public String getBoth() throws Exception { - return getOne() + "|" + getTwo(); - } - - private static String getVersion(final DataSource ds) throws SQLException { - Connection con = null; - try { - con = ds.getConnection(); - final DatabaseMetaData md = con.getMetaData(); - return md.getDriverVersion(); - } finally { - if (con != null) { - con.close(); - } - } - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.annotation.Resource; +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.SQLException; + +@RunWith(Arquillian.class) +public class AlternateDataSourceTest { + + @Deployment + public static WebArchive createDeployment() { + + return ShrinkWrap.create(WebArchive.class, "test.war") + .addClasses(DataSourceTester.class) + .addAsResource(new ClassLoaderAsset("META-INF/ejb-jar.xml"), "META-INF/ejb-jar.xml"); + //We are using src/test/conf/tomee.xml, but this also works - .addAsResource(new ClassLoaderAsset("META-INF/resources.xml"), "META-INF/resources.xml"); + //Or even using a persistence context - .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml"); + } + + @EJB + private DataSourceTester tester; + + @Test + public void testDataSourceOne() throws Exception { + Assert.assertEquals("Should be using 10.10.1.1 - (1458268)", "10.10.1.1 - (1458268)", tester.getOne()); + } + + @Test + public void testDataSourceTwo() throws Exception { + Assert.assertEquals("Should be using 10.9.1.0 - (1344872)", "10.9.1.0 - (1344872)", tester.getTwo()); + } + + @Test + public void testDataSourceBoth() throws Exception { + Assert.assertEquals("Should be using 10.10.1.1 - (1458268)|10.9.1.0 - (1344872)", "10.10.1.1 - (1458268)|10.9.1.0 - (1344872)", tester.getBoth()); + } + + @Stateless + public static class DataSourceTester { + + @Resource(name = "DatabaseOne") + DataSource dataSourceOne; + + @Resource(name = "DatabaseTwo") + DataSource dataSourceTwo; + + public String getOne() throws Exception { + return getVersion(dataSourceOne); + } + + public String getTwo() throws Exception { + return getVersion(dataSourceTwo); + } + + public String getBoth() throws Exception { + return getOne() + "|" + getTwo(); + } + + private static String getVersion(final DataSource ds) throws SQLException { + Connection con = null; + try { + con = ds.getConnection(); + final DatabaseMetaData md = con.getMetaData(); + return md.getDriverVersion(); + } finally { + if (con != null) { + con.close(); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDriverJarTest.java ---------------------------------------------------------------------- diff --git a/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDriverJarTest.java b/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDriverJarTest.java index 32fa5d6..0d8d35d 100644 --- a/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDriverJarTest.java +++ b/examples/datasource-versioning/src/test/java/org/superbiz/AlternateDriverJarTest.java @@ -1,124 +1,124 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz; - -import org.apache.openejb.jee.EjbJar; -import org.apache.openejb.jee.SingletonBean; -import org.apache.openejb.junit.ApplicationComposer; -import org.apache.openejb.testing.Configuration; -import org.apache.openejb.testing.Module; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -import javax.annotation.Resource; -import javax.ejb.EJB; -import javax.ejb.LocalBean; -import javax.ejb.Singleton; -import javax.sql.DataSource; -import java.io.File; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.util.Properties; - -@RunWith(ApplicationComposer.class) -public class AlternateDriverJarTest { - - private static final String USER = "SA"; - private static final String PASSWORD = ""; - - @Configuration - public Properties config() { - - final File drivers = new File(new File("target"), "drivers").getAbsoluteFile(); - - final Properties p = new Properties(); - p.put("openejb.jdbc.datasource-creator", "dbcp-alternative"); - - File file = new File(drivers, "derby-10.10.1.1.jar"); - Assert.assertTrue("Failed to find: " + file, file.exists()); - - p.put("JdbcOne", "new://Resource?type=DataSource&classpath=" - + file.getAbsolutePath().replace("\\", "/")); - p.put("JdbcOne.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("JdbcOne.JdbcUrl", "jdbc:derby:memory:JdbcOne;create=true"); - p.put("JdbcOne.UserName", USER); - p.put("JdbcOne.Password", PASSWORD); - p.put("JdbcOne.JtaManaged", "false"); - - file = new File(drivers, "derby-10.9.1.0.jar"); - Assert.assertTrue("Failed to find: " + file, file.exists()); - - p.put("JdbcTwo", "new://Resource?type=DataSource&classpath=" - + file.getAbsolutePath().replace("\\", "/")); - p.put("JdbcTwo.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); - p.put("JdbcTwo.JdbcUrl", "jdbc:derby:memory:JdbcTwo;create=true"); - p.put("JdbcTwo.UserName", USER); - p.put("JdbcTwo.Password", PASSWORD); - p.put("JdbcTwo.JtaManaged", "false"); - return p; - } - - @Module - public EjbJar app() throws Exception { - return new EjbJar() - .enterpriseBean(new SingletonBean(JdbcOne.class).localBean()) - .enterpriseBean(new SingletonBean(JdbcTwo.class).localBean()); - } - - @EJB - private JdbcOne one; - - @EJB - private JdbcTwo two; - - @Test - public void testBoth() throws Exception { - Assert.assertEquals("Should be using 10.10.1.1 - (1458268)", "10.10.1.1 - (1458268)", one.getDriverVersion()); - Assert.assertEquals("Should be using 10.9.1.0 - (1344872)", "10.9.1.0 - (1344872)", two.getDriverVersion()); - } - - @LocalBean - @Singleton - public static class JdbcOne { - - @Resource(name = "JdbcOne") - private DataSource ds; - - public String getDriverVersion() throws Exception { - - final Connection con = ds.getConnection(); - final DatabaseMetaData md = con.getMetaData(); - return md.getDriverVersion(); - } - } - - @LocalBean - @Singleton - public static class JdbcTwo { - - @Resource(name = "JdbcTwo") - private DataSource ds; - - public String getDriverVersion() throws Exception { - - final Connection con = ds.getConnection(); - final DatabaseMetaData md = con.getMetaData(); - return md.getDriverVersion(); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz; + +import org.apache.openejb.jee.EjbJar; +import org.apache.openejb.jee.SingletonBean; +import org.apache.openejb.junit.ApplicationComposer; +import org.apache.openejb.testing.Configuration; +import org.apache.openejb.testing.Module; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.annotation.Resource; +import javax.ejb.EJB; +import javax.ejb.LocalBean; +import javax.ejb.Singleton; +import javax.sql.DataSource; +import java.io.File; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.util.Properties; + +@RunWith(ApplicationComposer.class) +public class AlternateDriverJarTest { + + private static final String USER = "SA"; + private static final String PASSWORD = ""; + + @Configuration + public Properties config() { + + final File drivers = new File(new File("target"), "drivers").getAbsoluteFile(); + + final Properties p = new Properties(); + p.put("openejb.jdbc.datasource-creator", "dbcp-alternative"); + + File file = new File(drivers, "derby-10.10.1.1.jar"); + Assert.assertTrue("Failed to find: " + file, file.exists()); + + p.put("JdbcOne", "new://Resource?type=DataSource&classpath=" + + file.getAbsolutePath().replace("\\", "/")); + p.put("JdbcOne.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); + p.put("JdbcOne.JdbcUrl", "jdbc:derby:memory:JdbcOne;create=true"); + p.put("JdbcOne.UserName", USER); + p.put("JdbcOne.Password", PASSWORD); + p.put("JdbcOne.JtaManaged", "false"); + + file = new File(drivers, "derby-10.9.1.0.jar"); + Assert.assertTrue("Failed to find: " + file, file.exists()); + + p.put("JdbcTwo", "new://Resource?type=DataSource&classpath=" + + file.getAbsolutePath().replace("\\", "/")); + p.put("JdbcTwo.JdbcDriver", "org.apache.derby.jdbc.EmbeddedDriver"); + p.put("JdbcTwo.JdbcUrl", "jdbc:derby:memory:JdbcTwo;create=true"); + p.put("JdbcTwo.UserName", USER); + p.put("JdbcTwo.Password", PASSWORD); + p.put("JdbcTwo.JtaManaged", "false"); + return p; + } + + @Module + public EjbJar app() throws Exception { + return new EjbJar() + .enterpriseBean(new SingletonBean(JdbcOne.class).localBean()) + .enterpriseBean(new SingletonBean(JdbcTwo.class).localBean()); + } + + @EJB + private JdbcOne one; + + @EJB + private JdbcTwo two; + + @Test + public void testBoth() throws Exception { + Assert.assertEquals("Should be using 10.10.1.1 - (1458268)", "10.10.1.1 - (1458268)", one.getDriverVersion()); + Assert.assertEquals("Should be using 10.9.1.0 - (1344872)", "10.9.1.0 - (1344872)", two.getDriverVersion()); + } + + @LocalBean + @Singleton + public static class JdbcOne { + + @Resource(name = "JdbcOne") + private DataSource ds; + + public String getDriverVersion() throws Exception { + + final Connection con = ds.getConnection(); + final DatabaseMetaData md = con.getMetaData(); + return md.getDriverVersion(); + } + } + + @LocalBean + @Singleton + public static class JdbcTwo { + + @Resource(name = "JdbcTwo") + private DataSource ds; + + public String getDriverVersion() throws Exception { + + final Connection con = ds.getConnection(); + final DatabaseMetaData md = con.getMetaData(); + return md.getDriverVersion(); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/datasource-versioning/src/test/resources/META-INF/resources.xml ---------------------------------------------------------------------- diff --git a/examples/datasource-versioning/src/test/resources/META-INF/resources.xml b/examples/datasource-versioning/src/test/resources/META-INF/resources.xml index 62c12dc..3d18c66 100644 --- a/examples/datasource-versioning/src/test/resources/META-INF/resources.xml +++ b/examples/datasource-versioning/src/test/resources/META-INF/resources.xml @@ -1,36 +1,36 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<resources> - - <!--Not used, just here as an example--> - - <Resource id="DatabaseOne" type="DataSource" classpath="${catalina.base}/../../drivers/derby-10.10.1.1.jar"> - JdbcDriver org.apache.derby.jdbc.EmbeddedDriver - JdbcUrl jdbc:derby:target/databaseOne;create=true - UserName SA - </Resource> - - <Resource id="DatabaseTwo" type="DataSource" classpath="${catalina.base}/../../drivers/derby-10.9.1.0.jar"> - JdbcDriver org.apache.derby.jdbc.EmbeddedDriver - JdbcUrl jdbc:derby:target/databaseTwo;create=true - UserName SA - </Resource> - +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<resources> + + <!--Not used, just here as an example--> + + <Resource id="DatabaseOne" type="DataSource" classpath="${catalina.base}/../../drivers/derby-10.10.1.1.jar"> + JdbcDriver org.apache.derby.jdbc.EmbeddedDriver + JdbcUrl jdbc:derby:target/databaseOne;create=true + UserName SA + </Resource> + + <Resource id="DatabaseTwo" type="DataSource" classpath="${catalina.base}/../../drivers/derby-10.9.1.0.jar"> + JdbcDriver org.apache.derby.jdbc.EmbeddedDriver + JdbcUrl jdbc:derby:target/databaseTwo;create=true + UserName SA + </Resource> + </resources> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/main/java/org/superbiz/mtom/AbstractService.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/main/java/org/superbiz/mtom/AbstractService.java b/examples/mtom/src/main/java/org/superbiz/mtom/AbstractService.java index 8613218..e447b41 100644 --- a/examples/mtom/src/main/java/org/superbiz/mtom/AbstractService.java +++ b/examples/mtom/src/main/java/org/superbiz/mtom/AbstractService.java @@ -1,26 +1,26 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import javax.activation.DataHandler; - -public class AbstractService { - - public Response convertToBytes(final Request request) { - return new Response(new DataHandler(request.getMessage().getBytes(), "application/octet-stream")); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import javax.activation.DataHandler; + +public class AbstractService { + + public Response convertToBytes(final Request request) { + return new Response(new DataHandler(request.getMessage().getBytes(), "application/octet-stream")); + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/main/java/org/superbiz/mtom/EjbService.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/main/java/org/superbiz/mtom/EjbService.java b/examples/mtom/src/main/java/org/superbiz/mtom/EjbService.java index b417854..a170db7 100644 --- a/examples/mtom/src/main/java/org/superbiz/mtom/EjbService.java +++ b/examples/mtom/src/main/java/org/superbiz/mtom/EjbService.java @@ -1,34 +1,34 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import javax.ejb.Stateless; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.jws.soap.SOAPBinding.ParameterStyle; -import javax.jws.soap.SOAPBinding.Style; -import javax.jws.soap.SOAPBinding.Use; -import javax.xml.ws.BindingType; -import javax.xml.ws.soap.MTOM; - -@Stateless -@WebService -@SOAPBinding(use = Use.LITERAL, parameterStyle = ParameterStyle.BARE, style = Style.DOCUMENT) -@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) -@MTOM -public class EjbService extends AbstractService implements Service { -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import javax.ejb.Stateless; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.jws.soap.SOAPBinding.ParameterStyle; +import javax.jws.soap.SOAPBinding.Style; +import javax.jws.soap.SOAPBinding.Use; +import javax.xml.ws.BindingType; +import javax.xml.ws.soap.MTOM; + +@Stateless +@WebService +@SOAPBinding(use = Use.LITERAL, parameterStyle = ParameterStyle.BARE, style = Style.DOCUMENT) +@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) +@MTOM +public class EjbService extends AbstractService implements Service { +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/main/java/org/superbiz/mtom/PojoService.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/main/java/org/superbiz/mtom/PojoService.java b/examples/mtom/src/main/java/org/superbiz/mtom/PojoService.java index 17a2728..3160942 100644 --- a/examples/mtom/src/main/java/org/superbiz/mtom/PojoService.java +++ b/examples/mtom/src/main/java/org/superbiz/mtom/PojoService.java @@ -1,32 +1,32 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.jws.soap.SOAPBinding.ParameterStyle; -import javax.jws.soap.SOAPBinding.Style; -import javax.jws.soap.SOAPBinding.Use; -import javax.xml.ws.BindingType; -import javax.xml.ws.soap.MTOM; - -@WebService -@SOAPBinding(use = Use.LITERAL, parameterStyle = ParameterStyle.BARE, style = Style.DOCUMENT) -@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) -@MTOM -public class PojoService extends AbstractService implements Service { -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.jws.soap.SOAPBinding.ParameterStyle; +import javax.jws.soap.SOAPBinding.Style; +import javax.jws.soap.SOAPBinding.Use; +import javax.xml.ws.BindingType; +import javax.xml.ws.soap.MTOM; + +@WebService +@SOAPBinding(use = Use.LITERAL, parameterStyle = ParameterStyle.BARE, style = Style.DOCUMENT) +@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) +@MTOM +public class PojoService extends AbstractService implements Service { +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/main/java/org/superbiz/mtom/Request.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/main/java/org/superbiz/mtom/Request.java b/examples/mtom/src/main/java/org/superbiz/mtom/Request.java index 804b8e2..11ab11b 100644 --- a/examples/mtom/src/main/java/org/superbiz/mtom/Request.java +++ b/examples/mtom/src/main/java/org/superbiz/mtom/Request.java @@ -1,43 +1,43 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - -@XmlType -@XmlAccessorType(XmlAccessType.FIELD) -public class Request { - - private String message; - - public Request() { - } - - public Request(final String message) { - this.message = message; - } - - public String getMessage() { - return this.message; - } - - public void setMessage(final String message) { - this.message = message; - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +@XmlType +@XmlAccessorType(XmlAccessType.FIELD) +public class Request { + + private String message; + + public Request() { + } + + public Request(final String message) { + this.message = message; + } + + public String getMessage() { + return this.message; + } + + public void setMessage(final String message) { + this.message = message; + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/main/java/org/superbiz/mtom/Response.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/main/java/org/superbiz/mtom/Response.java b/examples/mtom/src/main/java/org/superbiz/mtom/Response.java index dde9919..3fcf809 100644 --- a/examples/mtom/src/main/java/org/superbiz/mtom/Response.java +++ b/examples/mtom/src/main/java/org/superbiz/mtom/Response.java @@ -1,46 +1,46 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import javax.activation.DataHandler; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlMimeType; -import javax.xml.bind.annotation.XmlType; - -@XmlType -@XmlAccessorType(XmlAccessType.FIELD) -public class Response { - - @XmlMimeType("application/octet-stream") - private DataHandler result; - - public Response() { - } - - public Response(final DataHandler result) { - this.result = result; - } - - public DataHandler getResult() { - return this.result; - } - - public void setResult(final DataHandler result) { - this.result = result; - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import javax.activation.DataHandler; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlMimeType; +import javax.xml.bind.annotation.XmlType; + +@XmlType +@XmlAccessorType(XmlAccessType.FIELD) +public class Response { + + @XmlMimeType("application/octet-stream") + private DataHandler result; + + public Response() { + } + + public Response(final DataHandler result) { + this.result = result; + } + + public DataHandler getResult() { + return this.result; + } + + public void setResult(final DataHandler result) { + this.result = result; + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/main/java/org/superbiz/mtom/Service.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/main/java/org/superbiz/mtom/Service.java b/examples/mtom/src/main/java/org/superbiz/mtom/Service.java index 21c88b0..5a9d5c5 100644 --- a/examples/mtom/src/main/java/org/superbiz/mtom/Service.java +++ b/examples/mtom/src/main/java/org/superbiz/mtom/Service.java @@ -1,35 +1,35 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.jws.soap.SOAPBinding.ParameterStyle; -import javax.jws.soap.SOAPBinding.Style; -import javax.jws.soap.SOAPBinding.Use; -import javax.xml.ws.BindingType; -import javax.xml.ws.soap.MTOM; - -@WebService -@SOAPBinding(use = Use.LITERAL, parameterStyle = ParameterStyle.BARE, style = Style.DOCUMENT) -@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) -@MTOM -public interface Service { - - Response convertToBytes(Request request); - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.jws.soap.SOAPBinding.ParameterStyle; +import javax.jws.soap.SOAPBinding.Style; +import javax.jws.soap.SOAPBinding.Use; +import javax.xml.ws.BindingType; +import javax.xml.ws.soap.MTOM; + +@WebService +@SOAPBinding(use = Use.LITERAL, parameterStyle = ParameterStyle.BARE, style = Style.DOCUMENT) +@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING) +@MTOM +public interface Service { + + Response convertToBytes(Request request); + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/test/java/org/superbiz/mtom/AbstractServiceTest.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/test/java/org/superbiz/mtom/AbstractServiceTest.java b/examples/mtom/src/test/java/org/superbiz/mtom/AbstractServiceTest.java index 07a78de..849eec5 100644 --- a/examples/mtom/src/test/java/org/superbiz/mtom/AbstractServiceTest.java +++ b/examples/mtom/src/test/java/org/superbiz/mtom/AbstractServiceTest.java @@ -1,47 +1,47 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import org.apache.openejb.junit.ApplicationComposer; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -import javax.xml.ws.WebServiceRef; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -@RunWith(ApplicationComposer.class) -public abstract class AbstractServiceTest { - - @WebServiceRef - private Service service; - - @Test - public void test() throws IOException { - final Response response = this.service.convertToBytes(new Request("hello world!")); - - Assert.assertNotNull(response.getResult()); - - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - - response.getResult().writeTo(outputStream); - - Assert.assertTrue("datahandler is empty", outputStream.size() > 0); - } - -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import org.apache.openejb.junit.ApplicationComposer; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.xml.ws.WebServiceRef; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +@RunWith(ApplicationComposer.class) +public abstract class AbstractServiceTest { + + @WebServiceRef + private Service service; + + @Test + public void test() throws IOException { + final Response response = this.service.convertToBytes(new Request("hello world!")); + + Assert.assertNotNull(response.getResult()); + + final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + + response.getResult().writeTo(outputStream); + + Assert.assertTrue("datahandler is empty", outputStream.size() > 0); + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/test/java/org/superbiz/mtom/EjbServiceTest.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/test/java/org/superbiz/mtom/EjbServiceTest.java b/examples/mtom/src/test/java/org/superbiz/mtom/EjbServiceTest.java index dcf7785..43e4d82 100644 --- a/examples/mtom/src/test/java/org/superbiz/mtom/EjbServiceTest.java +++ b/examples/mtom/src/test/java/org/superbiz/mtom/EjbServiceTest.java @@ -1,29 +1,29 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import org.apache.openejb.testing.EnableServices; -import org.apache.openejb.testing.Module; - -@EnableServices("jaxws") // maybe this should be @Inherited like @RunWith -public class EjbServiceTest extends AbstractServiceTest { - - @Module - public Class<?>[] module() { - return new Class<?>[]{EjbService.class}; - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import org.apache.openejb.testing.EnableServices; +import org.apache.openejb.testing.Module; + +@EnableServices("jaxws") // maybe this should be @Inherited like @RunWith +public class EjbServiceTest extends AbstractServiceTest { + + @Module + public Class<?>[] module() { + return new Class<?>[]{EjbService.class}; + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/mtom/src/test/java/org/superbiz/mtom/PojoServiceTest.java ---------------------------------------------------------------------- diff --git a/examples/mtom/src/test/java/org/superbiz/mtom/PojoServiceTest.java b/examples/mtom/src/test/java/org/superbiz/mtom/PojoServiceTest.java index cf2f013..c08bf9b 100644 --- a/examples/mtom/src/test/java/org/superbiz/mtom/PojoServiceTest.java +++ b/examples/mtom/src/test/java/org/superbiz/mtom/PojoServiceTest.java @@ -1,30 +1,30 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.mtom; - -import org.apache.openejb.jee.WebApp; -import org.apache.openejb.testing.EnableServices; -import org.apache.openejb.testing.Module; - -@EnableServices("jaxws") // maybe this should be @Inherited like @RunWith -public class PojoServiceTest extends AbstractServiceTest { - - @Module - public WebApp module() { - return new WebApp().addServlet("ws", PojoService.class.getName(), "/ws"); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.mtom; + +import org.apache.openejb.jee.WebApp; +import org.apache.openejb.testing.EnableServices; +import org.apache.openejb.testing.Module; + +@EnableServices("jaxws") // maybe this should be @Inherited like @RunWith +public class PojoServiceTest extends AbstractServiceTest { + + @Module + public WebApp module() { + return new WebApp().addServlet("ws", PojoService.class.getName(), "/ws"); + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java ---------------------------------------------------------------------- diff --git a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java index 37c1131..0da401d 100644 --- a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java +++ b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java @@ -1,137 +1,137 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.superbiz.myfaces.startup; - -import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration; -import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration; -import org.apache.myfaces.extensions.validator.core.proxy.DefaultProxyHelper; -import org.apache.myfaces.extensions.validator.core.proxy.ProxyHelper; -import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener; - -import javax.faces.FacesException; -import javax.faces.context.FacesContext; -import javax.faces.event.PhaseListener; -import javax.faces.lifecycle.Lifecycle; -import javax.faces.lifecycle.LifecycleFactory; -import java.util.Iterator; - -//TODO remove it after upgrading to ExtVal r8+ -public class ExtValLifecycleFactory extends LifecycleFactory -{ - private final LifecycleFactory wrapped; - - public ExtValLifecycleFactory(LifecycleFactory wrapped) - { - this.wrapped = wrapped; - } - - @Override - public void addLifecycle(String lifecycleId, Lifecycle lifecycle) - { - wrapped.addLifecycle(lifecycleId, lifecycle); - } - - @Override - public Lifecycle getLifecycle(String lifecycleId) - { - return new LifecycleWrapper(wrapped.getLifecycle(lifecycleId)); - } - - @Override - public Iterator<String> getLifecycleIds() - { - return wrapped.getLifecycleIds(); - } - - @Override - public LifecycleFactory getWrapped() - { - return wrapped; - } - - private static class LifecycleWrapper extends Lifecycle - { - private final Lifecycle wrapped; - private static boolean firstPhaseListener = true; - - private LifecycleWrapper(Lifecycle wrapped) - { - this.wrapped = wrapped; - } - - @Override - public void addPhaseListener(PhaseListener listener) - { - if (firstPhaseListener) - { - //forced order independent of any other config - firstPhaseListener = false; - wrapped.addPhaseListener(new ExtValStartupListener()); - } - wrapped.addPhaseListener(listener); - } - - @Override - public void execute(FacesContext context) throws FacesException - { - wrapped.execute(context); - } - - @Override - public PhaseListener[] getPhaseListeners() - { - return wrapped.getPhaseListeners(); - } - - @Override - public void removePhaseListener(PhaseListener listener) - { - wrapped.removePhaseListener(listener); - } - - @Override - public void render(FacesContext context) throws FacesException - { - wrapped.render(context); - } - } - - public static class ExtValStartupListener extends AbstractStartupListener - { - @Override - protected void init() - { - ExtValCoreConfiguration.use(new DefaultExtValCoreConfiguration() { - @Override - public ProxyHelper proxyHelper() { - return new DefaultProxyHelper() { - @Override - public boolean isProxiedClass(Class currentClass) { - if (currentClass == null || currentClass.getSuperclass() == null) { - return false; - } - return currentClass.getName().startsWith(currentClass.getSuperclass().getName()) && - currentClass.getName().contains("$$"); - } - }; - } - }, true); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.superbiz.myfaces.startup; + +import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration; +import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration; +import org.apache.myfaces.extensions.validator.core.proxy.DefaultProxyHelper; +import org.apache.myfaces.extensions.validator.core.proxy.ProxyHelper; +import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener; + +import javax.faces.FacesException; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseListener; +import javax.faces.lifecycle.Lifecycle; +import javax.faces.lifecycle.LifecycleFactory; +import java.util.Iterator; + +//TODO remove it after upgrading to ExtVal r8+ +public class ExtValLifecycleFactory extends LifecycleFactory +{ + private final LifecycleFactory wrapped; + + public ExtValLifecycleFactory(LifecycleFactory wrapped) + { + this.wrapped = wrapped; + } + + @Override + public void addLifecycle(String lifecycleId, Lifecycle lifecycle) + { + wrapped.addLifecycle(lifecycleId, lifecycle); + } + + @Override + public Lifecycle getLifecycle(String lifecycleId) + { + return new LifecycleWrapper(wrapped.getLifecycle(lifecycleId)); + } + + @Override + public Iterator<String> getLifecycleIds() + { + return wrapped.getLifecycleIds(); + } + + @Override + public LifecycleFactory getWrapped() + { + return wrapped; + } + + private static class LifecycleWrapper extends Lifecycle + { + private final Lifecycle wrapped; + private static boolean firstPhaseListener = true; + + private LifecycleWrapper(Lifecycle wrapped) + { + this.wrapped = wrapped; + } + + @Override + public void addPhaseListener(PhaseListener listener) + { + if (firstPhaseListener) + { + //forced order independent of any other config + firstPhaseListener = false; + wrapped.addPhaseListener(new ExtValStartupListener()); + } + wrapped.addPhaseListener(listener); + } + + @Override + public void execute(FacesContext context) throws FacesException + { + wrapped.execute(context); + } + + @Override + public PhaseListener[] getPhaseListeners() + { + return wrapped.getPhaseListeners(); + } + + @Override + public void removePhaseListener(PhaseListener listener) + { + wrapped.removePhaseListener(listener); + } + + @Override + public void render(FacesContext context) throws FacesException + { + wrapped.render(context); + } + } + + public static class ExtValStartupListener extends AbstractStartupListener + { + @Override + protected void init() + { + ExtValCoreConfiguration.use(new DefaultExtValCoreConfiguration() { + @Override + public ProxyHelper proxyHelper() { + return new DefaultProxyHelper() { + @Override + public boolean isProxiedClass(Class currentClass) { + if (currentClass == null || currentClass.getSuperclass() == null) { + return false; + } + return currentClass.getName().startsWith(currentClass.getSuperclass().getName()) && + currentClass.getName().contains("$$"); + } + }; + } + }, true); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/myfaces-codi-demo/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolder ---------------------------------------------------------------------- diff --git a/examples/myfaces-codi-demo/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolder b/examples/myfaces-codi-demo/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolder index 57f406f..9bcaeeb 100644 --- a/examples/myfaces-codi-demo/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolder +++ b/examples/myfaces-codi-demo/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolder @@ -1,18 +1,18 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + org.superbiz.myfaces.CustomProjectStage \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/8a62db64/examples/rest-cdi/src/main/java/org/superbiz/rest/Greeting.java ---------------------------------------------------------------------- diff --git a/examples/rest-cdi/src/main/java/org/superbiz/rest/Greeting.java b/examples/rest-cdi/src/main/java/org/superbiz/rest/Greeting.java index f6c4379..d34f1c0 100644 --- a/examples/rest-cdi/src/main/java/org/superbiz/rest/Greeting.java +++ b/examples/rest-cdi/src/main/java/org/superbiz/rest/Greeting.java @@ -1,24 +1,24 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.superbiz.rest; - -public class Greeting { - - public String doSomething(final String value) { - return value.toLowerCase(); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.superbiz.rest; + +public class Greeting { + + public String doSomething(final String value) { + return value.toLowerCase(); + } +}
