use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class WorkflowTest method testGetModelByState.
@Test
public void testGetModelByState() throws Exception {
IUserContext user = createUserContext("admin", PLAYGROUND);
ModelInfo model = importModel("Color.type");
workflow.start(model.getId(), user);
assertEquals(1, workflow.getModelsByState(SimpleWorkflowModel.STATE_DRAFT.getName(), user).size());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class WorkflowTest method testApproveModelByModelReviewerInReviewState.
@Test
public void testApproveModelByModelReviewerInReviewState() throws Exception {
ModelInfo model = importModel("creator", "Color.type");
IUserContext user = createUserContext("creator", PLAYGROUND);
IUserContext promoter = createUserContext("promoter", PLAYGROUND);
workflow.start(model.getId(), user);
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_APPROVE.getName());
assertEquals(1, workflow.getModelsByState(SimpleWorkflowModel.STATE_RELEASED.getName(), user).size());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), user).size());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_DRAFT.getName(), user).size());
assertEquals(0, workflow.getPossibleActions(model.getId(), user).size());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class ModelIdToModelContentConverterTest method setupTestDataForLatestTag.
private void setupTestDataForLatestTag() throws WorkflowException {
IUserContext user = createUserContext("alex", "playground");
ModelInfo color = importModel("Color.type");
ModelInfo color6 = importModel("Color6.type");
importModel("Color7.type");
importModel("sample.mapping");
color.setState(ModelState.Released.getName());
color6.setState(ModelState.Released.getName());
this.workflow.start(color.getId(), user);
this.workflow.start(color6.getId(), user);
setReleaseState(color);
setReleaseState(color6);
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class DependencyManagerTest method testDependentTypesWithFB.
@Test
public void testDependentTypesWithFB() {
ModelInfo subunit = create("Subunit", ModelType.Datatype);
ModelInfo unit = create("Unit", ModelType.Datatype, subunit);
ModelInfo temp = create("Temperature", ModelType.Datatype, unit);
ModelInfo fridge = create("Fridge", ModelType.Functionblock, temp);
dm.addResource(unit);
dm.addResource(subunit);
dm.addResource(temp);
dm.addResource(fridge);
assertEquals(subunit.getId(), dm.getSorted().get(0).getId());
assertEquals(unit.getId(), dm.getSorted().get(1).getId());
assertEquals(temp.getId(), dm.getSorted().get(2).getId());
assertEquals(fridge.getId(), dm.getSorted().get(3).getId());
}
use of org.eclipse.vorto.repository.core.ModelInfo in project vorto by eclipse.
the class DependencyManagerTest method testDependentTypesWithFB2.
@Test
public void testDependentTypesWithFB2() {
ModelInfo subunit = create("Subunit", ModelType.Datatype);
ModelInfo unit = create("Unit", ModelType.Datatype, subunit);
ModelInfo temp = create("Temperature", ModelType.Datatype, unit);
ModelInfo superFridge = create("SuperFridge", ModelType.Functionblock, temp);
ModelInfo fridge = create("Fridge", ModelType.Functionblock, superFridge);
dm.addResource(unit);
dm.addResource(subunit);
dm.addResource(temp);
dm.addResource(fridge);
dm.addResource(superFridge);
assertEquals(subunit.getId(), dm.getSorted().get(0).getId());
assertEquals(unit.getId(), dm.getSorted().get(1).getId());
assertEquals(temp.getId(), dm.getSorted().get(2).getId());
assertEquals(superFridge.getId(), dm.getSorted().get(3).getId());
assertEquals(fridge.getId(), dm.getSorted().get(4).getId());
}
Aggregations