Search in sources :

Example 6 with SmartExceptionDTO

use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.

the class ChangeRequestDocumentActionServiceTest method testDownloadDocument.

// @Test
public void testDownloadDocument() throws IOException {
    String vfOid = uploadDocumentsAsAdmin();
    TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
    for (TestUserInfo user : allowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                downloadDocumentAsUser(request, vfOid);
            });
        } catch (SmartExceptionDTO e) {
            e.printStackTrace();
            Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
        }
    }
    TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
    for (TestUserInfo user : disAllowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                downloadDocumentAsUser(request, vfOid);
                Assert.fail("Expected a permission exception.");
            });
        } catch (SmartExceptionDTO e) {
            Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
        // Expected
        }
        TestDataSet.deleteAllVaultFiles();
    }
}
Also used : TestUserInfo(net.geoprism.registry.test.TestUserInfo) SmartExceptionDTO(com.runwaysdk.business.SmartExceptionDTO)

Example 7 with SmartExceptionDTO

use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.

the class ChangeRequestDocumentActionServiceTest method testDeleteDocument.

// @Test
public void testDeleteDocument() {
    TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
    for (TestUserInfo user : allowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                testDeleteDocumentAsUser(request);
            });
        } catch (SmartExceptionDTO e) {
            e.printStackTrace();
            Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
        }
    }
    TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
    for (TestUserInfo user : disAllowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                testDeleteDocumentAsUser(request);
                Assert.fail("Expected a permission exception.");
            });
        } catch (SmartExceptionDTO e) {
            Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
        // Expected
        }
    }
}
Also used : TestUserInfo(net.geoprism.registry.test.TestUserInfo) SmartExceptionDTO(com.runwaysdk.business.SmartExceptionDTO)

Example 8 with SmartExceptionDTO

use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.

the class ChangeRequestDocumentServiceTest method testListDocuments.

@Test
public void testListDocuments() {
    uploadDocumentsAsAdmin();
    TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
    for (TestUserInfo user : allowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                testListDocumentsAsUser(request);
            });
        } catch (SmartExceptionDTO e) {
            e.printStackTrace();
            Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
        }
    }
    TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
    for (TestUserInfo user : disAllowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                testListDocumentsAsUser(request);
                Assert.fail("Expected a permission exception.");
            });
        } catch (SmartExceptionDTO e) {
            Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
        // Expected
        }
    }
}
Also used : TestUserInfo(net.geoprism.registry.test.TestUserInfo) SmartExceptionDTO(com.runwaysdk.business.SmartExceptionDTO) Test(org.junit.Test)

Example 9 with SmartExceptionDTO

use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.

the class ChangeRequestDocumentServiceTest method testDeleteDocument.

@Test
public void testDeleteDocument() {
    TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
    for (TestUserInfo user : allowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                testDeleteDocumentAsUser(request);
            });
        } catch (SmartExceptionDTO e) {
            e.printStackTrace();
            Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
        }
    }
    TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
    for (TestUserInfo user : disAllowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                testDeleteDocumentAsUser(request);
                Assert.fail("Expected a permission exception.");
            });
        } catch (SmartExceptionDTO e) {
            Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
        // Expected
        }
    }
}
Also used : TestUserInfo(net.geoprism.registry.test.TestUserInfo) SmartExceptionDTO(com.runwaysdk.business.SmartExceptionDTO) Test(org.junit.Test)

Example 10 with SmartExceptionDTO

use of com.runwaysdk.business.SmartExceptionDTO in project geoprism-registry by terraframe.

the class ChangeRequestDocumentServiceTest method testDownloadDocument.

@Test
public void testDownloadDocument() throws IOException {
    String vfOid = uploadDocumentsAsAdmin();
    TestUserInfo[] allowedUsers = new TestUserInfo[] { FastTestDataset.USER_ADMIN, FastTestDataset.USER_CGOV_RA, FastTestDataset.USER_CGOV_RM, FastTestDataset.USER_CGOV_RC, FastTestDataset.USER_CGOV_AC };
    for (TestUserInfo user : allowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                downloadDocumentAsUser(request, vfOid);
            });
        } catch (SmartExceptionDTO e) {
            e.printStackTrace();
            Assert.fail("Unexpected permission exception was thrown on user [" + user.getUsername() + "].");
        }
    }
    TestUserInfo[] disAllowedUsers = new TestUserInfo[] { FastTestDataset.USER_MOHA_RA, FastTestDataset.USER_MOHA_RM, FastTestDataset.USER_MOHA_RC, FastTestDataset.USER_MOHA_AC };
    for (TestUserInfo user : disAllowedUsers) {
        try {
            FastTestDataset.runAsUser(user, (request, adapter) -> {
                downloadDocumentAsUser(request, vfOid);
                Assert.fail("Expected a permission exception.");
            });
        } catch (SmartExceptionDTO e) {
            Assert.assertEquals(CGRPermissionException.CLASS, e.getType());
        // Expected
        }
        TestDataSet.deleteAllVaultFiles();
    }
}
Also used : TestUserInfo(net.geoprism.registry.test.TestUserInfo) SmartExceptionDTO(com.runwaysdk.business.SmartExceptionDTO) Test(org.junit.Test)

Aggregations

SmartExceptionDTO (com.runwaysdk.business.SmartExceptionDTO)39 TestUserInfo (net.geoprism.registry.test.TestUserInfo)37 Test (org.junit.Test)35 JsonObject (com.google.gson.JsonObject)6 TestGeoObjectInfo (net.geoprism.registry.test.TestGeoObjectInfo)6 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)5 JsonArray (com.google.gson.JsonArray)3 ListTypeTest (net.geoprism.registry.service.ListTypeTest)3 CurationControllerWrapper (net.geoprism.registry.test.curation.CurationControllerWrapper)3 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)2 Point (com.vividsolutions.jts.geom.Point)2 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)2 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)2 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)2 HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)2 GeometryBuilder (org.geotools.geometry.jts.GeometryBuilder)2 ArrayList (java.util.ArrayList)1 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)1 GeoObjectTypeNotFoundException (org.commongeoregistry.adapter.GeoObjectTypeNotFoundException)1 GeoObjectOverTime (org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime)1