Skip to content
Permalink
Browse files
JUDDI-907 test cases added
  • Loading branch information
spyhunter99 committed Jan 9, 2015
1 parent 9be9a86 commit d63e9c19c71136e4c14046a07d1325b8e35b793a
Showing 2 changed files with 65 additions and 0 deletions.
@@ -87,6 +87,7 @@
import org.apache.juddi.v3.error.ErrorMessage;
import org.apache.juddi.v3.error.FatalErrorException;
import org.apache.juddi.v3.error.InvalidKeyPassedException;
import org.apache.juddi.v3.error.InvalidValueException;
import org.apache.juddi.v3.error.UserMismatchException;
import org.apache.juddi.v3_service.JUDDIApiPortType;
import org.apache.juddi.validation.ValidateClerk;
@@ -1535,9 +1536,18 @@ public void adminSaveSubscription(String authInfo, String publisherOrUsername, H

}

/**
* {@inheritDoc }
* @param body
* @return item history or null if not found
* @throws DispositionReportFaultMessage
* @throws RemoteException
*/
@Override
public GetEntityHistoryMessageResponse getEntityHistory(GetEntityHistoryMessageRequest body) throws DispositionReportFaultMessage, RemoteException {
long startTime = System.currentTimeMillis();
if (body==null)
throw new InvalidValueException(new ErrorMessage("errors.NullInput"));
EntityManager em = PersistenceManager.getEntityManager();
EntityTransaction tx = em.getTransaction();
try {
@@ -26,6 +26,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.juddi.Registry;
import org.apache.juddi.api_v3.GetEntityHistoryMessageRequest;
import org.apache.juddi.api_v3.GetEntityHistoryMessageResponse;
import org.apache.juddi.jaxb.PrintUDDI;
import org.apache.juddi.v3.client.UDDIConstants;
import org.apache.juddi.v3.client.config.UDDIClient;
@@ -71,6 +73,7 @@
import org.uddi.api_v3.TModel;
import org.uddi.api_v3.TModelDetail;
import org.uddi.api_v3.TModelList;
import org.uddi.v3_service.DispositionReportFaultMessage;
import org.uddi.v3_service.UDDIInquiryPortType;
import org.uddi.v3_service.UDDIPublicationPortType;
import org.uddi.v3_service.UDDISecurityPortType;
@@ -1354,4 +1357,56 @@ public void JUDDI_716_SaveBusinessWithSignatureX509IssuerSerial() throws Certifi
Assert.fail("unexpected failure");
}
}

@Test(expected = DispositionReportFaultMessage.class)
public void testJUDDI907_ChangeHistory() throws Exception{
JUDDIApiImpl j = new JUDDIApiImpl();
j.getEntityHistory(null);
Assert.fail();
}
@Test(expected = DispositionReportFaultMessage.class)
public void testJUDDI907_ChangeHistory1() throws Exception{
JUDDIApiImpl j = new JUDDIApiImpl();
j.getEntityHistory(new GetEntityHistoryMessageRequest());
Assert.fail();
}

@Test(expected = DispositionReportFaultMessage.class)
public void testJUDDI907_ChangeHistory2() throws Exception{
JUDDIApiImpl j = new JUDDIApiImpl();
GetEntityHistoryMessageRequest r = new GetEntityHistoryMessageRequest();
r.setEntityKey(TckBusiness.JOE_BUSINESS_KEY);
j.getEntityHistory(r);
Assert.fail();
}

@Test
public void testJUDDI907_ChangeHistory3() throws Exception{
TckBusiness tb = new TckBusiness(publication, inquiry);
tb.saveJoePublisherBusiness(authInfoJoe);
JUDDIApiImpl j = new JUDDIApiImpl();
GetEntityHistoryMessageRequest r = new GetEntityHistoryMessageRequest();
r.setEntityKey(TckBusiness.JOE_BUSINESS_KEY);
r.setAuthInfo(authInfoJoe);
GetEntityHistoryMessageResponse entityHistory = j.getEntityHistory(r);
tb.deleteJoePublisherBusiness(authInfoJoe);
Assert.assertNotNull(entityHistory);
Assert.assertNotNull(entityHistory.getChangeRecords());
Assert.assertFalse(entityHistory.getChangeRecords().getChangeRecord().isEmpty());
}

@Test(expected = DispositionReportFaultMessage.class)
public void testJUDDI907_ChangeHistory4() throws Exception{

JUDDIApiImpl j = new JUDDIApiImpl();
GetEntityHistoryMessageRequest r = new GetEntityHistoryMessageRequest();
r.setEntityKey(UUID.randomUUID().toString());
r.setAuthInfo(authInfoJoe);
GetEntityHistoryMessageResponse entityHistory = j.getEntityHistory(r);
Assert.assertNotNull(entityHistory);
Assert.assertNotNull(entityHistory.getChangeRecords());
Assert.assertTrue(entityHistory.getChangeRecords().getChangeRecord().isEmpty());

}

}

0 comments on commit d63e9c1

Please sign in to comment.