protected String callMetadataService(String nodeString) throws ConnectorServiceException { GetRequest request = new GetRequest("/api/metadata?nodeRef=" + nodeString + "&shortQNames=true"); Response response = null; String jsonResponse = null; try { response = server.submitRequest( request.getMethod(), request.getFullUri(), request.getHeaders(), request.getBody(), request.getEncoding(), request.getType()); if (response != null) { jsonResponse = response.getContentAsString(); } } catch (UnsupportedEncodingException e) { throw new AlfrescoRuntimeException(e.getMessage()); } catch (IOException e) { throw new AlfrescoRuntimeException(e.getMessage()); } assertNotNull("Response /api/metadata is null", jsonResponse); log.info("Response /api/metadata json is: " + jsonResponse); return jsonResponse; }
public void testMNT11660() throws Exception { FormUIGet formUIGet = (FormUIGetExtend) ctx.getBean("webscript.org.alfresco.test.components.form.form.get"); assertNotNull("'FormUIGetExtend' bean for test is null.", formUIGet); ConfigSource configSource = new ClassPathConfigSource("test-config-custom-forms.xml"); XMLConfigService svc = new XMLConfigService(configSource); svc.initConfig(); formUIGet.setConfigService(svc); GetRequest requestWithAspect = new GetRequest( "/test/components/form?htmlid=template_default-formContainer&itemKind=node&itemId=" + folderWithAspect.toString() + "&formId=null&mode=view"); Response rspFormWithAspect = server.submitRequest( requestWithAspect.getMethod(), requestWithAspect.getFullUri(), requestWithAspect.getHeaders(), requestWithAspect.getBody(), requestWithAspect.getEncoding(), requestWithAspect.getType()); assertEquals( "The status of response is " + rspFormWithAspect.getStatus(), 200, rspFormWithAspect.getStatus()); String contentWithAspect = rspFormWithAspect.getContentAsString(); log.info( "Response form for node with dublincore aspect status is " + rspFormWithAspect.getStatus() + " content is " + contentWithAspect); assertNotNull("Response content for 'contentWithAspect' is null", contentWithAspect); assertTrue( "Return the following content: " + contentWithAspect, contentWithAspect.contains("My Set")); GetRequest requestWithoutAspect = new GetRequest( "/test/components/form?htmlid=template_default-formContainer&itemKind=node&itemId=" + folderWithoutAspect.toString() + "&formId=null&mode=view"); Response rspFormWithoutAspect = server.submitRequest( requestWithoutAspect.getMethod(), requestWithoutAspect.getFullUri(), requestWithoutAspect.getHeaders(), requestWithoutAspect.getBody(), requestWithoutAspect.getEncoding(), requestWithoutAspect.getType()); assertEquals( "The status of response is " + rspFormWithoutAspect.getStatus(), 200, rspFormWithoutAspect.getStatus()); String contentWithoutAspect = rspFormWithoutAspect.getContentAsString(); log.info( "Response form for node without aspect status is " + rspFormWithoutAspect.getStatus() + " content is " + contentWithoutAspect); assertNotNull("Response content for 'contentWithoutAspect' is null", contentWithoutAspect); assertFalse( "Return the following content: " + contentWithoutAspect, contentWithoutAspect.contains("My Set")); }