public void serializeDeserializeEPJob() {
try {
CNSMessage p1 = CNSMessageTest.getMessage("test", null, "test", "test-arn", "test-pub-userId");
CNSEndpointPublishJob.CNSEndpointSubscriptionInfo subInfo = new CNSEndpointPublishJob.CNSEndpointSubscriptionInfo(CnsSubscriptionProtocol.cqs, "test-endpoint1", "test-sub-arn", false);
CNSEndpointPublishJob j1 = new CNSEndpointPublishJob(p1, Arrays.asList(subInfo));
String str = j1.serialize();
CNSEndpointPublishJob rec = CNSEndpointPublishJob.parseInstance(str);
if (!j1.equals(rec)) {
fail("orig != rec. orig=" + j1 + " rec=" + rec);
}
//test with no subs
j1 = new CNSEndpointPublishJob(p1, new LinkedList<CNSEndpointPublishJob.CNSEndpointSubscriptionInfo>());
str = j1.serialize();
rec = CNSEndpointPublishJob.parseInstance(str);
if (!j1.equals(rec)) {
fail("orig != rec. orig=" + j1 + " rec=" + rec);
}
//test with no subject
p1 = CNSMessageTest.getMessage("test", null, null, "test-arn", "test-pub-userId");
j1 = new CNSEndpointPublishJob(p1, Arrays.asList(subInfo));
str = j1.serialize();
rec = CNSEndpointPublishJob.parseInstance(str);
if (!j1.equals(rec)) {
fail("orig != rec. orig=" + j1 + " rec=" + rec);
}