Fixed test
This commit is contained in:
parent
b025d08099
commit
7dff6271f5
|
@ -5,10 +5,12 @@ import java.net.URL;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.informationsystem.queries.templates.impl.entities.QueryTemplateImpl;
|
||||
import org.gcube.informationsystem.queries.templates.impl.properties.TemplateVariableImpl;
|
||||
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
|
||||
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
||||
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.queries.JsonQueryTest;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
|
@ -16,7 +18,7 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class QueryTemplateManagementTest {
|
||||
public class QueryTemplateManagementTest extends ContextTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(QueryTemplateManagementTest.class);
|
||||
|
||||
|
@ -42,19 +44,22 @@ public class QueryTemplateManagementTest {
|
|||
queryTemplate.setTemplate(jsonNode);
|
||||
|
||||
TemplateVariable stateTemplateVariable = new TemplateVariableImpl();
|
||||
stateTemplateVariable.setName("$state");
|
||||
String stateVariableName = "$state";
|
||||
stateTemplateVariable.setName(stateVariableName);
|
||||
stateTemplateVariable.setDescription("StateFacet value");
|
||||
stateTemplateVariable.setDefaultValue("running");
|
||||
queryTemplate.addTemplateVariable(stateTemplateVariable);
|
||||
|
||||
TemplateVariable nameTemplateVariable = new TemplateVariableImpl();
|
||||
nameTemplateVariable.setName("$name");
|
||||
String nameVariableName = "$name";
|
||||
nameTemplateVariable.setName(nameVariableName);
|
||||
nameTemplateVariable.setDescription("SoftwareFacet name");
|
||||
nameTemplateVariable.setDefaultValue("resource-registry");
|
||||
queryTemplate.addTemplateVariable(nameTemplateVariable);
|
||||
|
||||
TemplateVariable groupTemplateVariable = new TemplateVariableImpl();
|
||||
groupTemplateVariable.setName("$group");
|
||||
String groupVariableName = "$group";
|
||||
groupTemplateVariable.setName(groupVariableName);
|
||||
groupTemplateVariable.setDescription("SoftwareFacet group");
|
||||
groupTemplateVariable.setDefaultValue("information-system");
|
||||
queryTemplate.addTemplateVariable(groupTemplateVariable);
|
||||
|
@ -117,9 +122,14 @@ public class QueryTemplateManagementTest {
|
|||
|
||||
queryTemplateManagement = new QueryTemplateManagement();
|
||||
queryTemplateManagement.setName(name);
|
||||
// TODO Set Values
|
||||
queryTemplateManagement.run();
|
||||
|
||||
ObjectNode params = objectMapper.createObjectNode();
|
||||
params.put(stateVariableName, "running");
|
||||
params.put(groupVariableName, "DataAccess");
|
||||
params.put(nameVariableName, "StorageHub");
|
||||
queryTemplateManagement.setParams(params);
|
||||
|
||||
queryTemplateManagement.run();
|
||||
|
||||
}finally {
|
||||
queryTemplateManagement.delete();
|
||||
|
|
Loading…
Reference in New Issue