Fixed context creation
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/resource-registry-database-creator@171339 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
204ac1f3f9
commit
17855cf4ab
2
pom.xml
2
pom.xml
|
@ -54,13 +54,11 @@
|
||||||
<artifactId>gcube-resources</artifactId>
|
<artifactId>gcube-resources</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>parthenos-entities</artifactId>
|
<artifactId>parthenos-entities</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
|
|
|
@ -1,62 +1,22 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.context;
|
package org.gcube.informationsystem.resourceregistry.context;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.gcube.informationsystem.impl.entity.ContextImpl;
|
|
||||||
import org.gcube.informationsystem.impl.utils.ISMapper;
|
|
||||||
import org.gcube.informationsystem.model.entity.Context;
|
|
||||||
import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
/*
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
*/
|
||||||
|
|
||||||
public class ContextManagementTest extends ScopedTest {
|
public class ContextManagementTest extends ScopedTest {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ContextManagementTest.class);
|
// private static Logger logger = LoggerFactory.getLogger(ContextManagementTest.class);
|
||||||
|
|
||||||
protected Context read(UUID uuid) throws ResourceRegistryException, IOException {
|
|
||||||
ContextManagement contextManagement = new ContextManagement();
|
|
||||||
contextManagement.setUUID(uuid);
|
|
||||||
String contextString = contextManagement.read();
|
|
||||||
logger.debug("Read {}", contextString);
|
|
||||||
return ISMapper.unmarshal(Context.class, contextString);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Context create(Context context) throws ResourceRegistryException, IOException {
|
|
||||||
ContextManagement contextManagement = new ContextManagement();
|
|
||||||
contextManagement.setJSON(ISMapper.marshal(context));
|
|
||||||
String contextString = contextManagement.create();
|
|
||||||
logger.debug("Created {}", contextString);
|
|
||||||
Context c = ISMapper.unmarshal(Context.class, contextString);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void createPreContext() throws Exception {
|
|
||||||
Context gcube = new ContextImpl("gcube");
|
|
||||||
gcube = create(gcube);
|
|
||||||
|
|
||||||
Context preprod = new ContextImpl("preprod");
|
|
||||||
preprod.setParent(gcube);
|
|
||||||
preprod = create(preprod);
|
|
||||||
|
|
||||||
Context parthenosVRE = new ContextImpl("PARTHENOS_PRE");
|
|
||||||
parthenosVRE.setParent(preprod);
|
|
||||||
parthenosVRE = create(parthenosVRE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createContexts() throws Exception {
|
public void createContexts() throws Exception {
|
||||||
|
//ScopedTest.setContext(ScopedTest.PROD);
|
||||||
ContextCreator contextCreator = new ContextCreator();
|
ContextCreator contextCreator = new ContextCreator();
|
||||||
contextCreator.all();
|
contextCreator.all();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testContext() throws Exception {
|
|
||||||
ScopedTest.setContext(ScopedTest.PROD);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue