use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.
the class ModelQueryTest method testQueryByInvalidName.
public void testQueryByInvalidName() {
ModelQuery query = repositoryService.createModelQuery().modelName("invalid");
assertThat(query.singleResult()).isNull();
assertThat(query.list()).hasSize(0);
assertThat(query.count()).isEqualTo(0);
}
use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.
the class ModelQueryEscapeClauseTest method testQueryByNameLike.
public void testQueryByNameLike() throws Exception {
ModelQuery query = repositoryService.createModelQuery().modelNameLike("%\\%%");
Model model = query.singleResult();
assertThat(model).isNotNull();
assertThat(model.getKey()).isEqualTo("someKey1");
assertThat(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")).isEqualTo("bytes");
assertThat(query.list()).hasSize(1);
assertThat(query.count()).isEqualTo(1);
query = repositoryService.createModelQuery().modelNameLike("%\\_%");
model = query.singleResult();
assertThat(model).isNotNull();
assertThat(model.getKey()).isEqualTo("someKey2");
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.ModelQuery in project Activiti by Activiti.
the class ModelQueryTest method testQueryByCategoryLike.
public void testQueryByCategoryLike() {
ModelQuery query = repositoryService.createModelQuery().modelCategoryLike("%te%");
assertThat(query.list()).hasSize(1);
assertThat(query.count()).isEqualTo(1);
}
use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.
the class ModelQueryTest method testByInvalidDeploymentId.
public void testByInvalidDeploymentId() {
ModelQuery query = repositoryService.createModelQuery().deploymentId("invalid");
assertThat(query.singleResult()).isNull();
assertThat(query.count()).isEqualTo(0);
}
use of org.activiti.engine.repository.ModelQuery 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);
}
Aggregations