Search in sources :

Example 21 with Parameters

use of org.alfresco.rest.framework.resource.parameters.Parameters 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 22 with Parameters

use of org.alfresco.rest.framework.resource.parameters.Parameters 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

Parameters (org.alfresco.rest.framework.resource.parameters.Parameters)22 BaseUnitTest (org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)11 RMSite (org.alfresco.rm.rest.api.model.RMSite)11 Test (org.junit.Test)11 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)10 Params (org.alfresco.rest.framework.resource.parameters.Params)9 NodeRef (org.alfresco.service.cmr.repository.NodeRef)9 SiteUpdate (org.alfresco.rest.api.model.SiteUpdate)8 Query (org.alfresco.rest.framework.resource.parameters.where.Query)8 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)7 SiteInfo (org.alfresco.service.cmr.site.SiteInfo)6 SiteVisibility (org.alfresco.service.cmr.site.SiteVisibility)6 ArrayList (java.util.ArrayList)5 Arrays (java.util.Arrays)5 Collections (java.util.Collections)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 List (java.util.List)5 Map (java.util.Map)5 Set (java.util.Set)5