Search in sources :

Example 36 with Model

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();
}
Also used : Model(org.activiti.engine.repository.Model)

Example 37 with Model

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());
}
Also used : Model(org.activiti.engine.repository.Model) Deployment(org.activiti.engine.repository.Deployment)

Example 38 with Model

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());
}
Also used : Model(org.activiti.engine.repository.Model)

Example 39 with Model

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());
}
Also used : Model(org.activiti.engine.repository.Model) ModelQuery(org.activiti.engine.repository.ModelQuery)

Example 40 with Model

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());
}
Also used : Model(org.activiti.engine.repository.Model) ModelQuery(org.activiti.engine.repository.ModelQuery)

Aggregations

Model (org.activiti.engine.repository.Model)49 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)12 ModelQuery (org.activiti.engine.repository.ModelQuery)9 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 Calendar (java.util.Calendar)6 Deployment (org.activiti.engine.test.Deployment)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 InputStream (java.io.InputStream)5 HttpGet (org.apache.http.client.methods.HttpGet)5 HttpPut (org.apache.http.client.methods.HttpPut)5 BpmnModel (org.activiti.bpmn.model.BpmnModel)4 ActivitiException (org.activiti.engine.ActivitiException)4 StringEntity (org.apache.http.entity.StringEntity)4 Button (com.vaadin.ui.Button)3 ClickEvent (com.vaadin.ui.Button.ClickEvent)3 ClickListener (com.vaadin.ui.Button.ClickListener)3 HorizontalLayout (com.vaadin.ui.HorizontalLayout)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3