Fixing tests
This commit is contained in:
parent
df3d81d2bd
commit
f80eec0301
|
@ -590,8 +590,6 @@ public class ERManagementTest extends ContextTest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public static final String TEST_RESOURCE = "test-resource.json";
|
||||
//
|
||||
// // @Test
|
||||
|
@ -612,8 +610,4 @@ public class ERManagementTest extends ContextTest {
|
|||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,15 @@ public class QueryTest extends ContextTest {
|
|||
|
||||
@Test
|
||||
public void testGetAll() throws Exception {
|
||||
|
||||
// Clean the environment first to avoid error if a previous tests fails without cleaning the env
|
||||
ResourceManagement rm = (ResourceManagement) ElementManagementUtility.getERManagement(Resource.NAME);
|
||||
String all = rm.all(true);
|
||||
List<Resource> allResources = ElementMapper.unmarshalList(Resource.class, all);
|
||||
for(Resource r : allResources) {
|
||||
ERManagementTest.deleteResource(r);
|
||||
}
|
||||
|
||||
Map<String, List<Resource>> resources = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
|
|
@ -4,9 +4,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||
|
@ -16,15 +14,10 @@ public class AddToContextTest {
|
|||
|
||||
@Test
|
||||
public void testCreateEServiceAndRemoveFromContextRequiredFacet() throws Exception {
|
||||
EService eService = ERManagementTest.instantiateValidEService();
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(EService.NAME);
|
||||
resourceManagement.setJson(ElementMapper.marshal(eService));
|
||||
String createEServiceString = resourceManagement.create();
|
||||
EService createEService = ElementMapper.unmarshal(EService.class, createEServiceString);
|
||||
EService eService = ERManagementTest.createEService();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) createEService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
||||
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedBy = (IsIdentifiedBy<EService, SoftwareFacet>) eService.getConsistsOf(IsIdentifiedBy.class).get(0);
|
||||
ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement();
|
||||
consistsOfManagement.setElementType(IsIdentifiedBy.NAME);
|
||||
consistsOfManagement.setUUID(isIdentifiedBy.getHeader().getUUID());
|
||||
|
@ -35,7 +28,7 @@ public class AddToContextTest {
|
|||
}catch (SchemaViolationException e) {
|
||||
// As expected
|
||||
}catch (Exception e) {
|
||||
resourceManagement.delete();
|
||||
ERManagementTest.deleteResource(eService);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
@ -50,11 +43,11 @@ public class AddToContextTest {
|
|||
}catch (SchemaViolationException e) {
|
||||
// As expected
|
||||
}catch (Exception e) {
|
||||
resourceManagement.delete();
|
||||
ERManagementTest.deleteResource(eService);
|
||||
throw e;
|
||||
}
|
||||
|
||||
resourceManagement.delete();
|
||||
ERManagementTest.deleteResource(eService);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue