use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class BusinessTypeTest method testRemove.
@Test
@Request
public void testRemove() {
String code = "TEST_PROG";
String orgCode = FastTestDataset.ORG_CGOV.getCode();
String label = "Test Prog";
JsonObject object = new JsonObject();
object.addProperty(BusinessType.CODE, code);
object.addProperty(BusinessType.ORGANIZATION, orgCode);
object.add(BusinessType.DISPLAYLABEL, new LocalizedValue(label).toJSON());
BusinessType type = BusinessType.apply(object);
type.delete();
Assert.assertNull(BusinessType.getByCode(type.getCode()));
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class BusinessTypeTest method testToJson.
@Test
@Request
public void testToJson() {
String code = "TEST_PROG";
String orgCode = FastTestDataset.ORG_CGOV.getCode();
String label = "Test Prog";
JsonObject object = new JsonObject();
object.addProperty(BusinessType.CODE, code);
object.addProperty(BusinessType.ORGANIZATION, orgCode);
object.add(BusinessType.DISPLAYLABEL, new LocalizedValue(label).toJSON());
BusinessType type = BusinessType.apply(object);
try {
JsonObject json = type.toJSON();
Assert.assertEquals(type.getCode(), json.get("code").getAsString());
Assert.assertFalse(json.has("attributes"));
} finally {
type.delete();
}
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class BusinessTypeTest method testCreate.
@Test
@Request
public void testCreate() {
String code = "TEST_PROG";
String orgCode = FastTestDataset.ORG_CGOV.getCode();
String label = "Test Prog";
JsonObject object = new JsonObject();
object.addProperty(BusinessType.CODE, code);
object.addProperty(BusinessType.ORGANIZATION, orgCode);
object.add(BusinessType.DISPLAYLABEL, new LocalizedValue(label).toJSON());
BusinessType type = BusinessType.apply(object);
try {
Assert.assertEquals(code, type.getCode());
Assert.assertEquals(orgCode, type.getOrganization().getCode());
Assert.assertEquals(label, type.getDisplayLabel().getValue());
Assert.assertNotNull(type.getMdVertex());
} finally {
type.delete();
}
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ClassificationTest method testAddGetChildApplyWithParent.
@Test
@Request
public void testAddGetChildApplyWithParent() {
Classification parent = Classification.newInstance(type);
parent.setCode(PARENT_CODE);
parent.apply(null);
try {
Classification child = Classification.newInstance(type);
child.setCode(CHILD_CODE);
child.apply(parent);
try {
Page<Classification> children = parent.getChildren(20, 1);
Assert.assertEquals(Long.valueOf(1), children.getCount());
Classification result = children.getResults().get(0);
Assert.assertEquals(child.getOid(), result.getOid());
} finally {
child.delete();
}
} finally {
parent.delete();
}
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ClassificationTest method testGetAncestor.
@Test
@Request
public void testGetAncestor() {
Classification grandParent = Classification.newInstance(type);
grandParent.setCode(GRANDPARENT_CODE);
grandParent.apply(null);
try {
Classification parent = Classification.newInstance(type);
parent.setCode(PARENT_CODE);
parent.apply(grandParent);
try {
Classification child = Classification.newInstance(type);
child.setCode(CHILD_CODE);
child.apply(parent);
try {
List<Classification> ancestors = child.getAncestors(null);
Assert.assertEquals(3, ancestors.size());
} finally {
child.delete();
}
} finally {
parent.delete();
}
} finally {
grandParent.delete();
}
}
Aggregations