Exemplo n.º 1
0
  private void checkVersionProperties(
      String docId,
      VersioningState versioningState,
      Map<String, PropertyData<?>> props,
      String checkinComment) {
    for (PropertyData<?> pd : props.values()) {
      log.info("return property id: " + pd.getId() + ", value: " + pd.getValues());
    }

    DocumentTypeDefinition typeDef =
        (DocumentTypeDefinition)
            fRepSvc.getTypeDefinition(
                fRepositoryId, VersionTestTypeSystemCreator.VERSION_TEST_DOCUMENT_TYPE_ID, null);
    PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_VERSION);
    assertNotNull(pdb);
    boolean bVal = pdb.getFirstValue();
    assertTrue(bVal);

    pdb = (PropertyBoolean) props.get(PropertyIds.IS_MAJOR_VERSION);
    assertNotNull(pdb);
    bVal = pdb.getFirstValue();
    assertEquals(versioningState == VersioningState.MAJOR, bVal);

    pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_MAJOR_VERSION);
    assertNotNull(pdb);
    bVal = pdb.getFirstValue();
    assertEquals(versioningState == VersioningState.MAJOR, bVal);

    PropertyId pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_ID);
    assertNotNull(pdid);
    String sVal = pdid.getFirstValue();
    //        if (typeDef.isVersionable())  // need not be
    //            assertFalse(docId.equals(sVal));
    //        else
    //            assertEquals(docId, sVal);

    pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
    assertNotNull(pdb);
    bVal = pdb.getFirstValue();
    assertEquals(versioningState == VersioningState.CHECKEDOUT, bVal);

    PropertyString pds = (PropertyString) props.get(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY);
    assertNotNull(pds);
    sVal = pds.getFirstValue();
    if (versioningState == VersioningState.CHECKEDOUT) {
      assertTrue(sVal != null && sVal.length() > 0);
    } else {
      assertTrue(null == sVal || sVal.equals(""));
    }

    pdid = (PropertyId) props.get(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID);
    assertNotNull(pdid);
    sVal = pdid.getFirstValue();
    if (versioningState == VersioningState.CHECKEDOUT) {
      assertTrue(sVal != null && sVal.length() > 0);
    } else {
      assertTrue(null == sVal || sVal.equals(""));
    }

    pds = (PropertyString) props.get(PropertyIds.CHECKIN_COMMENT);
    assertNotNull(pdb);
    sVal = pds.getFirstValue();
    if (checkinComment == null) {
      assertTrue(null == sVal);
    } else {
      assertEquals(checkinComment, sVal);
    }
  }
Exemplo n.º 2
0
 private static boolean isCheckedOut(Map<String, PropertyData<?>> props) {
   PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT);
   assertNotNull(pdb);
   boolean bVal = pdb.getFirstValue();
   return bVal;
 }