Package org.activiti.engine.repository

Examples of org.activiti.engine.repository.Model


   
    repositoryService.deleteModel(model.getId());
  }
 
  public void testNewModelWithSource() throws Exception {
    Model model = repositoryService.newModel();
    model.setName("Test model");
    byte[] testSource = "modelsource".getBytes("utf-8");
    repositoryService.saveModel(model);
   
    assertNotNull(model.getId());
    repositoryService.addModelEditorSource(model.getId(), testSource);
   
    model = repositoryService.getModel(model.getId());
    assertNotNull(model);
    assertEquals("Test model", model.getName());
   
    byte[] editorSourceBytes = repositoryService.getModelEditorSource(model.getId());
    assertEquals("modelsource", new String(editorSourceBytes, "utf-8"));
   
    repositoryService.deleteModel(model.getId());
  }
View Full Code Here


   
    repositoryService.deleteModel(model.getId());
  }
 
  public void testUpdateModelPersistence() throws Exception {
    Model model = repositoryService.newModel();
    assertNotNull(model);
   
    model.setName("Test model");
    model.setCategory("test");
    model.setMetaInfo("meta");
    repositoryService.saveModel(model);
   
    assertNotNull(model.getId());
    model = repositoryService.getModel(model.getId());
    assertNotNull(model);
   
    model.setName("New name");
    model.setCategory("New category");
    model.setMetaInfo("test");
    model.setVersion(2);
    repositoryService.saveModel(model);
   
    assertNotNull(model.getId());
    repositoryService.addModelEditorSource(model.getId(), "new".getBytes("utf-8"));
    repositoryService.addModelEditorSourceExtra(model.getId(), "new".getBytes("utf-8"));
   
    model = repositoryService.getModel(model.getId());
   
    assertEquals("New name", model.getName());
    assertEquals("New category", model.getCategory());
    assertEquals("test", model.getMetaInfo());
    assertNotNull(model.getCreateTime());
    assertEquals(Integer.valueOf(2), model.getVersion());
    assertEquals("new", new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
    assertEquals("new", new String(repositoryService.getModelEditorSourceExtra(model.getId()), "utf-8"));
   
    repositoryService.deleteModel(model.getId());
  }
View Full Code Here

 
  private String modelOneId;
 
  @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();
  }
View Full Code Here

    repositoryService.deleteModel(modelOneId);
  }
 
  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());
  }
View Full Code Here

    assertEquals(1, query.count());
  }
 
  public void testQueryByName() throws Exception {
    ModelQuery query = repositoryService.createModelQuery().modelName("my 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());
  }
View Full Code Here

    assertEquals(0, query.count());
  }
 
  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());
  }
View Full Code Here

    assertEquals(0, query.count());
  }
 
  public void testQueryByKey() {
    ModelQuery query = repositoryService.createModelQuery().modelName("my model").modelKey("someKey");
    Model model = query.singleResult();
    assertNotNull(model);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

    assertEquals(1, query.count());
  }
 
  public void testQueryByNameAndKey() {
    ModelQuery query = repositoryService.createModelQuery().modelKey("someKey");
    Model model = query.singleResult();
    assertNotNull(model);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

   
    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());
View Full Code Here

    assertEquals(1, query.orderByModelKey().desc().count());
  }
 
  public void testByLatestVersion() {
    ModelQuery query = repositoryService.createModelQuery().latestVersion().modelKey("someKey");
    Model model = query.singleResult();
    assertNotNull(model);
   
    // Add a new version of the model
    Model newVersion = repositoryService.newModel();
    newVersion.setName("my model");
    newVersion.setKey("someKey");
    newVersion.setCategory("test");
    newVersion.setVersion(model.getVersion() + 1);
    repositoryService.saveModel(newVersion);
   
    // Verify query
    model = query.singleResult();
    assertNotNull(model);
View Full Code Here

TOP

Related Classes of org.activiti.engine.repository.Model

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.