use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class WorkflowTest method testApproveModelByUserInReviewState.
@Test(expected = WorkflowException.class)
public void testApproveModelByUserInReviewState() throws Exception {
ModelInfo model = importModel("creator", "Color.type");
IUserContext creator = createUserContext("creator", PLAYGROUND);
workflow.start(model.getId(), creator);
model = workflow.doAction(model.getId(), createUserContext("promoter", PLAYGROUND), SimpleWorkflowModel.ACTION_RELEASE.getName());
assertEquals(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), model.getState());
model = workflow.doAction(model.getId(), creator, SimpleWorkflowModel.ACTION_APPROVE.getName());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class WorkflowTest method testStartReviewProcessForModel.
@Test
public void testStartReviewProcessForModel() throws Exception {
ModelInfo model = importModel("creator", "Color.type");
IUserContext user = createUserContext("creator", PLAYGROUND);
workflow.start(model.getId(), user);
model = workflow.doAction(model.getId(), createUserContext("promoter", PLAYGROUND), SimpleWorkflowModel.ACTION_RELEASE.getName());
assertEquals(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), model.getState());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_DRAFT.getName(), user).size());
assertEquals(1, workflow.getModelsByState(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), user).size());
assertEquals(1, workflow.getPossibleActions(model.getId(), createUserContext("promoter", PLAYGROUND)).size());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class WorkflowTest method testRejectModelByModelReviewerInReviewState.
@Test
public void testRejectModelByModelReviewerInReviewState() throws Exception {
ModelInfo model = importModel("creator", "Color.type");
IUserContext creator = createUserContext("creator", PLAYGROUND);
IUserContext promoter = createUserContext("promoter", PLAYGROUND);
workflow.start(model.getId(), creator);
model = workflow.doAction(model.getId(), promoter, SimpleWorkflowModel.ACTION_RELEASE.getName());
assertEquals(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), model.getState());
assertEquals(1, workflow.getPossibleActions(model.getId(), promoter).size());
assertEquals(2, workflow.getPossibleActions(model.getId(), createUserContext("reviewer", PLAYGROUND)).size());
model = workflow.doAction(model.getId(), createUserContext("reviewer", PLAYGROUND), SimpleWorkflowModel.ACTION_REJECT.getName());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_RELEASED.getName(), creator).size());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), creator).size());
assertEquals(1, workflow.getModelsByState(SimpleWorkflowModel.STATE_DRAFT.getName(), creator).size());
assertEquals(1, workflow.getPossibleActions(model.getId(), promoter).size());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class ModelImporterTest method testImportModelPreserveOriginalNamespace.
@Test
public void testImportModelPreserveOriginalNamespace() throws Exception {
IUserContext alex = createUserContext("alex", "playground");
UploadModelResult uploadResult = this.importer.upload(FileUpload.create("Color.type", IOUtils.toByteArray(new ClassPathResource("sample_models/org.eclipse.vorto.tutorial.type").getInputStream())), Context.create(alex, Optional.of("org.eclipse.vorto")));
assertEquals(true, uploadResult.isValid());
List<ModelInfo> imported = this.importer.doImport(uploadResult.getHandleId(), Context.create(alex, Optional.of("org.eclipse.vorto")));
assertEquals(1, imported.size());
assertEquals("org.eclipse.vorto.tutorial", imported.get(0).getId().getNamespace());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class ModelImporterTest method testImportModelWithConversionNamespace.
@Test
public void testImportModelWithConversionNamespace() throws Exception {
IUserContext alex = createUserContext("alex", "playground");
UploadModelResult uploadResult = this.importer.upload(FileUpload.create("Color.type", IOUtils.toByteArray(new ClassPathResource("sample_models/vortoprivateColor.type").getInputStream())), Context.create(alex, Optional.of("org.eclipse.vorto")));
assertEquals(true, uploadResult.isValid());
List<ModelInfo> imported = this.importer.doImport(uploadResult.getHandleId(), Context.create(alex, Optional.of("org.eclipse.vorto")));
assertEquals(1, imported.size());
assertEquals("org.eclipse.vorto.vorto.private.alex", imported.get(0).getId().getNamespace());
}
Aggregations