use of org.alfresco.rest.framework.resource.parameters.Parameters in project alfresco-remote-api by Alfresco.
the class QuickShareLinksImpl method getParamsWithCreatedStatus.
private Parameters getParamsWithCreatedStatus() {
String filterStatusCreated = "(" + Renditions.PARAM_STATUS + "='" + Rendition.RenditionStatus.CREATED + "')";
Query whereQuery = getWhereClause(filterStatusCreated);
Params.RecognizedParams recParams = new Params.RecognizedParams(null, null, null, null, null, null, whereQuery, null, false);
Parameters params = Params.valueOf(recParams, null, null, null);
return params;
}
use of org.alfresco.rest.framework.resource.parameters.Parameters in project alfresco-remote-api by Alfresco.
the class ProcessesImplTest method queryMatchesProcesses.
private CollectionWithPagingInfo<ProcessInfo> queryMatchesProcesses(String matchesString) {
Query query = getWhereClause(String.format(QUERY_WORKFLOWDESCRIPTION_MATCHES, matchesString));
Parameters parameters = Params.valueOf(new RecognizedParams(null, Paging.valueOf(0, ACTIVE_WORKFLOWS_INITIAL_AMOUNT), null, null, null, null, query, null, false), null, null, null);
return processes.getProcesses(parameters);
}
use of org.alfresco.rest.framework.resource.parameters.Parameters in project records-management by Alfresco.
the class RMSitesImplUnitTest method createRMStandardSite.
@Test
public void createRMStandardSite() throws Exception {
RMSite toCreate = new RMSite();
toCreate.setTitle(RM_SITE_TITLE);
toCreate.setDescription(RM_SITE_DESCRIPTION);
// mocked SiteInfo
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedSiteInfo.getShortName()).thenReturn(RM_SITE_ID);
when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef);
when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION);
when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE);
when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC);
when(mockedSiteService.createSite(any(String.class), any(String.class), any(String.class), any(String.class), any(SiteVisibility.class), any(QName.class))).thenReturn(mockedSiteInfo);
// mock Parameters
Parameters mockedParameters = mock(Parameters.class);
// call createRMSite method
RMSite createdRMSite = rmSitesImpl.createRMSite(toCreate, mockedParameters);
// check siteService.createSite parameters
ArgumentCaptor<String> sitePresetCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> titleCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> descriptionCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<SiteVisibility> visibilityCaptor = ArgumentCaptor.forClass(SiteVisibility.class);
ArgumentCaptor<QName> siteTypeCaptor = ArgumentCaptor.forClass(QName.class);
verify(mockedSiteService, times(1)).createSite(sitePresetCaptor.capture(), idCaptor.capture(), titleCaptor.capture(), descriptionCaptor.capture(), visibilityCaptor.capture(), siteTypeCaptor.capture());
assertEquals(RM_SITE_PRESET, sitePresetCaptor.getValue());
assertEquals(RM_SITE_ID, idCaptor.getValue());
assertEquals(RM_SITE_TITLE, titleCaptor.getValue());
assertEquals(RM_SITE_DESCRIPTION, descriptionCaptor.getValue());
assertEquals(SiteVisibility.PUBLIC, visibilityCaptor.getValue());
assertEquals(RecordsManagementModel.TYPE_RM_SITE, siteTypeCaptor.getValue());
verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null));
verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
verify(mockedFavouritesService, times(1)).addFavourite(any(String.class), any(NodeRef.class));
// verify returned values for RM site are the right ones
assertEquals(RMSiteCompliance.STANDARD, createdRMSite.getCompliance());
assertEquals(null, createdRMSite.getRole());
assertEquals(RM_SITE_ID, createdRMSite.getId());
assertEquals(siteNodeRef.getId(), createdRMSite.getGuid());
assertEquals(RM_SITE_DESCRIPTION, createdRMSite.getDescription());
assertEquals(RM_SITE_TITLE, createdRMSite.getTitle());
assertEquals(SiteVisibility.PUBLIC, createdRMSite.getVisibility());
}
use of org.alfresco.rest.framework.resource.parameters.Parameters in project records-management by Alfresco.
the class RMSitesImplUnitTest method updateRMSite.
@Test
public void updateRMSite() throws Exception {
String siteId = RM_SITE_ID;
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService);
// mock SiteInfo
when(mockedSiteInfo.getShortName()).thenReturn(siteId);
when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef);
when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION).thenReturn(RM_SITE_DESCRIPTION_AFTER_UPDATE);
when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE).thenReturn(RM_SITE_TITLE_AFTER_UPDATE);
when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC);
when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE);
when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo);
when(mockedSiteService.getMembersRole(eq(siteId), any(String.class))).thenReturn(RM_SITE_MANAGER_ROLE);
// mock UpdateSite
SiteUpdate mockedSiteUpdate = mock(SiteUpdate.class);
when(mockedSiteUpdate.getDescription()).thenReturn(RM_SITE_DESCRIPTION_AFTER_UPDATE);
when(mockedSiteUpdate.getTitle()).thenReturn(RM_SITE_TITLE_AFTER_UPDATE);
when(mockedSiteUpdate.getVisibility()).thenReturn(null);
when(mockedSiteUpdate.wasSet(Site.TITLE)).thenReturn(true);
when(mockedSiteUpdate.wasSet(Site.DESCRIPTION)).thenReturn(true);
// mock Parameters
Parameters mockedParameters = mock(Parameters.class);
// call updateRMSite method
RMSite updatedRMSite = rmSitesImpl.updateRMSite(siteId, mockedSiteUpdate, mockedParameters);
// check if the new title is set to siteInfo
ArgumentCaptor<String> titleCaptor = ArgumentCaptor.forClass(String.class);
verify(mockedSiteInfo, times(1)).setTitle(titleCaptor.capture());
assertEquals(RM_SITE_TITLE_AFTER_UPDATE, titleCaptor.getValue());
// check that new description is set to siteInfo
ArgumentCaptor<String> descriptionCaptor = ArgumentCaptor.forClass(String.class);
verify(mockedSiteInfo, times(1)).setDescription(descriptionCaptor.capture());
assertEquals(RM_SITE_DESCRIPTION_AFTER_UPDATE, descriptionCaptor.getValue());
// check that site visibility is not changed
verify(mockedSiteInfo, never()).setVisibility(any(SiteVisibility.class));
// check that updateSite is called
verify(mockedSiteService, times(1)).updateSite(any(SiteInfo.class));
// verify returned values for RM site are the right ones
assertEquals(RMSiteCompliance.STANDARD, updatedRMSite.getCompliance());
assertEquals(RM_SITE_MANAGER_ROLE, updatedRMSite.getRole());
assertEquals(siteId, updatedRMSite.getId());
assertEquals(siteNodeRef.getId(), updatedRMSite.getGuid());
assertEquals(RM_SITE_DESCRIPTION_AFTER_UPDATE, updatedRMSite.getDescription());
assertEquals(RM_SITE_TITLE_AFTER_UPDATE, updatedRMSite.getTitle());
assertEquals(SiteVisibility.PUBLIC, updatedRMSite.getVisibility());
}
use of org.alfresco.rest.framework.resource.parameters.Parameters in project records-management by Alfresco.
the class RMSitesImplUnitTest method createRMDOD5015Site.
@Test
public void createRMDOD5015Site() throws Exception {
RMSite toCreate = new RMSite();
toCreate.setTitle(RM_SITE_TITLE);
toCreate.setDescription(RM_SITE_DESCRIPTION);
toCreate.setCompliance(RMSiteCompliance.DOD5015);
// mocked SiteInfo
SiteInfo mockedSiteInfo = mock(SiteInfo.class);
NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService);
when(mockedSiteInfo.getShortName()).thenReturn(RM_SITE_ID);
when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef);
when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION);
when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE);
when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC);
when(mockedSiteService.createSite(any(String.class), any(String.class), any(String.class), any(String.class), any(SiteVisibility.class), any(QName.class))).thenReturn(mockedSiteInfo);
// mock Parameters
Parameters mockedParameters = mock(Parameters.class);
// call createRMSite method
RMSite createdRMSite = rmSitesImpl.createRMSite(toCreate, mockedParameters);
// check siteService.createSite parameters
ArgumentCaptor<String> sitePresetCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> titleCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> descriptionCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<SiteVisibility> visibilityCaptor = ArgumentCaptor.forClass(SiteVisibility.class);
ArgumentCaptor<QName> siteTypeCaptor = ArgumentCaptor.forClass(QName.class);
verify(mockedSiteService, times(1)).createSite(sitePresetCaptor.capture(), idCaptor.capture(), titleCaptor.capture(), descriptionCaptor.capture(), visibilityCaptor.capture(), siteTypeCaptor.capture());
assertEquals(RM_SITE_PRESET, sitePresetCaptor.getValue());
assertEquals(RM_SITE_ID, idCaptor.getValue());
assertEquals(RM_SITE_TITLE, titleCaptor.getValue());
assertEquals(RM_SITE_DESCRIPTION, descriptionCaptor.getValue());
assertEquals(SiteVisibility.PUBLIC, visibilityCaptor.getValue());
assertEquals(DOD5015Model.TYPE_DOD_5015_SITE, siteTypeCaptor.getValue());
verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null));
verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
verify(mockedFavouritesService, times(1)).addFavourite(any(String.class), any(NodeRef.class));
// verify returned values for RM site are the right ones
assertEquals(RMSiteCompliance.DOD5015, createdRMSite.getCompliance());
assertEquals(null, createdRMSite.getRole());
assertEquals(RM_SITE_ID, createdRMSite.getId());
assertEquals(siteNodeRef.getId(), createdRMSite.getGuid());
assertEquals(RM_SITE_DESCRIPTION, createdRMSite.getDescription());
assertEquals(RM_SITE_TITLE, createdRMSite.getTitle());
assertEquals(SiteVisibility.PUBLIC, createdRMSite.getVisibility());
}
Aggregations