コード例 #1
0
  @Test
  public void testVersioning() throws Exception {
    ProtocolDocument protocolDocument = ProtocolFactory.createProtocolDocument();
    ProtocolDocument newProtocolDocument =
        (ProtocolDocument) protocolVersionService.versionProtocolDocument(protocolDocument);
    assertNotNull(newProtocolDocument);
    assertTrue(
        !StringUtils.equals(
            protocolDocument.getDocumentNumber(), newProtocolDocument.getDocumentNumber()));
    assertTrue(
        (protocolDocument.getProtocol().getSequenceNumber() + 1
            == newProtocolDocument.getProtocol().getSequenceNumber()));
    assertFalse(protocolDocument.getProtocol().isActive());
    assertTrue(newProtocolDocument.getProtocol().isActive());

    List<DocumentNextvalue> nextValues = newProtocolDocument.getDocumentNextvalues();
    for (DocumentNextvalue nextValue : nextValues) {
      assertEquals(nextValue.getDocumentKey(), newProtocolDocument.getDocumentNumber());
    }
  }
  protected void populateDocumentOverview(
      Protocol protocol, ProposalDevelopmentDocument proposalDocument) {
    ProtocolDocument protocolDocument = (ProtocolDocument) protocol.getProtocolDocument();
    DocumentHeader proposalDocumentHeader = proposalDocument.getDocumentHeader();
    DocumentHeader protocolDocumentHeader = protocolDocument.getDocumentHeader();

    proposalDocumentHeader.setDocumentDescription(
        "PD - " + protocolDocumentHeader.getDocumentDescription());
    proposalDocumentHeader.setExplanation(
        "Document created from Protocol - " + protocolDocument.getDocumentNumber());
    proposalDocumentHeader.setOrganizationDocumentNumber(
        protocolDocumentHeader.getOrganizationDocumentNumber());
  }