From 2941d6a78d2eec8c6fb87d44e14f512b314e31f0 Mon Sep 17 00:00:00 2001 From: dglFromAtt Date: Mon, 7 Jan 2019 15:58:44 -0500 Subject: Stop referencing unused properties A few fields for dmaap object were still being set assuming that values came from properties file. Furthermore, a private variable in the DmaapService class was not set to new value from request. Result was that lack of property caused topicNsRoot field to be null, and then the null was used to compose AAF action/instance values incorrectly. Also fixed some test code to initialize properly. Change-Id: Iffabf5728fdfb2f9496c7eb248cb1ed9e1cc1536 Signed-off-by: dglFromAtt Issue-ID: DMAAP-933 Signed-off-by: dglFromAtt --- .../dmaap/dbcapi/resources/DR_SubResourceTest.java | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java b/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java index 48d1016..917507f 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/resources/DR_SubResourceTest.java @@ -21,6 +21,8 @@ package org.onap.dmaap.dbcapi.resources; import org.onap.dmaap.dbcapi.model.*; import org.onap.dmaap.dbcapi.service.*; +import org.onap.dmaap.dbcapi.testframework.DmaapObjectFactory; + import static org.junit.Assert.*; import org.junit.After; @@ -39,16 +41,44 @@ import javax.ws.rs.Path; import javax.ws.rs.GET; public class DR_SubResourceTest extends JerseyTest{ + + static DmaapObjectFactory factory = new DmaapObjectFactory(); @Override protected Application configure() { return new ResourceConfig() .register( DR_SubResource.class ) - .register( FeedResource.class ); + .register( FeedResource.class ) + .register( DcaeLocationResource.class ) + .register( DmaapResource.class ); } - private static final String fmt = "%24s: %s%n"; String d, un, up, f, p; + + @Before + public void preTest() throws Exception { + try { + + Dmaap dmaap = factory.genDmaap(); + Entity reqEntity = Entity.entity( dmaap, MediaType.APPLICATION_JSON ); + Response resp = target( "dmaap").request().post( reqEntity, Response.class ); + System.out.println( resp.getStatus() ); + assertTrue( resp.getStatus() == 200 ); + }catch (Exception e ) { + } + try { + DcaeLocation loc = factory.genDcaeLocation( "central" ); + Entity reqEntity = Entity.entity( loc, MediaType.APPLICATION_JSON ); + Response resp = target( "dcaeLocations").request().post( reqEntity, Response.class ); + System.out.println( "POST dcaeLocation resp=" + resp.getStatus() + " " + resp.readEntity( String.class )); + if ( resp.getStatus() != 409 ) { + assertTrue( resp.getStatus() == 201 ); + } + } catch (Exception e ) { + } + + + } /* @Before public void setUp() throws Exception { -- cgit 1.2.3-korg