X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdbcapi.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fresources%2FDR_SubResourceTest.java;h=917507f4d97490acee67a788314f9cf3ec4f14dd;hp=48d1016d4850d3bfeba8fe2455eba499eaf16b10;hb=2941d6a78d2eec8c6fb87d44e14f512b314e31f0;hpb=536c6aabdfd2bcdc493501a9498fb8a97d208c0b 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 {