You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by km...@apache.org on 2011/07/09 05:20:52 UTC
svn commit: r1144583 - in /openejb/trunk/openejb3/examples: ./ cdi-example/
cdi-example/src/main/java/org/superbiz/cdi/example/
cdi-example/src/main/resources/META-INF/
cdi-example/src/test/java/org/superbiz/cdi/example/
Author: kmalhi
Date: Sat Jul 9 03:20:52 2011
New Revision: 1144583
URL: http://svn.apache.org/viewvc?rev=1144583&view=rev
Log:
Reformatted, added headers, added cdi-example to examples pom.xml
Modified:
openejb/trunk/openejb3/examples/cdi-example/pom.xml
openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Course.java
openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/CsUndergradCourse.java
openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Faculty.java
openejb/trunk/openejb3/examples/cdi-example/src/main/resources/META-INF/beans.xml
openejb/trunk/openejb3/examples/cdi-example/src/test/java/org/superbiz/cdi/example/UndergradCourseTest.java
openejb/trunk/openejb3/examples/pom.xml
Modified: openejb/trunk/openejb3/examples/cdi-example/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/cdi-example/pom.xml?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/cdi-example/pom.xml (original)
+++ openejb/trunk/openejb3/examples/cdi-example/pom.xml Sat Jul 9 03:20:52 2011
@@ -17,11 +17,8 @@
limitations under the License.
-->
-<!-- $Rev: 1086252 $ $Date: 2011-03-28 07:26:42 -0700 (Mon, 28 Mar 2011) $ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.superbiz</groupId>
<artifactId>cdi-example</artifactId>
@@ -65,10 +62,8 @@
<version>4.8.1</version>
<scope>test</scope>
</dependency>
- <!--
- The <scope>test</scope> guarantees that none of your runtime
- code is dependent on any OpenEJB classes.
- -->
+ <!-- The <scope>test</scope> guarantees that none of your runtime code
+ is dependent on any OpenEJB classes. -->
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
Modified: openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Course.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Course.java?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Course.java (original)
+++ openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Course.java Sat Jul 9 03:20:52 2011
@@ -1,5 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.superbiz.cdi.example;
public interface Course {
- public Faculty getFaculty();
+ public Faculty getFaculty();
}
Modified: openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/CsUndergradCourse.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/CsUndergradCourse.java?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/CsUndergradCourse.java (original)
+++ openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/CsUndergradCourse.java Sat Jul 9 03:20:52 2011
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.superbiz.cdi.example;
import javax.ejb.Stateless;
@@ -5,40 +21,30 @@ import javax.inject.Inject;
@Stateless
public class CsUndergradCourse implements Course {
- private String courseName;
- private int capacity;
-
- @Inject
- private Faculty faculty;
-
- public CsUndergradCourse() {
- this.courseName = "CDI 101 - Introduction to CDI";
- this.capacity = 100;
- }
-
- public String getCourseName() {
- return courseName;
- }
-
- public void setCourseName(String courseName) {
- this.courseName = courseName;
- }
-
- public int getCapacity() {
- return capacity;
- }
-
- public void setCapacity(int capacity) {
- this.capacity = capacity;
- }
-
- public Faculty getFaculty() {
- return faculty;
- }
-
- public void setFaculty(Faculty faculty) {
- this.faculty = faculty;
- }
-
-
+ private String courseName;
+ private int capacity;
+ @Inject
+ private Faculty faculty;
+ public CsUndergradCourse() {
+ this.courseName = "CDI 101 - Introduction to CDI";
+ this.capacity = 100;
+ }
+ public String getCourseName() {
+ return courseName;
+ }
+ public void setCourseName(String courseName) {
+ this.courseName = courseName;
+ }
+ public int getCapacity() {
+ return capacity;
+ }
+ public void setCapacity(int capacity) {
+ this.capacity = capacity;
+ }
+ public Faculty getFaculty() {
+ return faculty;
+ }
+ public void setFaculty(Faculty faculty) {
+ this.faculty = faculty;
+ }
}
Modified: openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Faculty.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Faculty.java?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Faculty.java (original)
+++ openejb/trunk/openejb3/examples/cdi-example/src/main/java/org/superbiz/cdi/example/Faculty.java Sat Jul 9 03:20:52 2011
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.superbiz.cdi.example;
import java.util.ArrayList;
@@ -6,32 +22,25 @@ import java.util.List;
import javax.annotation.PostConstruct;
public class Faculty {
- private List<String> facultyMembers;
- private String facultyName;
-
- @PostConstruct
- public void initialize() {
- setFacultyMembers(new ArrayList<String> ());
- getFacultyMembers().add("Ian Schultz");
- getFacultyMembers().add("Diane Reyes");
- facultyName = "Computer Science";
- }
-
- public List<String> getFacultyMembers() {
- return facultyMembers;
- }
-
- public void setFacultyMembers(List<String> facultyMembers) {
- this.facultyMembers = facultyMembers;
- }
-
- public String getFacultyName() {
- return facultyName;
- }
-
- public void setFacultyName(String facultyName) {
- this.facultyName = facultyName;
- }
-
-
-}
+ private List<String> facultyMembers;
+ private String facultyName;
+ @PostConstruct
+ public void initialize() {
+ setFacultyMembers(new ArrayList<String>());
+ getFacultyMembers().add("Ian Schultz");
+ getFacultyMembers().add("Diane Reyes");
+ facultyName = "Computer Science";
+ }
+ public List<String> getFacultyMembers() {
+ return facultyMembers;
+ }
+ public void setFacultyMembers(List<String> facultyMembers) {
+ this.facultyMembers = facultyMembers;
+ }
+ public String getFacultyName() {
+ return facultyName;
+ }
+ public void setFacultyName(String facultyName) {
+ this.facultyName = facultyName;
+ }
+}
Modified: openejb/trunk/openejb3/examples/cdi-example/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/cdi-example/src/main/resources/META-INF/beans.xml?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/cdi-example/src/main/resources/META-INF/beans.xml (original)
+++ openejb/trunk/openejb3/examples/cdi-example/src/main/resources/META-INF/beans.xml Sat Jul 9 03:20:52 2011
@@ -1,2 +1,19 @@
+<!--
+
+ 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.
+-->
<beans>
</beans>
\ No newline at end of file
Modified: openejb/trunk/openejb3/examples/cdi-example/src/test/java/org/superbiz/cdi/example/UndergradCourseTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/cdi-example/src/test/java/org/superbiz/cdi/example/UndergradCourseTest.java?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/cdi-example/src/test/java/org/superbiz/cdi/example/UndergradCourseTest.java (original)
+++ openejb/trunk/openejb3/examples/cdi-example/src/test/java/org/superbiz/cdi/example/UndergradCourseTest.java Sat Jul 9 03:20:52 2011
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.superbiz.cdi.example;
import javax.ejb.EJB;
@@ -8,22 +24,18 @@ import org.junit.Test;
import junit.framework.TestCase;
-public class UndergradCourseTest extends TestCase{
- @EJB
- Course csCourse;
-
- @Before
- public void setUp() throws Exception {
- Object object = EJBContainer.createEJBContainer().getContext().lookup("java:global/cdi-example/CsUndergradCourse!org.superbiz.cdi.example.Course");
- assertTrue(object instanceof Course);
- csCourse = (Course) object;
- }
-
- @Test
- public void testPostConstruct() {
- assertTrue(csCourse != null);
-
-
- assertEquals(csCourse.getFaculty().getFacultyName(), "Computer Science");
- }
+public class UndergradCourseTest extends TestCase {
+ @EJB
+ Course csCourse;
+ @Before
+ public void setUp() throws Exception {
+ Object object = EJBContainer.createEJBContainer().getContext().lookup("java:global/cdi-example/CsUndergradCourse!org.superbiz.cdi.example.Course");
+ assertTrue(object instanceof Course);
+ csCourse = (Course) object;
+ }
+ @Test
+ public void testPostConstruct() {
+ assertTrue(csCourse != null);
+ assertEquals(csCourse.getFaculty().getFacultyName(), "Computer Science");
+ }
}
Modified: openejb/trunk/openejb3/examples/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/pom.xml?rev=1144583&r1=1144582&r2=1144583&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/pom.xml (original)
+++ openejb/trunk/openejb3/examples/pom.xml Sat Jul 9 03:20:52 2011
@@ -82,6 +82,7 @@
<module>mbean-auto-registration</module>
<module>datasource-ciphered-password</module>
<module>bean-validation-design-by-contract</module>
+ <module>cdi-example</module>
</modules>
<profiles>
<profile>