use of org.activiti.engine.repository.Model in project Activiti by Activiti.
the class ModelQueryTest method setUp.
@Override
protected void setUp() throws Exception {
Model model = repositoryService.newModel();
model.setName("my model");
model.setKey("someKey");
model.setCategory("test");
repositoryService.saveModel(model);
modelOneId = model.getId();
repositoryService.addModelEditorSource(modelOneId, "bytes".getBytes("utf-8"));
super.setUp();
}
use of org.activiti.engine.repository.Model in project Activiti by Activiti.
the class ModelQueryTest method testByDeploymentId.
public void testByDeploymentId() {
Deployment deployment = repositoryService.createDeployment().addString("test", "test").deploy();
assertEquals(0, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
assertEquals(0, repositoryService.createModelQuery().deployed().count());
assertEquals(1, repositoryService.createModelQuery().notDeployed().count());
Model model = repositoryService.createModelQuery().singleResult();
model.setDeploymentId(deployment.getId());
repositoryService.saveModel(model);
assertEquals(1, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
assertEquals(1, repositoryService.createModelQuery().deployed().count());
assertEquals(0, repositoryService.createModelQuery().notDeployed().count());
// Cleanup
repositoryService.deleteDeployment(deployment.getId(), true);
// After cleanup the model should still exist
assertEquals(0, repositoryService.createDeploymentQuery().count());
assertEquals(0, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
assertEquals(1, repositoryService.createModelQuery().notDeployed().count());
assertEquals(1, repositoryService.createModelQuery().count());
}
use of org.activiti.engine.repository.Model in project Activiti by Activiti.
the class ModelQueryTest method testVerifyModelProperties.
public void testVerifyModelProperties() {
List<Model> models = repositoryService.createModelQuery().orderByModelName().asc().list();
Model modelOne = models.get(0);
assertEquals("my model", modelOne.getName());
assertEquals(modelOneId, modelOne.getId());
models = repositoryService.createModelQuery().modelNameLike("%model%").orderByModelName().asc().list();
assertEquals("my model", models.get(0).getName());
assertEquals(1, models.size());
assertEquals(1, repositoryService.createModelQuery().orderByModelId().asc().list().size());
}
use of org.activiti.engine.repository.Model in project Activiti by Activiti.
the class ModelQueryTest method testQueryByNameLike.
public void testQueryByNameLike() throws Exception {
ModelQuery query = repositoryService.createModelQuery().modelNameLike("%model%");
Model model = query.singleResult();
assertNotNull(model);
assertEquals("bytes", new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
use of org.activiti.engine.repository.Model in project Activiti by Activiti.
the class ModelQueryTest method testModelProperties.
public void testModelProperties() {
ModelQuery query = repositoryService.createModelQuery();
Model model = query.singleResult();
assertNotNull(model.getId());
assertNotNull(model.getCategory());
assertNotNull(model.getKey());
assertNotNull(model.getName());
assertNotNull(model.getVersion());
assertNotNull(model.getCreateTime());
assertNotNull(model.getLastUpdateTime());
}
Aggregations