You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/10/30 04:44:35 UTC
svn commit: r1195109 [7/18] - in /openejb/trunk/openejb/examples:
access-timeout/ application-composer/ applicationexception/ async-methods/
bean-validation-design-by-contract/ cdi-basic/ cdi-interceptors/
cdi-produces-disposes/ component-interfaces/ c...
Modified: openejb/trunk/openejb/examples/jpa-hibernate/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/jpa-hibernate/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/jpa-hibernate/README.md (original)
+++ openejb/trunk/openejb/examples/jpa-hibernate/README.md Sun Oct 30 03:44:33 2011
@@ -1,100 +1,9 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: JPA with Hibernate 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jpa-hibernate ---
-[INFO] Deleting /Users/dblevins/examples/jpa-hibernate/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ jpa-hibernate ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 1 resource
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jpa-hibernate ---
-[INFO] Compiling 2 source files to /Users/dblevins/examples/jpa-hibernate/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ jpa-hibernate ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/jpa-hibernate/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ jpa-hibernate ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/jpa-hibernate/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ jpa-hibernate ---
-[INFO] Surefire report directory: /Users/dblevins/examples/jpa-hibernate/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.injection.h3jpa.MoviesTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/jpa-hibernate
-INFO - openejb.base = /Users/dblevins/examples/jpa-hibernate
-INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
-INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
-INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
-INFO - Found EjbModule in classpath: /Users/dblevins/examples/jpa-hibernate/target/classes
-INFO - Beginning load: /Users/dblevins/examples/jpa-hibernate/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/jpa-hibernate
-INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
-INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
-INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
-INFO - Auto-creating a container for bean org.superbiz.injection.h3jpa.MoviesTest: Container(type=MANAGED, id=Default Managed Container)
-INFO - Configuring PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence)
-INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.
-INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)
-INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
-INFO - Enterprise application "/Users/dblevins/examples/jpa-hibernate" loaded.
-INFO - Assembling app: /Users/dblevins/examples/jpa-hibernate
-INFO - PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence) - provider time 642ms
-INFO - Jndi(name="java:global/jpa-hibernate/Movies!org.superbiz.injection.h3jpa.Movies")
-INFO - Jndi(name="java:global/jpa-hibernate/Movies")
-INFO - Jndi(name="java:global/EjbModule1623810826/org.superbiz.injection.h3jpa.MoviesTest!org.superbiz.injection.h3jpa.MoviesTest")
-INFO - Jndi(name="java:global/EjbModule1623810826/org.superbiz.injection.h3jpa.MoviesTest")
-INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Created Ejb(deployment-id=org.superbiz.injection.h3jpa.MoviesTest, ejb-name=org.superbiz.injection.h3jpa.MoviesTest, container=Default Managed Container)
-INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Started Ejb(deployment-id=org.superbiz.injection.h3jpa.MoviesTest, ejb-name=org.superbiz.injection.h3jpa.MoviesTest, container=Default Managed Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/jpa-hibernate)
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.251 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ jpa-hibernate ---
-[INFO] Building jar: /Users/dblevins/examples/jpa-hibernate/target/jpa-hibernate-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ jpa-hibernate ---
-[INFO] Installing /Users/dblevins/examples/jpa-hibernate/target/jpa-hibernate-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/jpa-hibernate/1.0/jpa-hibernate-1.0.jar
-[INFO] Installing /Users/dblevins/examples/jpa-hibernate/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/jpa-hibernate/1.0/jpa-hibernate-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 5.066s
-[INFO] Finished at: Fri Oct 28 17:11:31 PDT 2011
-[INFO] Final Memory: 14M/81M
-[INFO] ------------------------------------------------------------------------
- /**
- * 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.
- */
+Title: JPA Hibernate
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/jpa-hibernate) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/jpa-hibernate). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## Movie
+
package org.superbiz.injection.h3jpa;
import javax.persistence.Entity;
@@ -146,24 +55,10 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
this.year = year;
}
-
}
- /**
- * 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.
- */
+
+## Movies
+
package org.superbiz.injection.h3jpa;
import javax.ejb.Stateful;
@@ -191,24 +86,28 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
Query query = entityManager.createQuery("SELECT m from Movie as m");
return query.getResultList();
}
-
}
- /**
- * 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.
- */
+
+## persistence.xml
+
+ <persistence version="1.0"
+ xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
+ <persistence-unit name="movie-unit">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>movieDatabase</jta-data-source>
+ <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ </properties>
+ </persistence-unit>
+ </persistence>
+
+
+## MoviesTest
+
package org.superbiz.injection.h3jpa;
import junit.framework.TestCase;
@@ -246,3 +145,48 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
}
}
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.injection.h3jpa.MoviesTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/jpa-hibernate
+ INFO - openejb.base = /Users/dblevins/examples/jpa-hibernate
+ INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+ INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+ INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+ INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/jpa-hibernate/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/jpa-hibernate/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/jpa-hibernate
+ INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
+ INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
+ INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+ INFO - Auto-creating a container for bean org.superbiz.injection.h3jpa.MoviesTest: Container(type=MANAGED, id=Default Managed Container)
+ INFO - Configuring PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence)
+ INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.
+ INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)
+ INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+ INFO - Enterprise application "/Users/dblevins/examples/jpa-hibernate" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/jpa-hibernate
+ INFO - PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence) - provider time 631ms
+ INFO - Jndi(name="java:global/jpa-hibernate/Movies!org.superbiz.injection.h3jpa.Movies")
+ INFO - Jndi(name="java:global/jpa-hibernate/Movies")
+ INFO - Jndi(name="java:global/EjbModule1235930463/org.superbiz.injection.h3jpa.MoviesTest!org.superbiz.injection.h3jpa.MoviesTest")
+ INFO - Jndi(name="java:global/EjbModule1235930463/org.superbiz.injection.h3jpa.MoviesTest")
+ INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.injection.h3jpa.MoviesTest, ejb-name=org.superbiz.injection.h3jpa.MoviesTest, container=Default Managed Container)
+ INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Started Ejb(deployment-id=org.superbiz.injection.h3jpa.MoviesTest, ejb-name=org.superbiz.injection.h3jpa.MoviesTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/jpa-hibernate)
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.22 sec
+
+ Results :
+
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/lookup-of-ejbs-with-descriptor/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/lookup-of-ejbs-with-descriptor/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/lookup-of-ejbs-with-descriptor/README.md (original)
+++ openejb/trunk/openejb/examples/lookup-of-ejbs-with-descriptor/README.md Sun Oct 30 03:44:33 2011
@@ -1,104 +1,12 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: EJB Lookup with descriptor 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Deleting /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 1 resource
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Compiling 3 source files to /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Surefire report directory: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.ejblookup.EjbDependencyTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
-INFO - openejb.base = /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
-INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
-INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
-INFO - Found EjbModule in classpath: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
-INFO - Beginning load: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
-INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
-INFO - Auto-creating a container for bean BlueBean: Container(type=STATELESS, id=Default Stateless Container)
-INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
-INFO - Auto-creating a container for bean org.superbiz.ejblookup.EjbDependencyTest: Container(type=MANAGED, id=Default Managed Container)
-INFO - Enterprise application "/Users/dblevins/examples/lookup-of-ejbs-with-descriptor" loaded.
-INFO - Assembling app: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
-INFO - Jndi(name="java:global/wombat/BlueBean!org.superbiz.ejblookup.Friend")
-INFO - Jndi(name="java:global/wombat/BlueBean")
-INFO - Jndi(name="java:global/wombat/RedBean!org.superbiz.ejblookup.Friend")
-INFO - Jndi(name="java:global/wombat/RedBean")
-INFO - Jndi(name="java:global/EjbModule1069018579/org.superbiz.ejblookup.EjbDependencyTest!org.superbiz.ejblookup.EjbDependencyTest")
-INFO - Jndi(name="java:global/EjbModule1069018579/org.superbiz.ejblookup.EjbDependencyTest")
-INFO - Created Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
-INFO - Created Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
-INFO - Created Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
-INFO - Started Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/lookup-of-ejbs-with-descriptor)
-INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.455 sec
-
-Results :
-
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Building jar: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/lookup-of-ejbs-with-descriptor-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ lookup-of-ejbs-with-descriptor ---
-[INFO] Installing /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/lookup-of-ejbs-with-descriptor-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/lookup-of-ejbs-with-descriptor/1.0/lookup-of-ejbs-with-descriptor-1.0.jar
-[INFO] Installing /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/lookup-of-ejbs-with-descriptor/1.0/lookup-of-ejbs-with-descriptor-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 4.413s
-[INFO] Finished at: Fri Oct 28 17:06:33 PDT 2011
-[INFO] Final Memory: 14M/81M
-[INFO] ------------------------------------------------------------------------
- /**
- * 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.
- */
+Title: Lookup Of Ejbs with Descriptor
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/lookup-of-ejbs-with-descriptor) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/lookup-of-ejbs-with-descriptor). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## BlueBean
+
package org.superbiz.ejblookup;
- import javax.ejb.EJB;
import javax.ejb.EJBException;
- import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -118,27 +26,11 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
}
}
}
- //END SNIPPET: code
- /**
- * 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.
- */
+
+## Friend
+
package org.superbiz.ejblookup;
- import javax.ejb.Local;
-
/**
* This is an EJB 3 local business interface
* A local business interface may be annotated with the @Local
@@ -152,30 +44,13 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
public String sayHello();
public String helloFromFriend();
-
}
- //END SNIPPET: code
- /**
- * 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.
- */
+
+## RedBean
+
package org.superbiz.ejblookup;
- import javax.ejb.EJB;
import javax.ejb.EJBException;
- import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -195,30 +70,54 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
}
}
}
- //END SNIPPET: code/**
- * 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.
- */
+
+## ejb-jar.xml
+
+ <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee">
+
+ <!-- Notice this changes the global jndi name -->
+ <module-name>wombat</module-name>
+
+ <enterprise-beans>
+
+ <session>
+ <ejb-name>BlueBean</ejb-name>
+ <business-local>org.superbiz.ejblookup.Friend</business-local>
+ <ejb-class>org.superbiz.ejblookup.BlueBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ <ejb-local-ref>
+ <ejb-ref-name>myFriend</ejb-ref-name>
+ <local>org.superbiz.ejblookup.Friend</local>
+ <ejb-link>RedBean</ejb-link>
+ </ejb-local-ref>
+ </session>
+
+ <session>
+ <ejb-name>RedBean</ejb-name>
+ <business-local>org.superbiz.ejblookup.Friend</business-local>
+ <ejb-class>org.superbiz.ejblookup.RedBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ <ejb-local-ref>
+ <ejb-ref-name>myFriend</ejb-ref-name>
+ <local>org.superbiz.ejblookup.Friend</local>
+ <ejb-link>BlueBean</ejb-link>
+ </ejb-local-ref>
+ </session>
+
+ </enterprise-beans>
+ </ejb-jar>
+
+
+## EjbDependencyTest
+
package org.superbiz.ejblookup;
import junit.framework.TestCase;
import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;
- import javax.naming.InitialContext;
- import java.util.Properties;
//START SNIPPET: code
public class EjbDependencyTest extends TestCase {
@@ -236,7 +135,6 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
assertNotNull(red);
assertEquals("Red says, Hello!", red.sayHello());
assertEquals("My friend Blue says, Hello!", red.helloFromFriend());
-
}
public void testBlue() throws Exception {
@@ -246,8 +144,49 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
assertNotNull(blue);
assertEquals("Blue says, Hello!", blue.sayHello());
assertEquals("My friend Red says, Hello!", blue.helloFromFriend());
-
}
-
}
- //END SNIPPET: code
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.ejblookup.EjbDependencyTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+ INFO - openejb.base = /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+ INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+ INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+ INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+ INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+ INFO - Auto-creating a container for bean BlueBean: Container(type=STATELESS, id=Default Stateless Container)
+ INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+ INFO - Auto-creating a container for bean org.superbiz.ejblookup.EjbDependencyTest: Container(type=MANAGED, id=Default Managed Container)
+ INFO - Enterprise application "/Users/dblevins/examples/lookup-of-ejbs-with-descriptor" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/lookup-of-ejbs-with-descriptor
+ INFO - Jndi(name="java:global/wombat/BlueBean!org.superbiz.ejblookup.Friend")
+ INFO - Jndi(name="java:global/wombat/BlueBean")
+ INFO - Jndi(name="java:global/wombat/RedBean!org.superbiz.ejblookup.Friend")
+ INFO - Jndi(name="java:global/wombat/RedBean")
+ INFO - Jndi(name="java:global/EjbModule136565368/org.superbiz.ejblookup.EjbDependencyTest!org.superbiz.ejblookup.EjbDependencyTest")
+ INFO - Jndi(name="java:global/EjbModule136565368/org.superbiz.ejblookup.EjbDependencyTest")
+ INFO - Created Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
+ INFO - Created Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
+ INFO - Started Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/lookup-of-ejbs-with-descriptor)
+ INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.679 sec
+
+ Results :
+
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/lookup-of-ejbs/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/lookup-of-ejbs/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/lookup-of-ejbs/README.md (original)
+++ openejb/trunk/openejb/examples/lookup-of-ejbs/README.md Sun Oct 30 03:44:33 2011
@@ -1,99 +1,9 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: @EJB Lookup 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ lookup-of-ejbs ---
-[INFO] Deleting /Users/dblevins/examples/lookup-of-ejbs/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ lookup-of-ejbs ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/lookup-of-ejbs/src/main/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ lookup-of-ejbs ---
-[INFO] Compiling 3 source files to /Users/dblevins/examples/lookup-of-ejbs/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ lookup-of-ejbs ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/lookup-of-ejbs/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ lookup-of-ejbs ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/lookup-of-ejbs/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ lookup-of-ejbs ---
-[INFO] Surefire report directory: /Users/dblevins/examples/lookup-of-ejbs/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.ejblookup.EjbDependencyTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/lookup-of-ejbs
-INFO - openejb.base = /Users/dblevins/examples/lookup-of-ejbs
-INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
-INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
-INFO - Found EjbModule in classpath: /Users/dblevins/examples/lookup-of-ejbs/target/classes
-INFO - Beginning load: /Users/dblevins/examples/lookup-of-ejbs/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/lookup-of-ejbs
-INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
-INFO - Auto-creating a container for bean BlueBean: Container(type=STATELESS, id=Default Stateless Container)
-INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
-INFO - Auto-creating a container for bean org.superbiz.ejblookup.EjbDependencyTest: Container(type=MANAGED, id=Default Managed Container)
-INFO - Enterprise application "/Users/dblevins/examples/lookup-of-ejbs" loaded.
-INFO - Assembling app: /Users/dblevins/examples/lookup-of-ejbs
-INFO - Jndi(name="java:global/lookup-of-ejbs/BlueBean!org.superbiz.ejblookup.Friend")
-INFO - Jndi(name="java:global/lookup-of-ejbs/BlueBean")
-INFO - Jndi(name="java:global/lookup-of-ejbs/RedBean!org.superbiz.ejblookup.Friend")
-INFO - Jndi(name="java:global/lookup-of-ejbs/RedBean")
-INFO - Jndi(name="java:global/EjbModule236706648/org.superbiz.ejblookup.EjbDependencyTest!org.superbiz.ejblookup.EjbDependencyTest")
-INFO - Jndi(name="java:global/EjbModule236706648/org.superbiz.ejblookup.EjbDependencyTest")
-INFO - Created Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
-INFO - Created Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
-INFO - Created Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
-INFO - Started Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/lookup-of-ejbs)
-INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.192 sec
-
-Results :
-
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ lookup-of-ejbs ---
-[INFO] Building jar: /Users/dblevins/examples/lookup-of-ejbs/target/lookup-of-ejbs-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ lookup-of-ejbs ---
-[INFO] Installing /Users/dblevins/examples/lookup-of-ejbs/target/lookup-of-ejbs-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/lookup-of-ejbs/1.0/lookup-of-ejbs-1.0.jar
-[INFO] Installing /Users/dblevins/examples/lookup-of-ejbs/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/lookup-of-ejbs/1.0/lookup-of-ejbs-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 4.072s
-[INFO] Finished at: Fri Oct 28 17:10:45 PDT 2011
-[INFO] Final Memory: 14M/81M
-[INFO] ------------------------------------------------------------------------
- /**
- * 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.
- */
+Title: Lookup Of Ejbs
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/lookup-of-ejbs) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/lookup-of-ejbs). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## BlueBean
+
package org.superbiz.ejblookup;
import javax.ejb.EJB;
@@ -120,23 +30,9 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
}
}
}
- //END SNIPPET: code
- /**
- * 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.
- */
+
+## Friend
+
package org.superbiz.ejblookup;
import javax.ejb.Local;
@@ -155,25 +51,10 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
public String sayHello();
public String helloFromFriend();
-
}
- //END SNIPPET: code
- /**
- * 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.
- */
+
+## RedBean
+
package org.superbiz.ejblookup;
import javax.ejb.EJB;
@@ -200,30 +81,15 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
}
}
}
- //END SNIPPET: code/**
- * 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.
- */
+
+## EjbDependencyTest
+
package org.superbiz.ejblookup;
import junit.framework.TestCase;
import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;
- import javax.naming.InitialContext;
- import java.util.Properties;
//START SNIPPET: code
public class EjbDependencyTest extends TestCase {
@@ -241,7 +107,6 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
assertNotNull(red);
assertEquals("Red says, Hello!", red.sayHello());
assertEquals("My friend Blue says, Hello!", red.helloFromFriend());
-
}
public void testBlue() throws Exception {
@@ -251,8 +116,49 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
assertNotNull(blue);
assertEquals("Blue says, Hello!", blue.sayHello());
assertEquals("My friend Red says, Hello!", blue.helloFromFriend());
-
}
-
}
- //END SNIPPET: code
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.ejblookup.EjbDependencyTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/lookup-of-ejbs
+ INFO - openejb.base = /Users/dblevins/examples/lookup-of-ejbs
+ INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+ INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+ INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/lookup-of-ejbs/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/lookup-of-ejbs/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/lookup-of-ejbs
+ INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+ INFO - Auto-creating a container for bean RedBean: Container(type=STATELESS, id=Default Stateless Container)
+ INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+ INFO - Auto-creating a container for bean org.superbiz.ejblookup.EjbDependencyTest: Container(type=MANAGED, id=Default Managed Container)
+ INFO - Enterprise application "/Users/dblevins/examples/lookup-of-ejbs" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/lookup-of-ejbs
+ INFO - Jndi(name="java:global/lookup-of-ejbs/RedBean!org.superbiz.ejblookup.Friend")
+ INFO - Jndi(name="java:global/lookup-of-ejbs/RedBean")
+ INFO - Jndi(name="java:global/lookup-of-ejbs/BlueBean!org.superbiz.ejblookup.Friend")
+ INFO - Jndi(name="java:global/lookup-of-ejbs/BlueBean")
+ INFO - Jndi(name="java:global/EjbModule1374821456/org.superbiz.ejblookup.EjbDependencyTest!org.superbiz.ejblookup.EjbDependencyTest")
+ INFO - Jndi(name="java:global/EjbModule1374821456/org.superbiz.ejblookup.EjbDependencyTest")
+ INFO - Created Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
+ INFO - Created Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
+ INFO - Started Ejb(deployment-id=RedBean, ejb-name=RedBean, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=BlueBean, ejb-name=BlueBean, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=org.superbiz.ejblookup.EjbDependencyTest, ejb-name=org.superbiz.ejblookup.EjbDependencyTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/lookup-of-ejbs)
+ INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.267 sec
+
+ Results :
+
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/mbean-auto-registration/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/mbean-auto-registration/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/mbean-auto-registration/README.md (original)
+++ openejb/trunk/openejb/examples/mbean-auto-registration/README.md Sun Oct 30 03:44:33 2011
@@ -1,8 +1,6 @@
-# MBean auto registration
+Title: Mbean Auto Registration
-[Download as zip](mbean-auto-registration.zip)
-
-This example shows how to automatically create and register mbeans using OpenEJB features.
+This example shows how to automatically create and register mbeans using TomEE features.
# Dependencies
@@ -21,23 +19,16 @@ The mbean implements a simple game where
It allows the user to change the value too.
-# The registering
-
-To register a MBean using OpenEJB you simply have to specify a property eaiher in system.properties,
-or in intial context properties.
-
-The example MBean is called org.superbiz.mbean.GuessHowManyMBean so we simply add it to the properties
-given to the initial context:
-
- Properties properties = new Properties();
- properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
- EJBContainer.createEJBContainer(properties);
-
-# The implementation
-
-To implement the [org.superbiz.mbean.GuessHowManyMBean](src/main/java/org/superbiz/mbean/GuessHowManyMBean.java.html)
-MBean you simply annotate the POJO with specific annotations:
+ package org.superbiz.mbean;
+ import javax.management.Description;
+ import javax.management.MBean;
+ import javax.management.ManagedAttribute;
+ import javax.management.ManagedOperation;
+
+ /**
+ * @author Romain Manni-Bucau
+ */
@MBean
@Description("play with me to guess a number")
public class GuessHowManyMBean {
@@ -63,20 +54,98 @@ MBean you simply annotate the POJO with
}
}
-# Tests
+To register a MBean you simply have to specify a property either in system.properties,
+or in intial context properties.
+
+ Properties properties = new Properties();
+ properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
+ EJBContainer.createEJBContainer(properties);
+
+# Accessing the MBean
Then simply get the platform server and you can play with parameters and operations:
- MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- ObjectName objectName = new ObjectName(OBJECT_NAME);
- MBeanInfo infos = server.getMBeanInfo(objectName);
- assertEquals(0, server.getAttribute(objectName, "value"));
- server.setAttribute(objectName, new Attribute("value", 3));
- assertEquals(3, server.getAttribute(objectName, "value"));
- assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
- assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));
+ package org.superbiz.mbean;
+
+ import org.junit.Test;
-# Note
+ import javax.ejb.embeddable.EJBContainer;
+ import javax.management.Attribute;
+ import javax.management.MBeanInfo;
+ import javax.management.MBeanServer;
+ import javax.management.ObjectName;
+ import java.lang.management.ManagementFactory;
+ import java.util.Properties;
+
+ import static junit.framework.Assert.assertEquals;
+
+ /**
+ * @author Romain Manni-Bucau
+ */
+ public class GuessHowManyMBeanTest {
+ private static final String OBJECT_NAME = "openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";
+
+ @Test
+ public void play() throws Exception {
+ Properties properties = new Properties();
+ properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
+ EJBContainer container = EJBContainer.createEJBContainer(properties);
+
+ MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ ObjectName objectName = new ObjectName(OBJECT_NAME);
+ MBeanInfo infos = server.getMBeanInfo(objectName);
+ assertEquals(0, server.getAttribute(objectName, "value"));
+ server.setAttribute(objectName, new Attribute("value", 3));
+ assertEquals(3, server.getAttribute(objectName, "value"));
+ assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
+ assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));
+
+ container.close();
+ }
+ }
+
+#### Note
If OpenEJB can't find any module it can't start. So to force him to start even if the example has only the mbean
-as java class, we added a beans.xml file to let OpenEJB find a module.
+as java class, we added a `beans.xml` file to turn our project into a Java EE module.
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.mbean.GuessHowManyMBeanTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/mbean-auto-registration
+ INFO - openejb.base = /Users/dblevins/examples/mbean-auto-registration
+ INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+ INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+ INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/mbean-auto-registration/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/mbean-auto-registration/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/mbean-auto-registration
+ INFO - MBean openejb.user.mbeans:application=,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
+ INFO - MBean openejb.user.mbeans:application=mbean-auto-registration,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
+ INFO - MBean openejb.user.mbeans:application=EjbModule1847652919,group=org.superbiz.mbean,name=GuessHowManyMBean registered.
+ INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+ INFO - Auto-creating a container for bean mbean-auto-registration.Comp: Container(type=MANAGED, id=Default Managed Container)
+ INFO - Enterprise application "/Users/dblevins/examples/mbean-auto-registration" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/mbean-auto-registration
+ INFO - Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp!org.apache.openejb.BeanContext$Comp")
+ INFO - Jndi(name="java:global/mbean-auto-registration/mbean-auto-registration.Comp")
+ INFO - Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest!org.superbiz.mbean.GuessHowManyMBeanTest")
+ INFO - Jndi(name="java:global/EjbModule1847652919/org.superbiz.mbean.GuessHowManyMBeanTest")
+ INFO - Created Ejb(deployment-id=mbean-auto-registration.Comp, ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed Container)
+ INFO - Started Ejb(deployment-id=mbean-auto-registration.Comp, ejb-name=mbean-auto-registration.Comp, container=Default Managed Container)
+ INFO - Started Ejb(deployment-id=org.superbiz.mbean.GuessHowManyMBeanTest, ejb-name=org.superbiz.mbean.GuessHowManyMBeanTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/mbean-auto-registration)
+ INFO - Undeploying app: /Users/dblevins/examples/mbean-auto-registration
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.063 sec
+
+ Results :
+
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/movies-complete-meta/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/movies-complete-meta/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/movies-complete-meta/README.md (original)
+++ openejb/trunk/openejb/examples/movies-complete-meta/README.md Sun Oct 30 03:44:33 2011
@@ -1,113 +1,9 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: Movies Complete (Meta) 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ movies-complete-meta ---
-[INFO] Deleting /Users/dblevins/examples/movies-complete-meta/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ movies-complete-meta ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 1 resource
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ movies-complete-meta ---
-[INFO] Compiling 9 source files to /Users/dblevins/examples/movies-complete-meta/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ movies-complete-meta ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/movies-complete-meta/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ movies-complete-meta ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/movies-complete-meta/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ movies-complete-meta ---
-[INFO] Surefire report directory: /Users/dblevins/examples/movies-complete-meta/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.injection.tx.MoviesTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/movies-complete-meta
-INFO - openejb.base = /Users/dblevins/examples/movies-complete-meta
-INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
-INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
-INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
-INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
-INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete-meta/target/test-classes
-INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete-meta/target/classes
-INFO - Beginning load: /Users/dblevins/examples/movies-complete-meta/target/test-classes
-INFO - Beginning load: /Users/dblevins/examples/movies-complete-meta/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/movies-complete-meta
-INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
-INFO - Auto-creating a container for bean NoTransactionBean: Container(type=STATELESS, id=Default Stateless Container)
-INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
-INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
-INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
-INFO - Auto-creating a container for bean org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default Managed Container)
-INFO - Configuring PersistenceUnit(name=movie-unit)
-INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.
-INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)
-INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
-INFO - Enterprise application "/Users/dblevins/examples/movies-complete-meta" loaded.
-INFO - Assembling app: /Users/dblevins/examples/movies-complete-meta
-INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 404ms
-INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
-INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean")
-INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
-INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean")
-INFO - Jndi(name="java:global/movies-complete-meta/Movies!org.superbiz.injection.tx.Movies")
-INFO - Jndi(name="java:global/movies-complete-meta/Movies")
-INFO - Jndi(name="java:global/EjbModule1989766346/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest")
-INFO - Jndi(name="java:global/EjbModule1989766346/org.superbiz.injection.tx.MoviesTest")
-INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container)
-INFO - Created Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container)
-INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container)
-INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete-meta)
-INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.389 sec
-
-Results :
-
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ movies-complete-meta ---
-[INFO] Building jar: /Users/dblevins/examples/movies-complete-meta/target/movies-complete-meta-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ movies-complete-meta ---
-[INFO] Installing /Users/dblevins/examples/movies-complete-meta/target/movies-complete-meta-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/movies-complete-meta/1.0/movies-complete-meta-1.0.jar
-[INFO] Installing /Users/dblevins/examples/movies-complete-meta/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/movies-complete-meta/1.0/movies-complete-meta-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 5.419s
-[INFO] Finished at: Fri Oct 28 17:01:10 PDT 2011
-[INFO] Final Memory: 14M/81M
-[INFO] ------------------------------------------------------------------------
- /**
- * 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.
- */
+Title: Movies Complete Meta
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/movies-complete-meta) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/movies-complete-meta). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## AddInterceptor
+
package org.superbiz.injection.tx;
import javax.interceptor.AroundInvoke;
@@ -123,22 +19,10 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
// Log Add
return context.proceed();
}
- }/*
- * 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.
- */
+ }
+
+## Add
+
package org.superbiz.injection.tx.api;
import org.superbiz.injection.tx.AddInterceptor;
@@ -165,27 +49,14 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
@Interceptors(AddInterceptor.class)
public void method();
}
- }/*
- * 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.
- */
+ }
+
+## Delete
+
package org.superbiz.injection.tx.api;
import org.superbiz.injection.tx.DeleteInterceptor;
- import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
@@ -208,47 +79,25 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
@Interceptors(DeleteInterceptor.class)
public void method();
}
- }/**
- * 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.
- */
+ }
+
+## Metatype
+
package org.superbiz.injection.tx.api;
- import java.lang.annotation.*;
+ import java.lang.annotation.ElementType;
+ import java.lang.annotation.Retention;
+ import java.lang.annotation.RetentionPolicy;
+ import java.lang.annotation.Target;
@Metatype
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Metatype {
}
- /**
- * 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.
- */
+
+## MovieUnit
+
package org.superbiz.injection.tx.api;
import javax.persistence.PersistenceContext;
@@ -266,22 +115,9 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
@PersistenceContext(name = "movie-unit", unitName = "movie-unit", type = PersistenceContextType.EXTENDED)
public @interface MovieUnit {
}
- /*
- * 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.
- */
+
+## Read
+
package org.superbiz.injection.tx.api;
import javax.annotation.security.PermitAll;
@@ -305,22 +141,9 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
public void method();
}
}
- /**
- * 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.
- */
+
+## DeleteInterceptor
+
package org.superbiz.injection.tx;
import javax.interceptor.AroundInvoke;
@@ -337,22 +160,9 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
return context.proceed();
}
}
- /**
- * 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.
- */
+
+## Movie
+
package org.superbiz.injection.tx;
import javax.persistence.Entity;
@@ -397,24 +207,10 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
this.year = year;
}
-
}
- /**
- * 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.
- */
+
+## Movies
+
package org.superbiz.injection.tx;
import org.superbiz.injection.tx.api.Add;
@@ -422,15 +218,8 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
import org.superbiz.injection.tx.api.MovieUnit;
import org.superbiz.injection.tx.api.Read;
- import javax.annotation.security.PermitAll;
- import javax.annotation.security.RolesAllowed;
import javax.ejb.Stateful;
- import javax.ejb.TransactionAttribute;
- import javax.ejb.TransactionAttributeType;
- import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
- import javax.persistence.PersistenceContext;
- import javax.persistence.PersistenceContextType;
import javax.persistence.Query;
import java.util.List;
@@ -458,22 +247,25 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
Query query = entityManager.createQuery("SELECT m from Movie as m");
return query.getResultList();
}
- }/**
- * 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.
- */
+ }
+
+## persistence.xml
+
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+ <persistence-unit name="movie-unit">
+ <jta-data-source>movieDatabase</jta-data-source>
+ <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+ <class>org.superbiz.injection.tx.Movie</class>
+
+ <properties>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+ </persistence-unit>
+ </persistence>
+
+## MoviesTest
+
package org.superbiz.injection.tx;
import junit.framework.TestCase;
@@ -571,7 +363,6 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
public <V> V call(Callable<V> callable) throws Exception {
return callable.call();
}
-
}
@Stateless
@@ -582,8 +373,63 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
public <V> V call(Callable<V> callable) throws Exception {
return callable.call();
}
-
}
-
}
- //END SNIPPET: code
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.injection.tx.MoviesTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/movies-complete-meta
+ INFO - openejb.base = /Users/dblevins/examples/movies-complete-meta
+ INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+ INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+ INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+ INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete-meta/target/test-classes
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/movies-complete-meta/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/movies-complete-meta/target/test-classes
+ INFO - Beginning load: /Users/dblevins/examples/movies-complete-meta/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/movies-complete-meta
+ INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+ INFO - Auto-creating a container for bean TransactionBean: Container(type=STATELESS, id=Default Stateless Container)
+ INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
+ INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
+ INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+ INFO - Auto-creating a container for bean org.superbiz.injection.tx.MoviesTest: Container(type=MANAGED, id=Default Managed Container)
+ INFO - Configuring PersistenceUnit(name=movie-unit)
+ INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.
+ INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)
+ INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+ INFO - Enterprise application "/Users/dblevins/examples/movies-complete-meta" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/movies-complete-meta
+ INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 408ms
+ INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+ INFO - Jndi(name="java:global/movies-complete-meta/TransactionBean")
+ INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean!org.superbiz.injection.tx.MoviesTest$Caller")
+ INFO - Jndi(name="java:global/movies-complete-meta/NoTransactionBean")
+ INFO - Jndi(name="java:global/movies-complete-meta/Movies!org.superbiz.injection.tx.Movies")
+ INFO - Jndi(name="java:global/movies-complete-meta/Movies")
+ INFO - Jndi(name="java:global/EjbModule1861413442/org.superbiz.injection.tx.MoviesTest!org.superbiz.injection.tx.MoviesTest")
+ INFO - Jndi(name="java:global/EjbModule1861413442/org.superbiz.injection.tx.MoviesTest")
+ INFO - Created Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container)
+ INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container)
+ INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container)
+ INFO - Started Ejb(deployment-id=NoTransactionBean, ejb-name=NoTransactionBean, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Started Ejb(deployment-id=org.superbiz.injection.tx.MoviesTest, ejb-name=org.superbiz.injection.tx.MoviesTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/movies-complete-meta)
+ INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.869 sec
+
+ Results :
+
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+