Package org.martinlaw.bo

Examples of org.martinlaw.bo.Type


  private Logger log = Logger.getLogger(getClass());
 
  @Test
  public void testCaseStatusMaintenanceRouting() throws WorkflowException {
    //testTransactionalRouting("CaseStatusMaintenanceDocument");
    Type status = new Status();
    String statusText = "deadlock";
    status.setName(statusText);
    Scope statusScope = new Scope();
    statusScope.setQualifiedClassName("org.martinlaw.Aclass");
    status.getScope().add(statusScope);
    try {
      testMaintenanceRoutingInitToFinal(getDocTypeName(), status);
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("name", statusText);
      Collection<Status> result = KRADServiceLocator.getBusinessObjectService().findMatching(Status.class, params);
View Full Code Here


    super();
  }

  @Test
  public void testBaseDetailRouting() throws InstantiationException, IllegalAccessException {
    Type type = getDataObject();
    try {
      testMaintenanceRoutingInitToFinal(getDocTypeName(), type);
    } catch (Exception e) {
      log .error("test failed", e);
      fail("test routing " + getDocTypeName() + " caused an exception");
    }
    // confirm that BO was saved to DB
    Map<String, String> params = new HashMap<String, String>();
    params.put("name", type.getName());
    Collection<? extends Type> result = getBoSvc().findMatching(getDataObjectClass(), params);
    assertEquals(1, result.size());
  }
View Full Code Here

   * @return a populated data object
   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  protected Type getDataObject() throws InstantiationException, IllegalAccessException {
    Type type = getDataObjectClass().newInstance();
    String name = "resale agreement";
    type.setName(name);
    return type;
  }
View Full Code Here

   * @throws WorkflowException
   */
  @Test
  public void testBaseDetailRoutingDocSearch() throws WorkflowException,
    InstantiationException, IllegalAccessException {
    Type type = getDataObjectClass().newInstance();
    type.setName("permanent for testing purposes");
    final String docType = getDocTypeName();
    testMaintenanceRoutingInitToFinal(docType, type);
   
    Type type2 = getDataObjectClass().newInstance();
    type2.setName("supply of rain and shine");
    testMaintenanceRoutingInitToFinal(docType, type2);
   
    // no document criteria given, so both documents should be found
    SearchTestCriteria crit1 = new SearchTestCriteria();
    crit1.setExpectedDocuments(2);
View Full Code Here

   */
  public void testStatusRetrieve() {
    List<Status> caseStatuses = (List<Status>) getBoSvc().findAll(Status.class);
    assertNotNull("default status list should not be null", caseStatuses);
    assertEquals("number of default statuses differs", 5, caseStatuses.size());
    Type status = getBoSvc().findBySinglePrimaryKey(Status.class, new Long(10035));
    assertNotNull("status should not be null", status);
    assertEquals("status text differs", "closed", status.getName());
    assertTrue("no scope has been set", status.getScope().isEmpty());
   
    testRetrievedScopedStatus(new Long(10034), "hearing", 1,  CourtCase.class.getCanonicalName());
    testRetrievedScopedStatus(new Long(10036), "documents missing", 2, Conveyance.class.getCanonicalName());
  }
View Full Code Here

   * @param scopeSize - the size of scope list
   * @param firstScopeCanonicalName - the qualified class name to expect in the first scope
   */
  public void testRetrievedScopedStatus(final Long primaryKey, final String statusText, final int scopeSize,
      final String firstScopeCanonicalName) {
    Type status;
    status = getBoSvc().findBySinglePrimaryKey(Status.class, primaryKey);
    assertEquals("status text differs", statusText, status.getName());
    assertFalse("status scope has been set", status.getScope().isEmpty());
    assertEquals("scope size differs", scopeSize, status.getScope().size());
    assertEquals("status first scope class name differs", firstScopeCanonicalName,
        status.getScope().get(0).getQualifiedClassName());
  }
View Full Code Here

   
  }

  @Override
  public Type getExpectedOnRetrieve() {
    Type status = new Status();
    status.setName("adjourned");
    status.setId(10037l);
   
    return status;
  }
View Full Code Here

   * @throws InstantiationException
   * @throws IllegalAccessException
   */
  @Test(expected = DataIntegrityViolationException.class)
  public void testTypeNullableFields() throws InstantiationException, IllegalAccessException {
    Type type = getDataObjectClass().newInstance();
    getBoSvc().save(type);
  }
View Full Code Here

   * tests retrieving a BO
   */
  @Test
  public void testTypeRetrieve() {
    // retrieve object populated via sql script
    Type type = getBoSvc().findBySinglePrimaryKey(
        getDataObjectClass(), getExpectedOnRetrieve().getId());
    assertNotNull("retrieved '" + getDataObjectClass() + "' should not be null", type);
    assertEquals("name differs", getExpectedOnRetrieve().getName(), type.getName());
    assertEquals("description differs", getExpectedOnRetrieve().getDescription(), type.getDescription());
    additionalTestsForRetrievedObject(type);
  }
View Full Code Here

   * @throws InstantiationException
   */
  @Test
  public void testTypeCRUD() throws InstantiationException, IllegalAccessException {
    // C
    Type type = getDataObjectClass().newInstance();
    String name = "test type";
    type.setName(name);
    populateAdditionalFieldsForCrud(type);
    getBoSvc().save(type);
   
    // R
    type.refresh();
    assertEquals("name does not match", name, type.getName());
    // save scope and see if it can be seen from the base detail/type side
    boolean scopeAdded = false;
    if (ScopedKeyValue.class.isAssignableFrom(getDataObjectClass())) {
      Scope scope = getScopeClass().newInstance();
      final String qualifiedClassName = Matter.class.getCanonicalName();
      scope.setQualifiedClassName(qualifiedClassName);
      scope.setTypeId(type.getId());
      getBoSvc().save(scope);
     
      type.refresh();
      ScopedKeyValue scoped = (ScopedKeyValue)type;
      assertNotNull("scope should not be null", scoped.getScope());
      assertFalse("scope should not be empty", scoped.getScope().isEmpty());
      assertEquals("qualified class name differs", qualifiedClassName, scoped.getScope().get(0).getQualifiedClassName());
      // insert boolean to indicate that a scope has been set, to be used at the delete section below
      scopeAdded = true;
    }
    testCrudCreated(type);
   
    // U
    type.setDescription("test description");
    type.refresh();
    assertNotNull("description should not be null", type.getDescription());
    // D
    getBoSvc().delete(type);
    assertNull(getBoSvc().findBySinglePrimaryKey(getDataObjectClass(),  type.getId()));
    if (scopeAdded) {
      Map<String, String> criteria = new HashMap<String, String>();
      criteria.put("typeId", String.valueOf(type.getId()));
      assertTrue("scope should have been deleted", getBoSvc().findMatching(Scope.class, criteria).isEmpty());
    }
    testCrudDeleted(type);
  }
View Full Code Here

TOP

Related Classes of org.martinlaw.bo.Type

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.