use of org.eclipse.vorto.repository.core.IUserContext in project vorto by eclipse.
the class WorkflowTest method testApproveModelByAdminInReviewState.
@Test
public void testApproveModelByAdminInReviewState() throws Exception {
ModelInfo model = importModel("creator", "Color.type");
IUserContext creator = createUserContext("creator", PLAYGROUND);
IUserContext promoter = createUserContext("promoter", PLAYGROUND);
IUserContext reviewer = createUserContext("reviewer", 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(), reviewer).size());
model = workflow.doAction(model.getId(), reviewer, SimpleWorkflowModel.ACTION_APPROVE.getName());
assertEquals(1, workflow.getModelsByState(SimpleWorkflowModel.STATE_RELEASED.getName(), creator).size());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_IN_REVIEW.getName(), creator).size());
assertEquals(0, workflow.getModelsByState(SimpleWorkflowModel.STATE_DRAFT.getName(), creator).size());
assertEquals(0, workflow.getPossibleActions(model.getId(), creator).size());
}
use of org.eclipse.vorto.repository.core.IUserContext 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.IUserContext 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.IUserContext in project vorto by eclipse.
the class UserAccountServiceTest method testRemoveAccountWithModelsByUser.
@Test
public void testRemoveAccountWithModelsByUser() throws Exception {
IUserContext alex = createUserContext("alex");
IUserContext admin = createUserContext("admin");
this.workflow.start(importModel("Color.type", alex).getId(), alex);
this.workflow.start(importModel("Colorlight.fbmodel", alex).getId(), alex);
importModel("Switcher.fbmodel", admin);
importModel("ColorLightIM.infomodel", admin);
importModel("HueLightStrips.infomodel", admin);
assertEquals(2, getModelRepository(alex).search("author:" + alex.getUsername()).size());
userService.delete("alex", "alex");
assertEquals(0, getModelRepository(alex).search("author:" + alex.getUsername()).size());
assertEquals(2, getModelRepository(alex).search("author:anonymous").size());
}
use of org.eclipse.vorto.repository.core.IUserContext 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);
}
Aggregations