* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public void setGenericVnfId(String genericVnfId) {
this.genericVnfId = genericVnfId;
}
-
+
@JsonProperty("pg-streams")
private pgStreams pgStreams;
};
@JsonIgnoreProperties(ignoreUnknown = true)
public static class pgStreams {
- @JsonProperty("pg-stream")
+ @JsonProperty("pg-stream")
private Collection<pgStream> streams;
-
- public Collection<pgStream> getStreams() {
- return streams;
- }
-
- public void setStreams(Collection<pgStream> streams) {
- this.streams = streams;
- }
+ public Collection<pgStream> getStreams() {
+ return streams;
+ }
+ public void setStreams(Collection<pgStream> streams) {
+ this.streams = streams;
+ }
};
- @JsonIgnoreProperties(ignoreUnknown = true)
- public static class pgStream{
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getIsEnabled() {
- return isEnabled;
- }
- public void setIsEnabled(String isEnabled) {
- this.isEnabled = isEnabled;
- }
- @JsonProperty("id")
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class pgStream{
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getIsEnabled() {
+ return isEnabled;
+ }
+ public void setIsEnabled(String isEnabled) {
+ this.isEnabled = isEnabled;
+ }
+ @JsonProperty("id")
private String id;
@JsonProperty("is-enabled")
private String isEnabled;
- };
-
-
+ };
}
* Copyright (C) 2017 Amdocs
* =============================================================================
* Modification Copyright (C) 2018 IBM.
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
+import java.util.ArrayList;
+import java.util.Collection;
import org.apache.commons.io.IOUtils;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.onap.appc.listener.demo.model.CommonMessage.pgStream;
import org.onap.appc.listener.demo.model.IncomingMessage;
import org.onap.appc.listener.demo.model.OutgoingMessage;
import org.onap.appc.listener.demo.model.Status;
assertNotNull(in);
assertNotNull(out);
} catch (Exception e) {
- e.printStackTrace();
fail(e.getMessage());
}
}
assertNotNull(in.getHeader().getRequestID());
assertNotNull(in.getHeader().getSubRequestId());
assertNotNull(in.getHeader().getTimeStamp());
-
+
assertNotNull(out);
assertNotNull(out.getHeader().getApiVer());
assertNotNull(out.getHeader().getOriginatorId());
assertNotNull(out.getStatus().getValue());
}
-
+
@Test
public void testGetRequest()
{
in.setRequest(request);
assertEquals(request, in.getRequest());
}
-
+
@Test
public void testIsValid()
{
assertEquals(true, in.isValid());
}
+ @Test
+ public void testTime() {
+ in.setStartTime(0);
+ assertEquals(0, in.getStartTime());
+ }
+
+ @Test
+ public void testPayload() {
+ CommonMessage.Payload payload = new CommonMessage.Payload();
+ payload.setGenericVnfId("VNF_ID");
+ CommonMessage.pgStream pgStream = new CommonMessage.pgStream();
+ pgStream.setId("ID");
+ pgStream.setIsEnabled("true");
+ CommonMessage.pgStreams pgStreams = new CommonMessage.pgStreams();
+ Collection<pgStream> collectionPgStreams = new ArrayList<pgStream>();
+ collectionPgStreams.add(pgStream);
+ pgStreams.setStreams(collectionPgStreams);
+ payload.setPgStreams(pgStreams);
+ in.setPayload(payload);
+ assertEquals("VNF_ID", in.getPayload().getGenericVnfId());
+ assertEquals("{\\\"pg-streams\\\": {\\\"pg-stream\\\":[{\\\"id\\\":\\\"ID\\\", \\\"is-enabled\\\":\\\"true\\\"}]}}",
+ in.getPayload().getPgStreams());
+ }
+
@Test
@Ignore
public void testIncommingToOutgoing(){
assertNotNull(newOut.getStatus().getCode());
assertNotNull(newOut.getStatus().getValue());
}
-
+
@Test
@Ignore
public void testToString() {
assertTrue(in.toString().contains(id));
}
-
@Test
@Ignore
public void testOutgoingUpdateTime() {