Fixed test classes

This commit is contained in:
Luca Frosini 2022-07-25 11:24:11 +02:00
parent ea2156d0d5
commit acdd43f7ef
6 changed files with 40 additions and 19 deletions

View File

@ -37,7 +37,6 @@ public class ContextTest {
public static final String DEFAULT_TEST_SCOPE_ANOTHER_USER;
protected static final String REGISTRY_PROPERTIES_FILENAME = "registry.properties";
public static final String RESOURCE_REGISTRY_URL_PROPERTY = "RESOURCE_REGISTRY_URL";
public static final String RESOURCE_REGISTRY_URL;
@ -70,16 +69,7 @@ public class ContextTest {
}
Properties registryProperties = new Properties();
input = ContextTest.class.getClassLoader().getResourceAsStream(REGISTRY_PROPERTIES_FILENAME);
try {
// load the properties file
registryProperties.load(input);
} catch (IOException e) {
throw new RuntimeException(e);
}
RESOURCE_REGISTRY_URL = registryProperties.getProperty(RESOURCE_REGISTRY_URL_PROPERTY);
RESOURCE_REGISTRY_URL = properties.getProperty(RESOURCE_REGISTRY_URL_PROPERTY);
}

View File

@ -28,9 +28,11 @@ import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientImpl;
import org.gcube.informationsystem.resourceregistry.publisher.ContextTest;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherImpl;
import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
@ -73,9 +75,14 @@ public class ERManagementTest extends ContextTest {
protected ResourceRegistryClient resourceRegistryClient;
public ERManagementTest() {
if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) {
resourceRegistryPublisher = new ResourceRegistryPublisherImpl(ContextTest.RESOURCE_REGISTRY_URL);
resourceRegistryClient = new ResourceRegistryClientImpl(ContextTest.RESOURCE_REGISTRY_URL);
}else {
resourceRegistryPublisher = ResourceRegistryPublisherFactory.create();
resourceRegistryClient = ResourceRegistryClientFactory.create();
}
}
@Test
public void testEncrypted() throws Exception {

View File

@ -12,6 +12,7 @@ import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.resourceregistry.publisher.ContextTest;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherImpl;
import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
@ -41,8 +42,12 @@ public class EntityManagementTest extends ContextTest {
protected ResourceRegistryPublisher resourceRegistryPublisher;
public EntityManagementTest(){
if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) {
resourceRegistryPublisher = new ResourceRegistryPublisherImpl(ContextTest.RESOURCE_REGISTRY_URL);
}else {
resourceRegistryPublisher = ResourceRegistryPublisherFactory.create();
}
}
//@Test
public void testCreateUpdateDeleteFacet() throws Exception {

View File

@ -20,9 +20,11 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundExcep
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientImpl;
import org.gcube.informationsystem.resourceregistry.publisher.ContextTest;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.EventFacetImpl;
@ -71,9 +73,14 @@ public class MultiContextTest extends ContextTest {
public MultiContextTest() throws Exception {
ContextTest.setContextByName(PARENT_DEFAULT_TEST_SCOPE);
if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) {
resourceRegistryPublisher = new ResourceRegistryPublisherImpl(ContextTest.RESOURCE_REGISTRY_URL);
resourceRegistryClient = new ResourceRegistryClientImpl(ContextTest.RESOURCE_REGISTRY_URL);
}else {
resourceRegistryPublisher = ResourceRegistryPublisherFactory.create();
resourceRegistryClient = ResourceRegistryClientFactory.create();
}
}
@Test
public void testCreateEServiceHostingNode() throws Exception {

View File

@ -13,9 +13,11 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.face
import org.gcube.informationsystem.resourceregistry.api.exceptions.entities.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientImpl;
import org.gcube.informationsystem.resourceregistry.publisher.ContextTest;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl;
@ -41,8 +43,13 @@ public class RRClientTest extends ContextTest {
protected ResourceRegistryClient resourceRegistryClient;
public RRClientTest(){
if(ContextTest.RESOURCE_REGISTRY_URL !=null && !ContextTest.RESOURCE_REGISTRY_URL.isEmpty()) {
resourceRegistryPublisher = new ResourceRegistryPublisherImpl(ContextTest.RESOURCE_REGISTRY_URL);
resourceRegistryClient = new ResourceRegistryClientImpl(ContextTest.RESOURCE_REGISTRY_URL);
}else {
resourceRegistryPublisher = ResourceRegistryPublisherFactory.create();
resourceRegistryClient = ResourceRegistryClientFactory.create();
}
logger.trace("{} and {} created",
ResourceRegistryPublisher.class.getSimpleName(),
ResourceRegistryClient.class.getSimpleName());