Collection<IBatchArtifact> assertArtifactsByType(BatchArtifactType type) {
   Collection<IBatchArtifact> cs = batchProject.getArtifacts(type);
   assertFalse(cs.isEmpty());
   for (IBatchArtifact a : cs) {
     assertTrue(a.getArtifactType() == type);
   }
   return cs;
 }
 public void testBatchletNamedWithConstant() {
   IBatchArtifact b =
       assertArtifactByNameAndType("batchlet_named_with_constant", BatchArtifactType.BATCHLET);
   IBatchProperty p = b.getProperty("property_named_with_constant");
   assertNotNull(p);
   p = b.getProperty("PROP_NAME");
   assertNull(p);
 }
  IBatchArtifact assertArtifactByNameAndType(
      String name, BatchArtifactType type, boolean checkNamedDeclaration) {
    Collection<IBatchArtifact> cs = batchProject.getArtifacts(name);
    assertEquals(1, cs.size());

    IBatchArtifact b = cs.iterator().next();
    if (checkNamedDeclaration) {
      assertNotNull(b.getNamedDeclaration());
    }
    assertEquals(name, b.getName());
    assertTrue(b.getArtifactType() == type);
    return b;
  }
  public void testBatchlet() {
    assertArtifactsByType(BatchArtifactType.BATCHLET);

    IBatchArtifact b = assertArtifactByNameAndType("batchlet1", BatchArtifactType.BATCHLET);

    Collection<IBatchProperty> ps = b.getProperties();
    assertEquals(1, ps.size());
    IBatchProperty p = ps.iterator().next();
    assertEquals("worktime", p.getPropertyName());
    assertNotNull(p.getField());
    assertTrue(p.getArtifact() == b);
    assertNotNull(p.getInjectDeclaration());
    assertNotNull(p.getBatchPropertyDeclaration());
  }
 public void testBatchPropertyReferences() {
   IBatchArtifact b = assertArtifactByNameAndType("batchlet1", BatchArtifactType.BATCHLET);
   IBatchProperty p = b.getProperty("worktime");
   assertTextSourceReferences(p.getReferences(), p.getPropertyName());
 }
 public void testBatchArtifactReferences() {
   IBatchArtifact b = assertArtifactByNameAndType("batchlet1", BatchArtifactType.BATCHLET);
   assertTextSourceReferences(b.getReferences(), b.getName());
 }