use of org.alfresco.util.PropertyMap in project alfresco-repository by Alfresco.
the class XmlMetadataExtracterTest method testEmptyFile.
public void testEmptyFile() throws Exception {
// Get an empty file
ContentReader reader = getReader(FILE_EMPTY);
assertTrue(reader.exists());
// Pass it to the extracter
PropertyMap checkProperties = new PropertyMap();
checkProperties.put(ContentModel.PROP_TITLE, getName());
xmlMetadataExtracter.extract(reader, checkProperties);
// The map should be unaffected
assertNotNull("Properties changed by empty file extraction", checkProperties.get(ContentModel.PROP_TITLE));
assertEquals("Properties changed by empty file extraction", getName(), checkProperties.get(ContentModel.PROP_TITLE));
}
use of org.alfresco.util.PropertyMap in project alfresco-repository by Alfresco.
the class XmlMetadataExtracterTest method testMalformedFile.
public void testMalformedFile() throws Exception {
// Get an empty file
ContentReader reader = getReader(FILE_MALFORMED);
assertTrue(reader.exists());
// Pass it to the extracter
PropertyMap checkProperties = new PropertyMap();
checkProperties.put(ContentModel.PROP_TITLE, getName());
xmlMetadataExtracter.extract(reader, checkProperties);
// The map should be unaffected
assertNotNull("Properties changed by malformed file extraction", checkProperties.get(ContentModel.PROP_TITLE));
assertEquals("Properties changed by malformed file extraction", getName(), checkProperties.get(ContentModel.PROP_TITLE));
}
use of org.alfresco.util.PropertyMap in project alfresco-repository by Alfresco.
the class XmlMetadataExtracterTest method testExtractEclipseProject.
public void testExtractEclipseProject() throws Exception {
// Load the example file
ContentReader reader = getReader(FILE_ECLIPSE_PROJECT);
assertTrue(reader.exists());
// Pass it to the extracter
PropertyMap checkProperties = new PropertyMap();
eclipseProjectMetadataExtracter.extract(reader, checkProperties);
// Check the values
assertEquals("Repository", getPropertyValue(checkProperties, ContentModel.PROP_TITLE));
assertEquals("JavaCC Nature", getPropertyValue(checkProperties, ContentModel.PROP_DESCRIPTION));
}
use of org.alfresco.util.PropertyMap in project alfresco-repository by Alfresco.
the class XmlMetadataExtracterTest method testXmlMetadataExtracter.
public void testXmlMetadataExtracter() throws Exception {
// Load the example files
ContentReader alfrescoModelReader = getReader(FILE_ALFRESCO_MODEL);
assertTrue(alfrescoModelReader.exists());
ContentReader eclipseProjectReader = getReader(FILE_ECLIPSE_PROJECT);
assertTrue(eclipseProjectReader.exists());
// Pass the Alfresco Model xml to the extractor
PropertyMap checkAlfrescoModelProperties = new PropertyMap();
xmlMetadataExtracter.extract(alfrescoModelReader, checkAlfrescoModelProperties);
// Check the values
assertEquals("Gavin Cornwell", getPropertyValue(checkAlfrescoModelProperties, ContentModel.PROP_AUTHOR));
assertEquals("fm:forummodel", getPropertyValue(checkAlfrescoModelProperties, ContentModel.PROP_TITLE));
assertEquals("Forum Model", getPropertyValue(checkAlfrescoModelProperties, ContentModel.PROP_DESCRIPTION));
// Pass the Eclipse Project xml to the extractor
PropertyMap checkEclipseProjectProperties = new PropertyMap();
xmlMetadataExtracter.extract(eclipseProjectReader, checkEclipseProjectProperties);
// Check the values
assertEquals("Repository", getPropertyValue(checkEclipseProjectProperties, ContentModel.PROP_TITLE));
assertEquals("JavaCC Nature", getPropertyValue(checkEclipseProjectProperties, ContentModel.PROP_DESCRIPTION));
}
use of org.alfresco.util.PropertyMap in project alfresco-repository by Alfresco.
the class CopyServiceImplTest method testALF11964_part2.
/**
* Tests copying a folder that contains both a checked-out node and its working copy.
*/
public void testALF11964_part2() {
IntegrityChecker integrityChecker = (IntegrityChecker) ctx.getBean("integrityChecker");
PropertyMap props = new PropertyMap();
// Need to create a potentially recursive node structure
props.put(ContentModel.PROP_NODE_UUID, "nodeOne");
NodeRef nodeOne = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTAINER, props).getChildRef();
props.put(ContentModel.PROP_NODE_UUID, "nodeTwo");
NodeRef nodeTwo = nodeService.createNode(nodeOne, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTENT, props).getChildRef();
props.put(ContentModel.PROP_NODE_UUID, "nodeThree");
NodeRef nodeThree = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTAINER, props).getChildRef();
cociService.checkout(nodeTwo);
copyService.copy(nodeOne, nodeThree, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, true);
integrityChecker.checkIntegrity();
}
Aggregations