use of org.alfresco.repo.dictionary.DictionaryBootstrap in project alfresco-remote-api by Alfresco.
the class TestCMIS method testTypeFiltering.
/**
* ALF-18968
*
* @see QNameFilterImpl#listOfHardCodedExcludedTypes()
*/
@Test
public void testTypeFiltering() throws Exception {
// Force an exclusion in order to test the exclusion inheritance
cmisTypeExclusions.setExcluded(ActionModel.TYPE_ACTION_BASE, true);
// Quick check
assertTrue(cmisTypeExclusions.isExcluded(ActionModel.TYPE_ACTION_BASE));
// Test that a type defined with this excluded parent type does not break the CMIS dictionary
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("publicapi/test-model.xml");
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
bootstrap.setTenantService(tenantService);
bootstrap.bootstrap();
cmisDictionary.afterDictionaryInit();
final TestNetwork network1 = getTestFixture().getRandomNetwork();
String username = "user" + System.currentTimeMillis();
PersonInfo personInfo = new PersonInfo(username, username, username, TEST_PASSWORD, null, null, null, null, null, null, null);
TestPerson person1 = network1.createUser(personInfo);
String person1Id = person1.getId();
// test that this type is excluded; the 'action' model (act prefix) is in the list of hardcoded exclusions
QName type = QName.createQName("{http://www.alfresco.org/test/testCMIS}type1");
assertTrue(cmisTypeExclusions.isExcluded(type));
// and that we can't get to it through CMIS
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
try {
cmisSession.getTypeDefinition("D:testCMIS:type1");
fail("Type should not be available");
} catch (CmisObjectNotFoundException e) {
// ok
}
}
Aggregations