aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorPawel <pawel.kasperkiewicz@nokia.com>2019-04-05 06:06:10 -0400
committerPawel <pawel.kasperkiewicz@nokia.com>2019-04-09 02:40:06 -0400
commit514bdf177e401b3f6b7ff78d35e3ca356918e916 (patch)
tree2749a3f2894b9354ed9d5d262590b92c93a5df0e /src/main/java
parent6cc4cd54f5f88808ab3df0621545cda9cf384f2c (diff)
changes in DR_PubResourceTest
Issue-ID: DMAAP-1148 Change-Id: Id9c843537b9ebabcc7284af125d8ee5f59b648f3 Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java34
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java5
2 files changed, 36 insertions, 3 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java b/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java
index 0d146b7..4e64089 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/DR_Pub.java
@@ -24,6 +24,8 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.onap.dmaap.dbcapi.util.RandomString;
+import java.util.Objects;
+
@XmlRootElement
public class DR_Pub extends DmaapObject {
@@ -151,5 +153,35 @@ public class DR_Pub extends DmaapObject {
return ri.nextString();
}
-
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ DR_Pub dr_pub = (DR_Pub) o;
+ return Objects.equals(dcaeLocationName, dr_pub.dcaeLocationName) &&
+ Objects.equals(username, dr_pub.username) &&
+ Objects.equals(userpwd, dr_pub.userpwd) &&
+ Objects.equals(feedId, dr_pub.feedId) &&
+ Objects.equals(pubId, dr_pub.pubId);
+ }
+
+ @Override
+ public int hashCode() {
+
+ return Objects.hash(dcaeLocationName, username, userpwd, feedId, pubId);
+ }
+
+ @Override
+ public String toString() {
+ return "DR_Pub{" +
+ "dcaeLocationName='" + dcaeLocationName + '\'' +
+ ", username='" + username + '\'' +
+ ", userpwd='" + userpwd + '\'' +
+ ", feedId='" + feedId + '\'' +
+ ", pubId='" + pubId + '\'' +
+ ", feedName='" + feedName + '\'' +
+ ", feedVersion='" + feedVersion + '\'' +
+ '}';
+ }
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
index 928a7e2..6e652a8 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/DR_PubResource.java
@@ -104,8 +104,9 @@ public class DR_PubResource extends BaseLoggingClass {
}
// if we found a FeedName instead of a FeedId then try to look it up.
List<Feed> nfeeds = feeds.getAllFeeds( pub.getFeedName(), pub.getFeedVersion(), "equals");
- if ( nfeeds.size() != 1 ) {
- logger.debug( "Attempt to match "+ pub.getFeedName() + " ver="+pub.getFeedVersion() + " matched " + nfeeds.size() );
+ if ( nfeeds.isEmpty() ) {
+ apiError.setCode(Status.NOT_FOUND.getStatusCode());
+ apiError.setFields("feedName");
return responseBuilder.error(apiError);
}
fnew = nfeeds.get(0);