package org.onap.aai.rest.ueb;
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.AAISetup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
-import javax.ws.rs.core.Response;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.UUID;
-
-import static org.junit.Assert.assertEquals;
-
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
public class UEBNotificationTest extends AAISetup {
public QueryStyle queryStyle = QueryStyle.TRAVERSAL_URI;
-
@Before
public void setup() throws Exception {
version = schemaVersions.getDefaultVersion();
pserver.setValue("hostname", "hn");
URI uri = new URI("/cloud-infrastructure/pservers/pserver/hn");
UEBNotification uebNotification = new UEBNotification(loader, loaderFactory, schemaVersions);
- uebNotification.createNotificationEvent(
- UUID.randomUUID().toString(),
- "JUNIT-SOT",
- Response.Status.CREATED,
- uri,
- pserver,
- new HashMap<>(),
- BASE_PATH);
+ uebNotification.createNotificationEvent(UUID.randomUUID().toString(), "JUNIT-SOT", Response.Status.CREATED, uri,
+ pserver, new HashMap<>(), BASE_PATH);
assertEquals("One event created", 1, uebNotification.getEvents().size());
- assertEquals(
- "Uri is correct",
- BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
- uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
+ assertEquals("Uri is correct",
+ BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
+ uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
}
@Test
pserver.setValue("hostname", "hn");
URI uri = new URI(BASE_PATH + "/v12/cloud-infrastructure/pservers/pserver/hn");
UEBNotification uebNotification = new UEBNotification(loader, loaderFactory, schemaVersions);
- uebNotification.createNotificationEvent(
- UUID.randomUUID().toString(),
- "JUNIT-SOT",
- Response.Status.CREATED,
- uri,
- pserver,
- new HashMap<>(), BASE_PATH);
+ uebNotification.createNotificationEvent(UUID.randomUUID().toString(), "JUNIT-SOT", Response.Status.CREATED, uri,
+ pserver, new HashMap<>(), BASE_PATH);
assertEquals("One event created", 1, uebNotification.getEvents().size());
- assertEquals(
- "Uri is correct",
- BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
- uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
+ assertEquals("Uri is correct",
+ BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
+ uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
}
}