|
From: <id...@us...> - 2009-04-22 17:56:22
|
Revision: 160
http://cse-ip.svn.sourceforge.net/cse-ip/?rev=160&view=rev
Author: idueppe
Date: 2009-04-22 17:56:12 +0000 (Wed, 22 Apr 2009)
Log Message:
-----------
some test enhancements and add a dummy server for testing.
Modified Paths:
--------------
trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/LectureWebServiceTest.java
trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSS.java
Added Paths:
-----------
trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSSDummyWebServiceServer.java
Modified: trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/LectureWebServiceTest.java
===================================================================
--- trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/LectureWebServiceTest.java 2009-04-22 17:14:56 UTC (rev 159)
+++ trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/LectureWebServiceTest.java 2009-04-22 17:56:12 UTC (rev 160)
@@ -1,61 +1,49 @@
package de.campussource.cse.oca.openuss;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import javax.xml.ws.Endpoint;
-import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
-import de.campussource.cse.common.test.AnnotationInjector;
+public class LectureWebServiceTest {
+ private static Endpoint endpoint;
+ private LectureWebService service;
+ @BeforeClass
+ public static void setupClass() {
+ OpenUSS eis = new OpenUSS();
+ endpoint = Endpoint.publish("http://localhost:12345/openuss", eis);
+ }
-public class LectureWebServiceTest {
-
- private AnnotationInjector injector;
- private Endpoint endpoint;
+ @AfterClass
+ public static void tearDownClass() {
+ if (endpoint != null) {
+ endpoint.stop();
+ }
+ }
@Before
- public void setup() {
- OpenUSS ejb = new OpenUSS();
-// autowireByType(ejb);
- endpoint = Endpoint.publish("http://localhost:12345/openuss", ejb);
+ public void setUp() {
+ service = new OpenUSSService().getLectureWebServicePort();
}
-
- @After
- public void stop() {
- if (endpoint!=null){
- endpoint.stop();
- }
+
+ @Test
+ public void testFindUser() throws LectureLogicException_Exception {
+ // FIXME Test logic is not correct. User that doesn't exist should return null.
+ assertNotNull(service.findUser("test"));
}
-
+
@Test
- public void testWebService() {
- LectureWebService openussService = new OpenUSSService().getLectureWebServicePort();
-
- try {
- assertNull(openussService.findUser("test"));
- } catch (LectureLogicException_Exception e) {
- e.printStackTrace();
- }
+ public void testGetInstitute() throws LectureLogicException_Exception {
+ Institute institute = service.getInstitute(12345L);
+ assertNotNull(institute);
+ assertEquals(Long.valueOf(12345L), institute.getId());
}
-
-// protected void autowireByType(Object object) {
-// //lazyInjectorInitialization();
-// injector = new AnnotationInjector().autowire(object);
-// //injector.autowire(object);
-// }
-
-// /**
-// * Checks whether or not the Injector is already initialized or not.
-// */
-// private void lazyInjectorInitialization() {
-// if (injector == null) {
-// injector = new AnnotationInjector().defaultPersistentUnit(entityManager);
-// }
-// }
-
}
Modified: trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSS.java
===================================================================
--- trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSS.java 2009-04-22 17:14:56 UTC (rev 159)
+++ trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSS.java 2009-04-22 17:56:12 UTC (rev 160)
@@ -2,32 +2,25 @@
import java.util.List;
-import javax.ejb.Stateless;
import javax.jws.WebService;
-@Stateless
-@WebService(
- name="LectureWebService",
- targetNamespace="http://www.openuss.org/services",
- endpointInterface="")
-public class OpenUSS implements LectureWebService{
+@WebService(name = "LectureWebService", targetNamespace = "http://www.openuss.org/services", endpointInterface = "de.campussource.cse.oca.openuss.LectureWebService")
+public class OpenUSS implements LectureWebService {
+
@Override
- public boolean assignCourseMember(long courseId, long userId, Role role)
- throws LectureLogicException_Exception {
+ public boolean assignCourseMember(long courseId, long userId, Role role) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return false;
}
@Override
- public Long createCourse(Course course)
- throws LectureLogicException_Exception {
+ public Long createCourse(Course course) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return null;
}
@Override
- public Long createInstitute(Institute institute)
- throws LectureLogicException_Exception {
+ public Long createInstitute(Institute institute) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return null;
}
@@ -39,71 +32,63 @@
}
@Override
- public boolean deleteCourse(long courseId)
- throws LectureLogicException_Exception {
+ public boolean deleteCourse(long courseId) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return false;
}
@Override
- public boolean deleteUser(long userId)
- throws LectureLogicException_Exception {
+ public boolean deleteUser(long userId) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return false;
}
@Override
- public Long findUser(String username)
- throws LectureLogicException_Exception {
- System.out.println("Username: "+username);
+ public Long findUser(String username) throws LectureLogicException_Exception {
+ System.out.println("Username: " + username);
return 1L;
}
@Override
- public Course getCourse(long courseId)
- throws LectureLogicException_Exception {
- // TODO Auto-generated method stub
- return null;
+ public Course getCourse(long courseId) throws LectureLogicException_Exception {
+ Course course = new Course();
+ course.setId(courseId);
+ return course;
}
@Override
- public Institute getInstitute(long instituteId)
- throws LectureLogicException_Exception {
- // TODO Auto-generated method stub
- return null;
+ public Institute getInstitute(long instituteId) throws LectureLogicException_Exception {
+ Institute institute = new Institute();
+ institute.setId(instituteId);
+ return institute;
}
@Override
- public Role isCourseMember(long courseId, long userId)
- throws LectureLogicException_Exception {
+ public Role isCourseMember(long courseId, long userId) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return null;
}
@Override
- public List<Institute> listInstitute(long departmentId)
- throws LectureLogicException_Exception {
+ public List<Institute> listInstitute(long departmentId) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return null;
}
@Override
- public boolean removeCourseMember(long courseId, long userId)
- throws LectureLogicException_Exception {
+ public boolean removeCourseMember(long courseId, long userId) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return false;
}
@Override
- public boolean updateCourse(Course course)
- throws LectureLogicException_Exception {
+ public boolean updateCourse(Course course) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return false;
}
@Override
- public boolean updateInstitute(Institute insitute)
- throws LectureLogicException_Exception {
+ public boolean updateInstitute(Institute insitute) throws LectureLogicException_Exception {
// TODO Auto-generated method stub
return false;
}
Added: trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSSDummyWebServiceServer.java
===================================================================
--- trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSSDummyWebServiceServer.java (rev 0)
+++ trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSSDummyWebServiceServer.java 2009-04-22 17:56:12 UTC (rev 160)
@@ -0,0 +1,14 @@
+package de.campussource.cse.oca.openuss;
+
+import javax.swing.JOptionPane;
+import javax.xml.ws.Endpoint;
+
+public class OpenUSSDummyWebServiceServer {
+
+ public static void main(String[] args) {
+ Endpoint endpoint = Endpoint.publish("http://localhost:8080/openuss", new OpenUSS());
+ JOptionPane.showMessageDialog(null,"OpenUSS Dumy Server running.");
+ endpoint.stop();
+ }
+
+}
Property changes on: trunk/cse-ip/oca-openuss/src/test/java/de/campussource/cse/oca/openuss/OpenUSSDummyWebServiceServer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|