![JAR search and dependency download from the Maven repository](/logo.png)
org.alfresco.mock.test.MockNamespaceService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alfresco-tests Show documentation
Show all versions of alfresco-tests Show documentation
This is a jar project based on mock classes to test fastly the alfresco applications
The newest version!
package org.alfresco.mock.test;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.service.namespace.NamespaceException;
import org.alfresco.service.namespace.NamespaceService;
public class MockNamespaceService implements NamespaceService, Serializable {
private static Map prefixes = new HashMap();
@Override
public String getNamespaceURI(String prefix) throws NamespaceException {
return prefix != null && prefix.equals(NamespaceService.CONTENT_MODEL_PREFIX)
? NamespaceService.CONTENT_MODEL_1_0_URI
: prefixes.get(prefix);
}
@Override
public Collection getPrefixes(String namespaceURI) throws NamespaceException {
List results = new ArrayList();
for (String prefix : prefixes.keySet())
if (prefixes.get(prefix).equals(namespaceURI))
results.add(prefix);
return results;
}
@Override
public Collection getPrefixes() {
return prefixes.keySet();
}
@Override
public Collection getURIs() {
return prefixes.values();
}
@Override
public void registerNamespace(String prefix, String uri) {
prefixes.put(prefix, uri);
}
@Override
public void unregisterNamespace(String prefix) {
// TODO Auto-generated method stub
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy