Search in sources :

Example 16 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSiteEntityResourceUnitTest method updateRMSiteId.

@Test
public void updateRMSiteId() throws Exception {
    String siteId = RM_SITE_ID;
    Params parameters = mock(Params.class);
    RMSite site = new RMSite();
    site.setTitle("New Title");
    site.setDescription("New Description");
    site.setId("newSiteID");
    try {
        rmSiteEntityResource.update(siteId, site, parameters);
        fail("Expected ecxeption as rm site id cannot be changed.");
    } catch (InvalidArgumentException ex) {
        assertEquals("Site update does not support field: id", ex.getMsgId());
    }
    verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class));
}
Also used : RMSite(org.alfresco.rm.rest.api.model.RMSite) InvalidArgumentException(org.alfresco.rest.framework.core.exceptions.InvalidArgumentException) Parameters(org.alfresco.rest.framework.resource.parameters.Parameters) SiteUpdate(org.alfresco.rest.api.model.SiteUpdate) Params(org.alfresco.rest.framework.resource.parameters.Params) BaseUnitTest(org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest) Test(org.junit.Test)

Example 17 with RMSite

use of org.alfresco.rm.rest.api.model.RMSite in project records-management by Alfresco.

the class RMSiteEntityResourceUnitTest method updateRMSiteVisibility.

@Test
public void updateRMSiteVisibility() throws Exception {
    String siteId = RM_SITE_ID;
    Params parameters = mock(Params.class);
    RMSite site = new RMSite();
    site.setTitle("New Title");
    site.setDescription("New Description");
    site.setVisibility(SiteVisibility.PRIVATE);
    try {
        rmSiteEntityResource.update(siteId, site, parameters);
        fail("Expected ecxeption as rm site visibility cannot be changed.");
    } catch (InvalidArgumentException ex) {
        assertEquals("Site update does not support field: visibility", ex.getMsgId());
    }
    verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class));
}
Also used : RMSite(org.alfresco.rm.rest.api.model.RMSite) InvalidArgumentException(org.alfresco.rest.framework.core.exceptions.InvalidArgumentException) Parameters(org.alfresco.rest.framework.resource.parameters.Parameters) SiteUpdate(org.alfresco.rest.api.model.SiteUpdate) Params(org.alfresco.rest.framework.resource.parameters.Params) BaseUnitTest(org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest) Test(org.junit.Test)

Aggregations

RMSite (org.alfresco.rm.rest.api.model.RMSite)17 BaseUnitTest (org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)13 Test (org.junit.Test)13 Parameters (org.alfresco.rest.framework.resource.parameters.Parameters)11 SiteUpdate (org.alfresco.rest.api.model.SiteUpdate)8 Params (org.alfresco.rest.framework.resource.parameters.Params)8 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)7 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)5 NodeRef (org.alfresco.service.cmr.repository.NodeRef)5 SiteVisibility (org.alfresco.service.cmr.site.SiteVisibility)4 SiteImportPackageHandler (org.alfresco.rest.api.impl.SiteImportPackageHandler)3 Site (org.alfresco.rest.api.model.Site)3 RMSiteCompliance (org.alfresco.rm.rest.api.model.RMSiteCompliance)3 ImporterBinding (org.alfresco.service.cmr.view.ImporterBinding)3 Location (org.alfresco.service.cmr.view.Location)3 QName (org.alfresco.service.namespace.QName)3 InvalidParameterException (java.security.InvalidParameterException)1 ArrayList (java.util.ArrayList)1 ActivityInfo (org.alfresco.service.cmr.activities.ActivityInfo)1