import org.junit.Test;
import org.mockito.Mockito;
import org.onap.aai.AAISetup;
-import org.onap.aai.dmaap.AAIDmaapEventJMSProducer;
import org.onap.aai.domain.notificationEvent.NotificationEvent.EventHeader;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.AAIKafkaEventJMSProducer;
public class StoreNotificationEventTest extends AAISetup {
- private static AAIDmaapEventJMSProducer producer;
+ private static AAIKafkaEventJMSProducer producer;
private static StoreNotificationEvent sne;
@BeforeClass
public static void setUp() {
- producer = Mockito.mock(AAIDmaapEventJMSProducer.class);
+ producer = Mockito.mock(AAIKafkaEventJMSProducer.class);
// sne = new StoreNotificationEvent(producer, "transiationId", "sourceOfTruth");
}
@Before
public void setUpBefore() {
- producer = Mockito.mock(AAIDmaapEventJMSProducer.class);
+ producer = Mockito.mock(AAIKafkaEventJMSProducer.class);
sne = new StoreNotificationEvent(producer, "transiationId", "sourceOfTruth");
}
@Test(expected = AAIException.class)
public void testStoreEventNullObj() throws AAIException {
- sne.storeEvent(new EventHeader(), null);
+ sne.storeEventAndSendToJms(new EventHeader(), null);
}
@Test(expected = AAIException.class)
public void testStoreEventInvalidObjForPojoUtils() throws AAIException {
- sne.storeEvent(new EventHeader(), new Object());
+ sne.storeEventAndSendToJms(new EventHeader(), new Object());
}
@Test
public void testStoreEventEmptyEventHeader()
throws AAIException, JsonGenerationException, JsonMappingException, IOException {
JsonObject object = Json.createObjectBuilder().add("hello", "world").build();
- String res = sne.storeEvent(new EventHeader(), object);
+ String res = sne.storeEventAndSendToJms(new EventHeader(), object);
assertNotNull(res);
assertTrue(res.contains("\"cambria.partition\" : \"" + AAIConstants.UEB_PUB_PARTITION_AAI + "\""));
eh.setSeverity("ALERT");
eh.setVersion("v12");
- String res = sne.storeEvent(eh, object);
+ String res = sne.storeEventAndSendToJms(eh, object);
assertNotNull(res);
assertTrue(res.contains("\"cambria.partition\" : \"" + AAIConstants.UEB_PUB_PARTITION_AAI + "\""));
@Test(expected = AAIException.class)
public void testStoreEventIntrospectorNullObj() throws Exception {
Loader loader = Mockito.mock(Loader.class);
- sne.storeEvent(loader, null, null);
+ sne.storeEventAndSendToJms(loader, null, null);
}
@Ignore("Stopped working since the model driven story")
eventHeader.setValue("severity", "ALERT");
eventHeader.setValue("version", "v12");
Introspector obj = loader.introspectorFromName("notification-event");
- String res = sne.storeEvent(loader, eventHeader, obj);
+ String res = sne.storeEventAndSendToJms(loader, eventHeader, obj);
assertNotNull(res);
assertTrue(res.contains("\"cambria.partition\":\"" + AAIConstants.UEB_PUB_PARTITION_AAI + "\""));
Introspector eventHeader = loader.introspectorFromName("notification-event-header");
Introspector obj = loader.introspectorFromName("notification-event");
- String res = sne.storeEvent(loader, eventHeader, obj);
+ String res = sne.storeEventAndSendToJms(loader, eventHeader, obj);
assertNotNull(res);
assertTrue(res.contains("\"cambria.partition\":\"" + AAIConstants.UEB_PUB_PARTITION_AAI + "\""));