use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectLocalizedValueCR_Verify.
@Request
private void testUpdateGeoObjectLocalizedValueCR_Verify(String[] data) throws Exception {
final String oldOid = data[1];
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
final Date newStartDate = sdf.parse(NEW_START_DATE);
final Date newEndDate = sdf.parse(NEW_END_DATE);
ChangeRequestQuery crq = new ChangeRequestQuery(new QueryFactory());
Assert.assertEquals(1, crq.getCount());
ChangeRequest cr = crq.getIterator().next();
Assert.assertEquals(AllGovernanceStatus.ACCEPTED.name(), cr.getGovernanceStatus().name());
AbstractAction action = cr.getAllAction().next();
Assert.assertTrue(action instanceof UpdateAttributeAction);
Assert.assertEquals(FastTestDataset.CAMBODIA.getCode(), cr.getGeoObjectCode());
Assert.assertEquals(FastTestDataset.CAMBODIA.getGeoObjectType().getCode(), cr.getGeoObjectTypeCode());
Assert.assertEquals(FastTestDataset.ORG_CGOV.getCode(), cr.getOrganizationCode());
VertexServerGeoObject cambodia = (VertexServerGeoObject) FastTestDataset.CAMBODIA.getServerObject();
ValueOverTimeCollection votc = cambodia.getValuesOverTime(DefaultAttribute.DISPLAY_LABEL.getName());
Assert.assertEquals(1, votc.size());
ValueOverTime vot1 = votc.get(0);
Assert.assertNotNull(vot1.getOid());
Assert.assertEquals(oldOid, vot1.getOid());
Assert.assertEquals(newStartDate, vot1.getStartDate());
Assert.assertEquals(newEndDate, vot1.getEndDate());
Assert.assertEquals("localizeTest", cambodia.getDisplayLabel(newStartDate).getValue());
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectTermCR_Verify.
@Request
private void testUpdateGeoObjectTermCR_Verify(String[] data) throws Exception {
final String attrName = FastTestDataset.AT_RELIGION.getAttributeName();
final String oldOid = data[1];
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
final Date newStartDate = sdf.parse(NEW_START_DATE);
final Date newEndDate = sdf.parse(NEW_END_DATE);
ChangeRequestQuery crq = new ChangeRequestQuery(new QueryFactory());
Assert.assertEquals(1, crq.getCount());
ChangeRequest cr = crq.getIterator().next();
Assert.assertEquals(AllGovernanceStatus.ACCEPTED.name(), cr.getGovernanceStatus().name());
AbstractAction action = cr.getAllAction().next();
Assert.assertTrue(action instanceof UpdateAttributeAction);
Assert.assertEquals(FastTestDataset.CAMBODIA.getCode(), cr.getGeoObjectCode());
Assert.assertEquals(FastTestDataset.CAMBODIA.getGeoObjectType().getCode(), cr.getGeoObjectTypeCode());
Assert.assertEquals(FastTestDataset.ORG_CGOV.getCode(), cr.getOrganizationCode());
VertexServerGeoObject cambodia = (VertexServerGeoObject) FastTestDataset.CAMBODIA.getServerObject();
ValueOverTimeCollection votc = cambodia.getValuesOverTime(attrName);
Assert.assertEquals(1, votc.size());
ValueOverTime vot1 = votc.get(0);
Assert.assertNotNull(vot1.getOid());
Assert.assertEquals(oldOid, vot1.getOid());
Assert.assertEquals(newStartDate, vot1.getStartDate());
Assert.assertEquals(newEndDate, vot1.getEndDate());
String classyId = ((Classifier) cambodia.getValue(attrName, newStartDate)).getOid();
Assert.assertEquals(FastTestDataset.T_Islam.fetchClassifier().getOid(), classyId);
Assert.assertEquals(classyId, vot1.getValue());
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class ListTypeInheritedHierarchyTest method cleanUpExtra.
@Request
public void cleanUpExtra() {
ListTypeQuery query = new ListTypeQuery(new QueryFactory());
OIterator<? extends ListType> it = query.getIterator();
try {
while (it.hasNext()) {
it.next().delete();
}
} finally {
it.close();
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class ListTypeTest method waitUntilPublished.
@Request
private void waitUntilPublished(String oid) {
List<? extends JobHistory> histories = null;
int waitTime = 0;
while (histories == null) {
if (waitTime > 10000) {
Assert.fail("Job was never scheduled. Unable to find any associated history.");
}
QueryFactory qf = new QueryFactory();
PublishListTypeVersionJobQuery jobQuery = new PublishListTypeVersionJobQuery(qf);
jobQuery.WHERE(jobQuery.getListType().EQ(oid));
JobHistoryQuery jhq = new JobHistoryQuery(qf);
jhq.WHERE(jhq.job(jobQuery));
List<? extends JobHistory> potentialHistories = jhq.getIterator().getAll();
if (potentialHistories.size() > 0) {
histories = potentialHistories;
} else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
Assert.fail("Interrupted while waiting");
}
waitTime += 1000;
}
}
for (JobHistory history : histories) {
try {
SchedulerTestUtils.waitUntilStatus(history.getOid(), AllJobStatus.SUCCESS);
} catch (InterruptedException e) {
e.printStackTrace();
Assert.fail("Interrupted while waiting");
}
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class TaskTest method deleteAllTasksInTrans.
@Transaction
private static void deleteAllTasksInTrans() {
LocalizedValueStoreQuery lvsq = new LocalizedValueStoreQuery(new QueryFactory());
lvsq.WHERE(lvsq.getStoreKey().EQ(TestTaskType.TestGeoObjectSplitOrphanedChildren.getTemplateKey()).OR(lvsq.getStoreKey().EQ(TestTaskType.TestGeoObjectSplitOrphanedChildren.getTitleKey())));
OIterator<? extends LocalizedValueStore> lvsit = lvsq.getIterator();
while (lvsit.hasNext()) {
LocalizedValueStore template = lvsit.next();
TaskQuery tq = new TaskQuery(new QueryFactory());
tq.WHERE(tq.getTemplate().EQ(template));
tq.OR(tq.getTitle().EQ(template));
OIterator<? extends Task> it2 = tq.getIterator();
while (it2.hasNext()) {
it2.next().delete();
}
template.delete();
}
}
Aggregations