@Test public void testListTypesAspects_Empty() throws Exception { final String modelName = makeUniqueName("testCustomModel"); Pair<String, String> namespacePair = getTestNamespacePrefixPair(); final M2Model model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName); model.createNamespace(namespacePair.getFirst(), namespacePair.getSecond()); createModel(model, false); // Retrieve the created model CustomModelDefinition modelDefinition = getModel(modelName); assertNotNull(modelDefinition); assertEquals(modelName, modelDefinition.getName().getLocalName()); // List all of the model's types Collection<TypeDefinition> types = modelDefinition.getTypeDefinitions(); assertEquals(0, types.size()); // List all of the model's aspects Collection<AspectDefinition> aspects = modelDefinition.getAspectDefinitions(); assertEquals(0, aspects.size()); }
@Test public void testCreateDownload() throws Exception final String modelName = makeUniqueName("testDownloadCustomModel"); final String modelExportFileName = modelName + ".xml"; final String shareExtExportFileName = "CMM_" + modelName + "_module.xml";
@Test public void testCreateBasicInactiveModel() throws Exception final String modelName1 = makeUniqueName("testCustomModel1"); final String desc = "This is test custom model desc"; assertEquals("John Doe", modelDefinition.getAuthor()); final String modelName2 = makeUniqueName("testCustomModel2"); model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName2); model.createNamespace(namespacePair.getFirst(), "newTestPrefix"); final String modelName3 = makeUniqueName("testCustomModel3"); model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName3); model.createNamespace(getTestNamespacePrefixPair().getFirst(), namespacePair.getSecond());
@Test public void testCreateModelWithTypesAndAspects() throws Exception String modelName = makeUniqueName("testCustomModelFailed"); Pair<String, String> namespacePair = getTestNamespacePrefixPair(); M2Model model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName);
@Test public void testisNamespaceUriExists() { final String modelName = makeUniqueName("testCustomModel"); final Pair<String, String> namespacePair = getTestNamespacePrefixPair(); M2Model model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName); model.createNamespace(namespacePair.getFirst(), namespacePair.getSecond()); model.setAuthor("John Doe"); assertNull(customModelService.getCustomModelByUri(namespacePair.getFirst())); // Create the model CustomModelDefinition modelDefinition = createModel(model, false); assertNotNull(modelDefinition); assertEquals(modelName, modelDefinition.getName().getLocalName()); ModelDefinition modelDefinitionByUri = transactionHelper.doInTransaction(new RetryingTransactionCallback<ModelDefinition>() { @Override public ModelDefinition execute() throws Throwable { assertTrue(customModelService.isNamespaceUriExists(namespacePair.getFirst())); return customModelService.getCustomModelByUri(namespacePair.getFirst()); } }); assertNotNull(modelDefinitionByUri); assertEquals(modelName, modelDefinitionByUri.getName().getLocalName()); }
@Test public void testDeactivateModel() throws Exception final String modelName = makeUniqueName("testDeactivateCustomModel"); final String desc = "This is test custom model desc";
@Test public void testDeleteModel() throws Exception final String modelName = makeUniqueName("testDeleteCustomModel");
@Test public void testActivateModel() throws Exception final String modelName = makeUniqueName("testCustomModel"); final String desc = "This is test custom model desc";
@Test public void testUpdateModel() throws Exception final String modelName = makeUniqueName("testUpdateCustomModel"); final String desc = "This is test custom model desc";
final String modelName = makeUniqueName("testCustomModelsInfo"); Pair<String, String> namespacePair = getTestNamespacePrefixPair(); M2Model model = M2Model.createModel(namespacePair.getSecond() + QName.NAMESPACE_PREFIX + modelName);