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();
assertThat(repositoryService.createModelQuery().deploymentId(deployment.getId()).count()).isEqualTo(0);
assertThat(repositoryService.createModelQuery().deployed().count()).isEqualTo(0);
assertThat(repositoryService.createModelQuery().notDeployed().count()).isEqualTo(1);
Model model = repositoryService.createModelQuery().singleResult();
model.setDeploymentId(deployment.getId());
repositoryService.saveModel(model);
assertThat(repositoryService.createModelQuery().deploymentId(deployment.getId()).count()).isEqualTo(1);
assertThat(repositoryService.createModelQuery().deployed().count()).isEqualTo(1);
assertThat(repositoryService.createModelQuery().notDeployed().count()).isEqualTo(0);
// Cleanup
repositoryService.deleteDeployment(deployment.getId(), true);
// After cleanup the model should still exist
assertThat(repositoryService.createDeploymentQuery().count()).isEqualTo(0);
assertThat(repositoryService.createModelQuery().deploymentId(deployment.getId()).count()).isEqualTo(0);
assertThat(repositoryService.createModelQuery().notDeployed().count()).isEqualTo(1);
assertThat(repositoryService.createModelQuery().count()).isEqualTo(1);
}
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();
assertThat(model).isNotNull();
assertThat(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")).isEqualTo("bytes");
assertThat(query.list()).hasSize(1);
assertThat(query.count()).isEqualTo(1);
}
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 testQueryByKey.
public void testQueryByKey() {
ModelQuery query = repositoryService.createModelQuery().modelName("my model").modelKey("someKey");
Model model = query.singleResult();
assertThat(model).isNotNull();
assertThat(query.list()).hasSize(1);
assertThat(query.count()).isEqualTo(1);
}
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();
assertThat(model.getId()).isNotNull();
assertThat(model.getCategory()).isNotNull();
assertThat(model.getKey()).isNotNull();
assertThat(model.getName()).isNotNull();
assertThat(model.getVersion()).isNotNull();
assertThat(model.getCreateTime()).isNotNull();
assertThat(model.getLastUpdateTime()).isNotNull();
}
Aggregations