|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
*/
|
|
|
|
|
package org.gcube.test;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.StringWriter;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
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.ScopedPublisher;
|
|
|
|
|
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.junit.Test;
|
|
|
|
|
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_NAME = "TwitterMonitorDatabase";
|
|
|
|
|
public static final String ENTRY_NAME = "postgress";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testTWMonitorDiscovery() throws Exception {
|
|
|
|
|
ScopedTest.setContext(GCUBE_DEVSEC);
|
|
|
|
|
|
|
|
|
|
public void testTwitterMonitorDatabaseDiscovery() throws Exception{
|
|
|
|
|
DatabaseDiscovery databaseDiscovery = new DatabaseDiscovery(SERVICE_ENDPOINT_CATEGORY, SERVICE_ENDPOINT_NAME, ENTRY_NAME);
|
|
|
|
|
logger.debug("Username : {}", databaseDiscovery.getUsername());
|
|
|
|
|
logger.debug("Password : {}", databaseDiscovery.getPassword());
|
|
|
|
|
logger.debug("URL : {}", databaseDiscovery.getURL());
|
|
|
|
|
|
|
|
|
|
logger.info("{}", databaseDiscovery.getUsername());
|
|
|
|
|
logger.info("{}", databaseDiscovery.getPassword());
|
|
|
|
|
logger.info("{}", databaseDiscovery.getURL());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|