import org.apache.log4j.Logger;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.remoting.RemoteAccessException;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.ITestService;
import eu.etaxonomy.cdm.config.CdmSourceException;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
/**
* Class to test the HttpInvoker services exposed by the CDM Sever
- *
*/
public class HttpInvokerServicesTest extends BaseRemotingTest {
private static final Logger logger = Logger.getLogger(HttpInvokerServicesTest.class);
+ ITestService testService = getRemoteApplicationController().getTestService();
@Test
public void whenCallingMethodsOnRemoteServicesThenSucceed() {
//getRemoteApplicationController().getDatabaseService();
String dbSchemaVersion = getRemoteApplicationController().getDatabaseService().getDbSchemaVersion();
logger.info("dbSchemaVersion is " + dbSchemaVersion);
-
-
} catch (CdmSourceException e) {
Assert.fail("pinging database service on active cdm server should not have thrown CdmSourceException");
}
getRemoteApplicationController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null);
}
+ @Ignore
+ @Test
+ public void whenCallingMethodsOnRemoteServicesThenFailIfNotAuthenticated() {
+
+ SecurityContext context = SecurityContextHolder.getContext();
+
+ CdmApplicationState.setCurrentSecurityContext(null);
+ try {
+ getRemoteApplicationController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null);
+ Assert.fail("service call should fail as it is not authenticated");
+ }catch (RemoteAccessException rae) {
+
+ }
+
+ CdmApplicationState.setCurrentSecurityContext(context);
+ }
+
+ // should be kept at ignore and only used for manual testing
+ // otherwise tests will take too much time
+ @Ignore
+ @Test
+ public void testDisableReadTimeout() throws InterruptedException {
+ testService.waitFor((long) 120000.0);
+ }
}