- Timestamp:
- 10/24/14 18:33:24 (10 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/branches/Jersey-2.12-adaptation/annotator-backend
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/branches/Jersey-2.12-adaptation/annotator-backend/pom.xml
r5739 r5745 23 23 <groupId>javax.servlet</groupId> 24 24 <artifactId>javax.servlet-api</artifactId> 25 <version>3.0.1</version> 26 <scope>provided</scope> 25 <version>3.0.1</version> 27 26 </dependency> 28 <dependency> 29 <groupId>javax.servlet</groupId> 30 <artifactId>servlet-api</artifactId> 31 <version>2.5</version> 32 <scope>provided</scope> 33 </dependency> 27 34 28 <!-- <dependency> 35 29 <groupId>javax.ws.rs</groupId> … … 57 51 <version>${jersey.version}</version> 58 52 </dependency> 59 <dependency> 53 <dependency> 54 <groupId>org.glassfish.jersey.containers</groupId> 55 <artifactId>jersey-container-grizzly2-servlet</artifactId> 56 <version>${jersey.version}</version> 57 </dependency> 58 <!-- <dependency> 59 <groupId>org.glassfish.jersey.containers</groupId> 60 <artifactId>jersey-container-simple-http</artifactId> 61 <version>${jersey.version}</version> 62 </dependency>--> 63 <!-- <dependency> 60 64 <groupId>org.glassfish.jersey.test-framework.providers</groupId> 61 <artifactId>jersey-test-framework-provider- grizzly2</artifactId>62 <version>${jersey.version}</version> 63 </dependency> 65 <artifactId>jersey-test-framework-provider-jdk-http</artifactId> 66 <version>${jersey.version}</version> 67 </dependency>--> 64 68 <dependency> 65 69 <groupId>org.glassfish.jersey.core</groupId> … … 433 437 434 438 <properties> 435 <jersey.version>2.1 2</jersey.version>439 <jersey.version>2.13</jersey.version> 436 440 <spring.version>3.2.0.RELEASE</spring.version> 437 441 <slf4j.version>1.7.5</slf4j.version> -
DASISH/t5.6/backend/annotator-backend/branches/Jersey-2.12-adaptation/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceResource.java
r5739 r5745 41 41 @Autowired 42 42 protected DBDispatcher dbDispatcher; 43 43 44 @Context 44 45 protected HttpServletRequest httpServletRequest; … … 56 57 57 58 public Number getPrincipalID() throws IOException { 58 dbDispatcher.setResourcesPaths(this.getRelativeServiceURI()); 59 String relativeServiceURI = this.getRelativeServiceURI(); 60 dbDispatcher.setResourcesPaths(relativeServiceURI); 59 61 String remotePrincipal = httpServletRequest.getRemoteUser(); 60 62 if (remotePrincipal != null) { -
DASISH/t5.6/backend/annotator-backend/branches/Jersey-2.12-adaptation/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java
r5739 r5745 26 26 import java.io.IOException; 27 27 import java.net.URISyntaxException; 28 import java.util.Set; 29 import javax.ws.rs.client.Invocation; 28 30 import javax.ws.rs.core.Application; 29 31 import javax.ws.rs.core.HttpHeaders; … … 33 35 import org.glassfish.jersey.server.spring.SpringLifecycleListener; 34 36 import org.glassfish.jersey.server.spring.scope.RequestContextFilter; 35 import org.glassfish.jersey.test.TestProperties; 37 import org.glassfish.jersey.test.DeploymentContext; 38 import org.glassfish.jersey.test.ServletDeploymentContext; 36 39 import org.junit.Test; 37 40 import static org.junit.Assert.*; … … 45 48 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 46 49 import org.springframework.context.support.ClassPathXmlApplicationContext; 47 48 50 /** 49 51 * … … 57 59 private JdbcTemplate jdbcTemplate; 58 60 61 59 62 //String _relativePath = "/backend/api"; 60 63 61 64 public AnnotationsTest() { 65 super(new DasishTestContainerFactory()); 66 } 67 62 68 @Override 63 protected Application configure() { 64 65 enable(TestProperties.LOG_TRAFFIC); 66 enable(TestProperties.DUMP_ENTITY); 67 68 69 69 protected DeploymentContext configureDeployment() { 70 70 ApplicationContext ctx = new ClassPathXmlApplicationContext( 71 71 "/spring-test-config/dataSource.xml", 72 72 "/spring-config/componentscan.xml", 73 "/spring-config/dbDispatcher.xml", 73 "/spring-config/dbDispatcher.xml", // passed; commenting it out gives compilation error 74 74 "/spring-config/principalDao.xml", 75 75 "/spring-config/annotationDao.xml", … … 80 80 "/spring-config/jaxbUnmarshallerFactory.xml"); 81 81 82 return (new ResourceConfig()) 83 .register(AutheticationResource.class) 82 //HttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(); 83 84 85 ResourceConfig rc = (new ResourceConfig()) 86 .register(AutheticationResource.class) // passed non-null (otherwise calling test will fends with 404 84 87 .register(AnnotationResource.class) 85 88 .register(DummySecurityFilter.class) 86 89 .register(SpringLifecycleListener.class) 87 .register(RequestContextFilter.class) 90 .register(RequestContextFilter.class) 88 91 .property("contextConfig", ctx); 89 // .property("contextPath", "/backend") //??90 // .property("servletPath", "/api"); //91 92 92 93 //.servletClass(SpringServlet.class) … … 97 98 //.contextPath("/backend").servletPath("/api") 98 99 //.build(); 99 100 101 102 Application app = rc.getApplication(); 103 org.glassfish.jersey.test.ServletDeploymentContext.Builder deploymentContextBuilder = 104 ServletDeploymentContext.builder(app); 105 106 return deploymentContextBuilder.build(); 100 107 } 101 108 … … 128 135 public void testGetAnnotation() throws NotInDataBaseException, IOException { 129 136 130 //Response resTest = this.target("authentication/logintest").request().accept(MediaType.TEXT_HTML).get(); 131 //assertEquals(200, resTest.getStatus()); 137 138 // Authentication 139 // httpServletRequest == null!! 132 140 133 // Authentication134 Response response = getAuthenticatedResource().accept(MediaType.TEXT_HTML).get();141 Invocation request = this.target("authentication/login").request().accept(MediaType.TEXT_HTML).buildGet(); 142 Response response = request.invoke(); 135 143 assertEquals(200, response.getStatus()); 136 144 //
Note: See TracChangeset
for help on using the changeset viewer.