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 [11/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/ ...
Modified: openejb/trunk/openejb/examples/spring-integration/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/spring-integration/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/spring-integration/README.md (original)
+++ openejb/trunk/openejb/examples/spring-integration/README.md Sun Oct 30 03:44:33 2011
@@ -1,115 +1,15 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: Spring Integration 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ spring-integration ---
-[INFO] Deleting /Users/dblevins/examples/spring-integration/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ spring-integration ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 3 resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ spring-integration ---
-[INFO] Compiling 8 source files to /Users/dblevins/examples/spring-integration/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ spring-integration ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/spring-integration/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ spring-integration ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/spring-integration/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ spring-integration ---
-[INFO] Surefire report directory: /Users/dblevins/examples/spring-integration/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.spring.MoviesTest
-log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
-log4j:WARN Please initialize the log4j system properly.
-log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/spring-integration
-INFO - openejb.base = /Users/dblevins/examples/spring-integration
-INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
-INFO - Configuring Service(id=MovieDatabase, type=Resource, provider-id=Default JDBC Database)
-INFO - Configuring Service(id=MovieDatabaseUnmanaged, type=Resource, provider-id=Default JDBC Database)
-INFO - Found EjbModule in classpath: /Users/dblevins/examples/spring-integration/target/classes
-INFO - Beginning load: /Users/dblevins/examples/spring-integration/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/spring-integration/classpath.ear
-WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime.
-INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
-INFO - Auto-creating a container for bean CineplexImpl: Container(type=STATELESS, id=Default Stateless Container)
-INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.spring.CineplexImpl/theaters' in bean CineplexImpl to Resource(id=theaters)
-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 PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence)
-INFO - Enterprise application "/Users/dblevins/examples/spring-integration/classpath.ear" loaded.
-INFO - Assembling app: /Users/dblevins/examples/spring-integration/classpath.ear
-INFO - PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence) - provider time 672ms
-INFO - Jndi(name=CineplexImplLocal) --> Ejb(deployment-id=CineplexImpl)
-INFO - Jndi(name=global/classpath.ear/spring-integration/CineplexImpl!org.superbiz.spring.Cineplex) --> Ejb(deployment-id=CineplexImpl)
-INFO - Jndi(name=global/classpath.ear/spring-integration/CineplexImpl) --> Ejb(deployment-id=CineplexImpl)
-INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies)
-INFO - Jndi(name=global/classpath.ear/spring-integration/Movies!org.superbiz.spring.Movies) --> Ejb(deployment-id=Movies)
-INFO - Jndi(name=global/classpath.ear/spring-integration/Movies) --> Ejb(deployment-id=Movies)
-INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Created Ejb(deployment-id=CineplexImpl, ejb-name=CineplexImpl, container=Default Stateless Container)
-INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Started Ejb(deployment-id=CineplexImpl, ejb-name=CineplexImpl, container=Default Stateless Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/spring-integration/classpath.ear)
-INFO - Exported EJB Movies with interface org.superbiz.spring.Movies to Spring bean MoviesLocal
-INFO - Exported EJB Movies with interface org.superbiz.spring.Movies to Spring bean global/classpath.ear/spring-integration/Movies!org.superbiz.spring.Movies
-INFO - Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to Spring bean CineplexImplLocal
-INFO - Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to Spring bean global/classpath.ear/spring-integration/CineplexImpl!org.superbiz.spring.Cineplex
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.429 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ spring-integration ---
-[INFO] Building jar: /Users/dblevins/examples/spring-integration/target/spring-integration-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ spring-integration ---
-[INFO] Installing /Users/dblevins/examples/spring-integration/target/spring-integration-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/spring-integration/1.0/spring-integration-1.0.jar
-[INFO] Installing /Users/dblevins/examples/spring-integration/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/spring-integration/1.0/spring-integration-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 5.577s
-[INFO] Finished at: Fri Oct 28 17:09:39 PDT 2011
-[INFO] Final Memory: 15M/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: Spring Integration
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/spring-integration) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/spring-integration). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## AvailableMovies
+
package org.superbiz.spring;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import java.util.List;
- //START SNIPPET: code
-
/**
* This is a simple Spring bean that we use as an easy way
* to seed the example with a list of persistent Movie objects
@@ -144,23 +44,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
this.moviesEjb = moviesEjb;
}
}
- //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.
- */
+
+## Cineplex
+
package org.superbiz.spring;
import java.util.List;
@@ -168,32 +54,16 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
public interface Cineplex {
public List<Theater> getTheaters();
-
}
- /**
- * 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.
- */
+
+## CineplexImpl
+
package org.superbiz.spring;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import java.util.List;
- //START SNIPPET: code
-
@Stateless
public class CineplexImpl implements Cineplex {
@@ -207,23 +77,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
return theaters.getTheaters();
}
}
- //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.
- */
+
+## Movie
+
package org.superbiz.spring;
import javax.persistence.Entity;
@@ -275,23 +131,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
this.year = year;
}
}
- //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.
- */
+
+## Movies
+
package org.superbiz.spring;
import java.util.List;
@@ -305,22 +147,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
Movie getMovieByTitle(String title) throws Exception;
}
- /**
- * 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.
- */
+
+## MoviesImpl
+
package org.superbiz.spring;
import javax.ejb.Stateful;
@@ -329,9 +158,7 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
import javax.persistence.PersistenceContextType;
import javax.persistence.Query;
import java.util.List;
-
- //START SNIPPET: code
-
+
/**
* A normal Stateful EJB that uses a JPA EntityManager.
* <p/>
@@ -362,36 +189,17 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
query.setParameter(1, title);
return (Movie) query.getSingleResult();
}
-
}
- //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.
- */
+
+## Theater
+
package org.superbiz.spring;
import javax.inject.Inject;
import javax.inject.Named;
- import org.springframework.beans.factory.annotation.Autowired;
-
import java.util.ArrayList;
import java.util.List;
-
- //START SNIPPET: code
-
+
/**
* Spring bean that references the Movies EJB and the Movie JPA bean.
* <p/>
@@ -412,7 +220,8 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
*
* @param movies
*/
- @Inject @Named(value = "MoviesLocal")
+ @Inject
+ @Named(value = "MoviesLocal")
public Theater(Movies movies) {
this.movies = movies;
}
@@ -434,24 +243,9 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
return nowPlaying;
}
}
- //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.
- */
+
+## Theaters
+
package org.superbiz.spring;
import java.util.List;
@@ -472,24 +266,165 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
public void setTheaters(List<Theater> theaters) {
this.theaters = theaters;
}
-
}
- /**
- * 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">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>MovieDatabase</jta-data-source>
+ <non-jta-data-source>MovieDatabaseUnmanaged</non-jta-data-source>
+ <class>org.superbiz.spring.Movie</class>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ </properties>
+ </persistence-unit>
+ </persistence>
+
+
+## movies.xml
+
+ <beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
+
+
+ <context:annotation-config/>
+
+
+ <!--
+ Required: Set up a TransactionManager for use by OpenEJB or Spring.
+ The Spring PlatformTransactionManager may be used instead.
+
+ In future versions this will not be a required step.
+ -->
+ <bean name="TransactionManager" class="org.apache.geronimo.transaction.manager.GeronimoTransactionManager"/>
+
+
+ <!--
+ Required: Set up a SecurityService for use by OpenEJB.
+ In future versions this will not be a required step.
+ -->
+ <bean name="SecurityService" class="org.apache.openejb.core.security.SecurityServiceImpl"/>
+
+
+ <!--
+ Loads the EJBs from the classpath just as when embedding OpenEJB via
+ the org.apache.openejb.client.LocalInitialContextFactory. All the discovered
+ EJBs are imported into this context and available for injection here.
+ -->
+ <bean name="classPathApplication" class="org.apache.openejb.spring.ClassPathApplication"/>
+
+ <bean name="MovieDatabase" class="org.apache.openejb.spring.Resource">
+ <property name="type" value="DataSource"/>
+ <property name="properties">
+ <props>
+ <prop key="JdbcDriver">org.hsqldb.jdbcDriver</prop>
+ <prop key="JdbcUrl">jdbc:hsqldb:mem:moviedb</prop>
+ </props>
+ </property>
+ </bean>
+
+ <bean name="MovieDatabaseUnmanaged" class="org.apache.openejb.spring.Resource">
+ <property name="type" value="DataSource"/>
+ <property name="properties">
+ <props>
+ <prop key="JdbcDriver">org.hsqldb.jdbcDriver</prop>
+ <prop key="JdbcUrl">jdbc:hsqldb:mem:moviedb</prop>
+ <prop key="JtaManaged">false</prop>
+ </props>
+ </property>
+ </bean>
+
+ <bean name="AvailableMovies" class="org.superbiz.spring.AvailableMovies">
+ <property name="movies">
+ <list>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="Fargo"/>
+ <property name="director" value="Joel Coen"/>
+ <property name="year" value="1996"/>
+ </bean>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="Reservoir Dogs"/>
+ <property name="director" value="Quentin Tarantino"/>
+ <property name="year" value="1992"/>
+ </bean>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="The Big Lebowski"/>
+ <property name="director" value="Joel Coen"/>
+ <property name="year" value="1998"/>
+ </bean>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="You, Me and Dupree"/>
+ <property name="director" value="Anthony Russo"/>
+ <property name="year" value="2006"/>
+ </bean>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="Wedding Crashers"/>
+ <property name="director" value="David Dobkin"/>
+ <property name="year" value="2005"/>
+ </bean>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="Zoolander"/>
+ <property name="director" value="Ben Stiller"/>
+ <property name="year" value="2001"/>
+ </bean>
+ <bean class="org.superbiz.spring.Movie">
+ <property name="title" value="Shanghai Noon"/>
+ <property name="director" value="Tom Dey"/>
+ <property name="year" value="2000"/>
+ </bean>
+ </list>
+ </property>
+ <!--property name="moviesEjb">
+ <ref bean="MoviesLocal" />
+ </property-->
+ </bean>
+
+ <bean name="theater1" class="org.superbiz.spring.Theater">
+ <property name="nowPlaying">
+ <list>
+ <value>Fargo</value>
+ <value>Reservoir Dogs</value>
+ <value>The Big Lebowski</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="theater2" class="org.superbiz.spring.Theater">
+ <property name="nowPlaying">
+ <list>
+ <value>You, Me and Dupree</value>
+ <value>Wedding Crashers</value>
+ <value>Zoolander</value>
+ <value>Shanghai Noon</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="theaters" class="org.superbiz.spring.Theaters">
+ <property name="theaters">
+ <list>
+ <ref bean="theater1"/>
+ <ref bean="theater2"/>
+ </list>
+ </property>
+ </bean>
+
+ </beans>
+
+
+## MoviesTest
+
package org.superbiz.spring;
import junit.framework.TestCase;
@@ -497,7 +432,6 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
import java.util.List;
- //START SNIPPET: code
public class MoviesTest extends TestCase {
public void test() throws Exception {
@@ -550,4 +484,55 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
assertEquals("Shanghai Noon", theaterTwoMovies.get(3).getTitle());
}
}
- //END SNIPPET: code
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.spring.MoviesTest
+ log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
+ log4j:WARN Please initialize the log4j system properly.
+ log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/spring-integration
+ INFO - openejb.base = /Users/dblevins/examples/spring-integration
+ INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
+ INFO - Configuring Service(id=MovieDatabase, type=Resource, provider-id=Default JDBC Database)
+ INFO - Configuring Service(id=MovieDatabaseUnmanaged, type=Resource, provider-id=Default JDBC Database)
+ INFO - Found EjbModule in classpath: /Users/dblevins/examples/spring-integration/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/spring-integration/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/spring-integration/classpath.ear
+ WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime.
+ INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+ INFO - Auto-creating a container for bean CineplexImpl: Container(type=STATELESS, id=Default Stateless Container)
+ INFO - Auto-linking resource-ref 'java:comp/env/org.superbiz.spring.CineplexImpl/theaters' in bean CineplexImpl to Resource(id=theaters)
+ 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 PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence)
+ INFO - Enterprise application "/Users/dblevins/examples/spring-integration/classpath.ear" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/spring-integration/classpath.ear
+ INFO - PersistenceUnit(name=movie-unit, provider=org.hibernate.ejb.HibernatePersistence) - provider time 648ms
+ INFO - Jndi(name=CineplexImplLocal) --> Ejb(deployment-id=CineplexImpl)
+ INFO - Jndi(name=global/classpath.ear/spring-integration/CineplexImpl!org.superbiz.spring.Cineplex) --> Ejb(deployment-id=CineplexImpl)
+ INFO - Jndi(name=global/classpath.ear/spring-integration/CineplexImpl) --> Ejb(deployment-id=CineplexImpl)
+ INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies)
+ INFO - Jndi(name=global/classpath.ear/spring-integration/Movies!org.superbiz.spring.Movies) --> Ejb(deployment-id=Movies)
+ INFO - Jndi(name=global/classpath.ear/spring-integration/Movies) --> Ejb(deployment-id=Movies)
+ INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Created Ejb(deployment-id=CineplexImpl, ejb-name=CineplexImpl, container=Default Stateless Container)
+ INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Started Ejb(deployment-id=CineplexImpl, ejb-name=CineplexImpl, container=Default Stateless Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/spring-integration/classpath.ear)
+ INFO - Exported EJB Movies with interface org.superbiz.spring.Movies to Spring bean MoviesLocal
+ INFO - Exported EJB Movies with interface org.superbiz.spring.Movies to Spring bean global/classpath.ear/spring-integration/Movies!org.superbiz.spring.Movies
+ INFO - Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to Spring bean CineplexImplLocal
+ INFO - Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to Spring bean global/classpath.ear/spring-integration/CineplexImpl!org.superbiz.spring.Cineplex
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.407 sec
+
+ Results :
+
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/telephone-stateful/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/telephone-stateful/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/telephone-stateful/README.md (original)
+++ openejb/trunk/openejb/examples/telephone-stateful/README.md Sun Oct 30 03:44:33 2011
@@ -1,101 +1,38 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: Telephone Stateful Pojo 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ telephone-stateful ---
-[INFO] Deleting /Users/dblevins/examples/telephone-stateful/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ telephone-stateful ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 1 resource
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ telephone-stateful ---
-[INFO] Compiling 2 source files to /Users/dblevins/examples/telephone-stateful/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ telephone-stateful ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/telephone-stateful/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ telephone-stateful ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/telephone-stateful/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ telephone-stateful ---
-[INFO] Surefire report directory: /Users/dblevins/examples/telephone-stateful/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.telephone.TelephoneTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/telephone-stateful
-INFO - openejb.base = /Users/dblevins/examples/telephone-stateful
-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/telephone-stateful/target/classes
-INFO - Beginning load: /Users/dblevins/examples/telephone-stateful/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/telephone-stateful/classpath.ear
-INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
-INFO - Auto-creating a container for bean TelephoneBean: Container(type=STATEFUL, id=Default Stateful Container)
-INFO - Enterprise application "/Users/dblevins/examples/telephone-stateful/classpath.ear" loaded.
-INFO - Assembling app: /Users/dblevins/examples/telephone-stateful/classpath.ear
-INFO - Jndi(name=TelephoneBeanRemote) --> Ejb(deployment-id=TelephoneBean)
-INFO - Jndi(name=global/classpath.ear/telephone-stateful/TelephoneBean!org.superbiz.telephone.Telephone) --> Ejb(deployment-id=TelephoneBean)
-INFO - Jndi(name=global/classpath.ear/telephone-stateful/TelephoneBean) --> Ejb(deployment-id=TelephoneBean)
-INFO - Created Ejb(deployment-id=TelephoneBean, ejb-name=TelephoneBean, container=Default Stateful Container)
-INFO - Started Ejb(deployment-id=TelephoneBean, ejb-name=TelephoneBean, container=Default Stateful Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/telephone-stateful/classpath.ear)
-INFO - Initializing network services
-INFO - Creating ServerService(id=admin)
-INFO - Creating ServerService(id=ejbd)
-INFO - Creating ServerService(id=ejbds)
-INFO - Initializing network services
- ** Starting Services **
- NAME IP PORT
- admin thread 127.0.0.1 4200
- ejbd 127.0.0.1 4201
- ejbd 127.0.0.1 4203
--------
-Ready!
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.412 sec
-
-Results :
-
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ telephone-stateful ---
-[INFO] Building jar: /Users/dblevins/examples/telephone-stateful/target/telephone-stateful-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ telephone-stateful ---
-[INFO] Installing /Users/dblevins/examples/telephone-stateful/target/telephone-stateful-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/telephone-stateful/1.0/telephone-stateful-1.0.jar
-[INFO] Installing /Users/dblevins/examples/telephone-stateful/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/telephone-stateful/1.0/telephone-stateful-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 4.641s
-[INFO] Finished at: Fri Oct 28 17:02:08 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.
- */
- //START SNIPPET: code
+Title: Telephone Stateful
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/telephone-stateful) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/telephone-stateful). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+This example shows how to use OpenEJB's remoting capabilities in an embedded scenario.
+
+The basic recipe is the same for a standard embedded scenario but with these added
+ingreditents:
+
+ * `openejb.embedded.remotable` property
+ * `openejb-ejbd` jar
+
+While creating the InitialContext, pass in the openejb.embedded.remotable property with
+the value of "true". When this is seen by the LocalInitialContextFactory, it will boot up
+the Server ServiceManager in the VM which will in turn look for ServerServices in the
+classpath.
+
+Provided you have the openejb-ejbd jar in your classpath along with it's dependencies
+(openejb-server, openejb-client, openejb-core), then those services will be brought online
+and remote clients will be able to connect into your vm and invoke beans.
+
+If you want to add more ServerServices such as the http version of the ejbd protocol you'd
+simply add the openejb-httpejbd jar to your classpath. A number of ServerServices are
+available currently:
+
+ * openejb-ejbd
+ * openejb-http
+ * openejb-telnet
+ * openejb-derbynet
+ * openejb-hsql
+ * openejb-activemq
+
+
+## Telephone
+
package org.superbiz.telephone;
public interface Telephone {
@@ -104,24 +41,9 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
String listen();
}
- //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.
- */
- //START SNIPPET: code
+
+## TelephoneBean
+
package org.superbiz.telephone;
import javax.ejb.Remote;
@@ -160,22 +82,9 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
return answers[Math.abs(lastThingSaid.hashCode()) % answers.length];
}
}
- //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.
- */
+
+## TelephoneTest
+
package org.superbiz.telephone;
import junit.framework.TestCase;
@@ -189,8 +98,6 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
*/
public class TelephoneTest extends TestCase {
- //START SNIPPET: setup
-
protected void setUp() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
@@ -204,14 +111,12 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
new InitialContext(properties);
}
- //END SNIPPET: setup
-
+
/**
* Lookup the Telephone bean via its remote interface but using the LocalInitialContextFactory
*
* @throws Exception
*/
- //START SNIPPET: localcontext
public void testTalkOverLocalNetwork() throws Exception {
Properties properties = new Properties();
@@ -235,14 +140,12 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
assertEquals("Oh, of course.", telephone.listen());
}
- //END SNIPPET: localcontext
-
+
/**
* Lookup the Telephone bean via its remote interface using the RemoteInitialContextFactory
*
* @throws Exception
*/
- //START SNIPPET: remotecontext
public void testTalkOverRemoteNetwork() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
@@ -270,6 +173,49 @@ Tests run: 2, Failures: 0, Errors: 0, Sk
assertEquals("Definitely.", telephone.listen());
}
- //END SNIPPET: remotecontext
-
}
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.telephone.TelephoneTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/telephone-stateful
+ INFO - openejb.base = /Users/dblevins/examples/telephone-stateful
+ 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/telephone-stateful/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/telephone-stateful/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/telephone-stateful/classpath.ear
+ INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
+ INFO - Auto-creating a container for bean TelephoneBean: Container(type=STATEFUL, id=Default Stateful Container)
+ INFO - Enterprise application "/Users/dblevins/examples/telephone-stateful/classpath.ear" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/telephone-stateful/classpath.ear
+ INFO - Jndi(name=TelephoneBeanRemote) --> Ejb(deployment-id=TelephoneBean)
+ INFO - Jndi(name=global/classpath.ear/telephone-stateful/TelephoneBean!org.superbiz.telephone.Telephone) --> Ejb(deployment-id=TelephoneBean)
+ INFO - Jndi(name=global/classpath.ear/telephone-stateful/TelephoneBean) --> Ejb(deployment-id=TelephoneBean)
+ INFO - Created Ejb(deployment-id=TelephoneBean, ejb-name=TelephoneBean, container=Default Stateful Container)
+ INFO - Started Ejb(deployment-id=TelephoneBean, ejb-name=TelephoneBean, container=Default Stateful Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/telephone-stateful/classpath.ear)
+ INFO - Initializing network services
+ INFO - Creating ServerService(id=admin)
+ INFO - Creating ServerService(id=ejbd)
+ INFO - Creating ServerService(id=ejbds)
+ INFO - Initializing network services
+ ** Starting Services **
+ NAME IP PORT
+ admin thread 127.0.0.1 4200
+ ejbd 127.0.0.1 4201
+ ejbd 127.0.0.1 4203
+ -------
+ Ready!
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.448 sec
+
+ Results :
+
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/testcase-injection/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/testcase-injection/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/testcase-injection/README.md (original)
+++ openejb/trunk/openejb/examples/testcase-injection/README.md Sun Oct 30 03:44:33 2011
@@ -1,101 +1,9 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: TestCase Injection 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ testcase-injection ---
-[INFO] Deleting /Users/dblevins/examples/testcase-injection/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ testcase-injection ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 1 resource
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ testcase-injection ---
-[INFO] Compiling 2 source files to /Users/dblevins/examples/testcase-injection/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ testcase-injection ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] skip non existing resourceDirectory /Users/dblevins/examples/testcase-injection/src/test/resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ testcase-injection ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/testcase-injection/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ testcase-injection ---
-[INFO] Surefire report directory: /Users/dblevins/examples/testcase-injection/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.testinjection.MoviesTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/testcase-injection
-INFO - openejb.base = /Users/dblevins/examples/testcase-injection
-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/testcase-injection/target/classes
-INFO - Beginning load: /Users/dblevins/examples/testcase-injection/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/testcase-injection
-WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime.
-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.testinjection.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/testcase-injection" loaded.
-INFO - Assembling app: /Users/dblevins/examples/testcase-injection
-INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 405ms
-INFO - Jndi(name="java:global/testcase-injection/Movies!org.superbiz.testinjection.Movies")
-INFO - Jndi(name="java:global/testcase-injection/Movies")
-INFO - Jndi(name="java:global/EjbModule713732239/org.superbiz.testinjection.MoviesTest!org.superbiz.testinjection.MoviesTest")
-INFO - Jndi(name="java:global/EjbModule713732239/org.superbiz.testinjection.MoviesTest")
-INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Created Ejb(deployment-id=org.superbiz.testinjection.MoviesTest, ejb-name=org.superbiz.testinjection.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.testinjection.MoviesTest, ejb-name=org.superbiz.testinjection.MoviesTest, container=Default Managed Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/testcase-injection)
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.239 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ testcase-injection ---
-[INFO] Building jar: /Users/dblevins/examples/testcase-injection/target/testcase-injection-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ testcase-injection ---
-[INFO] Installing /Users/dblevins/examples/testcase-injection/target/testcase-injection-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/testcase-injection/1.0/testcase-injection-1.0.jar
-[INFO] Installing /Users/dblevins/examples/testcase-injection/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/testcase-injection/1.0/testcase-injection-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 5.326s
-[INFO] Finished at: Fri Oct 28 17:08:21 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: Testcase Injection
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/testcase-injection) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/testcase-injection). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## Movie
+
package org.superbiz.testinjection;
import javax.persistence.Entity;
@@ -140,24 +48,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.testinjection;
import javax.ejb.Stateful;
@@ -191,23 +85,24 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
return query.getResultList();
}
}
- //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.
- */
+
+## 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.testinjection.Movie</class>
+
+ <properties>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+ </persistence-unit>
+ </persistence>
+
+## MoviesTest
+
package org.superbiz.testinjection;
import junit.framework.TestCase;
@@ -259,12 +154,55 @@ Tests run: 1, Failures: 0, Errors: 0, Sk
}
assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
-
} finally {
userTransaction.commit();
}
-
}
}
- //END SNIPPET: code
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.testinjection.MoviesTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/testcase-injection
+ INFO - openejb.base = /Users/dblevins/examples/testcase-injection
+ 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/testcase-injection/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/testcase-injection/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/testcase-injection
+ WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime.
+ 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.testinjection.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/testcase-injection" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/testcase-injection
+ INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 408ms
+ INFO - Jndi(name="java:global/testcase-injection/Movies!org.superbiz.testinjection.Movies")
+ INFO - Jndi(name="java:global/testcase-injection/Movies")
+ INFO - Jndi(name="java:global/EjbModule1583515396/org.superbiz.testinjection.MoviesTest!org.superbiz.testinjection.MoviesTest")
+ INFO - Jndi(name="java:global/EjbModule1583515396/org.superbiz.testinjection.MoviesTest")
+ INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.testinjection.MoviesTest, ejb-name=org.superbiz.testinjection.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.testinjection.MoviesTest, ejb-name=org.superbiz.testinjection.MoviesTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/testcase-injection)
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.24 sec
+
+ Results :
+
+ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
Modified: openejb/trunk/openejb/examples/testing-security-2/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/testing-security-2/README.md?rev=1195109&r1=1195108&r2=1195109&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/testing-security-2/README.md (original)
+++ openejb/trunk/openejb/examples/testing-security-2/README.md Sun Oct 30 03:44:33 2011
@@ -1,106 +1,9 @@
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building OpenEJB :: Examples :: Testing Security 1.0
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ testing-security-2 ---
-[INFO] Deleting /Users/dblevins/examples/testing-security-2/target
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ testing-security-2 ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 1 resource
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ testing-security-2 ---
-[INFO] Compiling 2 source files to /Users/dblevins/examples/testing-security-2/target/classes
-[INFO]
-[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ testing-security-2 ---
-[INFO] Using 'UTF-8' encoding to copy filtered resources.
-[INFO] Copying 2 resources
-[INFO]
-[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ testing-security-2 ---
-[INFO] Compiling 1 source file to /Users/dblevins/examples/testing-security-2/target/test-classes
-[INFO]
-[INFO] --- maven-surefire-plugin:2.6:test (default-test) @ testing-security-2 ---
-[INFO] Surefire report directory: /Users/dblevins/examples/testing-security-2/target/surefire-reports
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running org.superbiz.injection.secure.MovieTest
-Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
-http://openejb.apache.org/
-INFO - openejb.home = /Users/dblevins/examples/testing-security-2
-INFO - openejb.base = /Users/dblevins/examples/testing-security-2
-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/testing-security-2/target/classes
-INFO - Beginning load: /Users/dblevins/examples/testing-security-2/target/classes
-INFO - Configuring enterprise application: /Users/dblevins/examples/testing-security-2
-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.secure.MovieTest: 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/testing-security-2" loaded.
-INFO - Assembling app: /Users/dblevins/examples/testing-security-2
-INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 411ms
-INFO - Jndi(name="java:global/testing-security-2/Movies!org.superbiz.injection.secure.Movies")
-INFO - Jndi(name="java:global/testing-security-2/Movies")
-INFO - Jndi(name="java:global/EjbModule236054577/org.superbiz.injection.secure.MovieTest!org.superbiz.injection.secure.MovieTest")
-INFO - Jndi(name="java:global/EjbModule236054577/org.superbiz.injection.secure.MovieTest")
-INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
-INFO - Created Ejb(deployment-id=org.superbiz.injection.secure.MovieTest, ejb-name=org.superbiz.injection.secure.MovieTest, 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.secure.MovieTest, ejb-name=org.superbiz.injection.secure.MovieTest, container=Default Managed Container)
-INFO - Deployed Application(path=/Users/dblevins/examples/testing-security-2)
-INFO - Logging in
-INFO - Logging out
-INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
-INFO - Logging in
-INFO - Logging out
-INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
-Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.39 sec
-
-Results :
-
-Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
-
-[INFO]
-[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ testing-security-2 ---
-[INFO] Building jar: /Users/dblevins/examples/testing-security-2/target/testing-security-2-1.0.jar
-[INFO]
-[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ testing-security-2 ---
-[INFO] Installing /Users/dblevins/examples/testing-security-2/target/testing-security-2-1.0.jar to /Users/dblevins/.m2/repository/org/superbiz/testing-security-2/1.0/testing-security-2-1.0.jar
-[INFO] Installing /Users/dblevins/examples/testing-security-2/pom.xml to /Users/dblevins/.m2/repository/org/superbiz/testing-security-2/1.0/testing-security-2-1.0.pom
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 5.300s
-[INFO] Finished at: Fri Oct 28 16:59:09 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: Testing Security 2
+
+*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/testing-security-2) or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/testing-security-2). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*
+
+## Movie
+
package org.superbiz.injection.secure;
import javax.persistence.Entity;
@@ -145,24 +48,10 @@ Tests run: 3, 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.secure;
//START SNIPPET: code
@@ -179,7 +68,7 @@ Tests run: 3, Failures: 0, Errors: 0, Sk
import java.util.List;
@Stateful
- public class Movies {
+ public class Movies {
@PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;
@@ -201,23 +90,24 @@ Tests run: 3, Failures: 0, Errors: 0, Sk
return query.getResultList();
}
}
- //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.
- */
+
+## 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.secure.Movie</class>
+
+ <properties>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ </properties>
+ </persistence-unit>
+ </persistence>
+
+## MovieTest
+
package org.superbiz.injection.secure;
import junit.framework.TestCase;
@@ -326,11 +216,59 @@ Tests run: 3, Failures: 0, Errors: 0, Sk
// Read access should be allowed
List<Movie> list = movies.getMovies();
-
} catch (EJBAccessException e) {
fail("Read access should be allowed");
}
-
}
}
- //END SNIPPET: code
+
+# Running
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.injection.secure.MovieTest
+ Apache OpenEJB 4.0.0-beta-1 build: 20111002-04:06
+ http://openejb.apache.org/
+ INFO - openejb.home = /Users/dblevins/examples/testing-security-2
+ INFO - openejb.base = /Users/dblevins/examples/testing-security-2
+ 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/testing-security-2/target/classes
+ INFO - Beginning load: /Users/dblevins/examples/testing-security-2/target/classes
+ INFO - Configuring enterprise application: /Users/dblevins/examples/testing-security-2
+ 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.secure.MovieTest: 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/testing-security-2" loaded.
+ INFO - Assembling app: /Users/dblevins/examples/testing-security-2
+ INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 413ms
+ INFO - Jndi(name="java:global/testing-security-2/Movies!org.superbiz.injection.secure.Movies")
+ INFO - Jndi(name="java:global/testing-security-2/Movies")
+ INFO - Jndi(name="java:global/EjbModule1634151355/org.superbiz.injection.secure.MovieTest!org.superbiz.injection.secure.MovieTest")
+ INFO - Jndi(name="java:global/EjbModule1634151355/org.superbiz.injection.secure.MovieTest")
+ INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+ INFO - Created Ejb(deployment-id=org.superbiz.injection.secure.MovieTest, ejb-name=org.superbiz.injection.secure.MovieTest, 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.secure.MovieTest, ejb-name=org.superbiz.injection.secure.MovieTest, container=Default Managed Container)
+ INFO - Deployed Application(path=/Users/dblevins/examples/testing-security-2)
+ INFO - Logging in
+ INFO - Logging out
+ INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
+ INFO - Logging in
+ INFO - Logging out
+ INFO - EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization
+ Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.546 sec
+
+ Results :
+
+ Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
+