Search in sources :

Example 1 with DuplicateDataDatabaseException

use of com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException in project geoprism-registry by terraframe.

the class ListTypeInheritedHierarchyTest method testMarkAsInvalidByInheritedParent.

@Test
@Request
public void testMarkAsInvalidByInheritedParent() {
    JsonObject json = ListTypeTest.getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_SCHOOL, USATestData.SCHOOL_ZONE, USATestData.DISTRICT, USATestData.STATE);
    ListType masterlist = ListType.apply(json);
    try {
        masterlist.markAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.STATE.getServerObject());
        Assert.assertFalse(masterlist.isValid());
    } catch (DuplicateDataDatabaseException e) {
        masterlist.delete();
    }
}
Also used : ListType(net.geoprism.registry.ListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 2 with DuplicateDataDatabaseException

use of com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException in project geoprism-registry by terraframe.

the class ListTypeTest method testCreateMultipleNonMaster.

// @Test
// @Request
// public void testCreateMultiple()
// {
// JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(),
// USATestData.HIER_ADMIN, USATestData.STATE, ListType.PUBLIC, true);
// 
// ListType test1 = ListType.apply(json);
// 
// try
// {
// json.addProperty(ListType.CODE, "CODE_2");
// 
// ListType test2 = ListType.apply(json);
// test2.delete();
// 
// Assert.fail("Able to apply multiple masterlists with the same universal");
// }
// catch (DuplicateListTypeException e)
// {
// test1.delete();
// }
// }
// 
@Test
@Request
public void testCreateMultipleNonMaster() {
    JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.STATE);
    ListType test1 = ListType.apply(json);
    try {
        json.addProperty(ListType.CODE, "CODE_2");
        ListType test2 = ListType.apply(json);
        test2.delete();
    } catch (DuplicateDataDatabaseException e) {
        test1.delete();
        Assert.fail("Not able to apply multiple masterlists with the same universal when list is not a master");
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 3 with DuplicateDataDatabaseException

use of com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException in project geoprism-registry by terraframe.

the class ListTypeTest method testMarkAsInvalidByParent.

@Test
@Request
public void testMarkAsInvalidByParent() {
    JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.DISTRICT, USATestData.COUNTRY, USATestData.STATE);
    ListType masterlist = ListType.apply(json);
    try {
        masterlist.markAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.STATE.getServerObject());
        Assert.assertFalse(masterlist.getValid());
    } catch (DuplicateDataDatabaseException e) {
        masterlist.delete();
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 4 with DuplicateDataDatabaseException

use of com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException in project geoprism-registry by terraframe.

the class ListTypeTest method testMarkAsInvalidByDirectType.

@Test
@Request
public void testMarkAsInvalidByDirectType() {
    JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.DISTRICT, USATestData.COUNTRY, USATestData.STATE);
    ListType masterlist = ListType.apply(json);
    try {
        masterlist.markAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.DISTRICT.getServerObject());
        Assert.assertFalse(masterlist.getValid());
    } catch (DuplicateDataDatabaseException e) {
        masterlist.delete();
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 5 with DuplicateDataDatabaseException

use of com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException in project geoprism-registry by terraframe.

the class ListTypeTest method testMarkAllAsInvalid.

@Test
@Request
public void testMarkAllAsInvalid() {
    JsonObject json = getJson(USATestData.ORG_NPS.getServerObject(), USATestData.HIER_ADMIN, USATestData.STATE);
    ListType masterlist = ListType.apply(json);
    try {
        ListType.markAllAsInvalid(USATestData.HIER_ADMIN.getServerObject(), USATestData.STATE.getServerObject());
        ListType test = ListType.get(masterlist.getOid());
        Assert.assertFalse(test.getValid());
    } catch (DuplicateDataDatabaseException e) {
        masterlist.delete();
    }
}
Also used : SingleListType(net.geoprism.registry.SingleListType) IntervalListType(net.geoprism.registry.IntervalListType) ListType(net.geoprism.registry.ListType) IncrementalListType(net.geoprism.registry.IncrementalListType) JsonObject(com.google.gson.JsonObject) DuplicateDataDatabaseException(com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

JsonObject (com.google.gson.JsonObject)7 DuplicateDataDatabaseException (com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException)7 Request (com.runwaysdk.session.Request)7 ListType (net.geoprism.registry.ListType)7 Test (org.junit.Test)7 IncrementalListType (net.geoprism.registry.IncrementalListType)6 IntervalListType (net.geoprism.registry.IntervalListType)6 SingleListType (net.geoprism.registry.SingleListType)6 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)6