Added some tests

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@144205 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-02-23 15:28:57 +00:00
parent 2cec592c63
commit 7a77bc501e
3 changed files with 33 additions and 8 deletions

View File

@ -169,6 +169,13 @@
</dependency> </dependency>
--> -->
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-api</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>

View File

@ -58,7 +58,7 @@ public class ISSweeperPluginSmartExecutorSchedulerTest extends ScopedTest {
@Test @Test
public void cronExpPreviousMustBeTerminated() throws Exception { public void cronExpPreviousMustBeTerminated() throws Exception {
CronExpression cronExpression = new CronExpression("0 */10 * * * ?"); // every 10 minutes starting from now CronExpression cronExpression = new CronExpression("0 */10 * * * ?"); // every 10 minutes starting from now
Scheduling scheduling = new Scheduling(cronExpression, true); Scheduling scheduling = new Scheduling(cronExpression);
scheduling.setGlobal(true); scheduling.setGlobal(true);
UUID uuid = scheduleTest(scheduling); UUID uuid = scheduleTest(scheduling);

View File

@ -3,6 +3,7 @@
*/ */
package org.gcube.test; package org.gcube.test;
import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -15,6 +16,9 @@ import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.informationsystem.publisher.RegistryPublisherFactory; import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
import org.gcube.informationsystem.publisher.ScopedPublisher; import org.gcube.informationsystem.publisher.ScopedPublisher;
import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException; import org.gcube.informationsystem.publisher.exception.RegistryNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ExceptionMapper;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.EntityAlreadyPresentException;
import org.gcube.testutility.ScopedTest; import org.gcube.testutility.ScopedTest;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -80,19 +84,33 @@ public class TempTest extends ScopedTest {
} }
} }
@Test
public void exceptionSerilizationTest() throws IOException{
//ResourceRegistryException rre = new ResourceRegistryException("Test");
ResourceRegistryException rre = new EntityAlreadyPresentException("Aux");
String jsonString = ExceptionMapper.marshal(rre);
logger.debug(jsonString);
rre = ExceptionMapper.unmarshal(ResourceRegistryException.class, jsonString);
logger.debug("Unmarshalled exception is ", rre);
}
public static final String SERVICE_ENDPOINT_CATEGORY = "Database"; public static final String SERVICE_ENDPOINT_CATEGORY = "Database";
public static final String SERVICE_ENDPOINT_NAME = "TwitterMonitorDatabase"; public static final String SERVICE_ENDPOINT_NAME = "TwitterMonitorDatabase";
public static final String ENTRY_NAME = "postgress"; public static final String ENTRY_NAME = "postgress";
@Test @Test
public void testTWMonitorDiscovery() throws Exception { public void testTwitterMonitorDatabaseDiscovery() throws Exception{
ScopedTest.setContext(GCUBE_DEVSEC);
DatabaseDiscovery databaseDiscovery = new DatabaseDiscovery(SERVICE_ENDPOINT_CATEGORY, SERVICE_ENDPOINT_NAME, ENTRY_NAME); DatabaseDiscovery databaseDiscovery = new DatabaseDiscovery(SERVICE_ENDPOINT_CATEGORY, SERVICE_ENDPOINT_NAME, ENTRY_NAME);
logger.debug("Username : {}", databaseDiscovery.getUsername()); logger.info("{}", databaseDiscovery.getUsername());
logger.debug("Password : {}", databaseDiscovery.getPassword()); logger.info("{}", databaseDiscovery.getPassword());
logger.debug("URL : {}", databaseDiscovery.getURL()); logger.info("{}", databaseDiscovery.getURL());
} }
} }