Пример #1
0
  @Test
  public void shouldGetVdbs() throws Exception {
    loadVdbs();

    // get
    URI uri = _uriBuilder.generateVdbsUri();
    this.response = request(uri).get();
    assertTrue(response.hasEntity());

    final String entities = response.readEntity(String.class);
    assertThat(entities, is(notNullValue()));

    // System.out.println("Response:\n" + entities);
    // make sure the VDB JSON document is returned for each vdb
    RestVdb[] vdbs = KomodoJsonMarshaller.unmarshallArray(entities, RestVdb[].class);
    assertEquals(4, vdbs.length);

    boolean foundPortfolio = false;
    for (RestVdb vdb : vdbs) {
      assertNotNull(vdb.getId());
      assertNotNull(vdb.getDataPath());
      assertNotNull(vdb.getkType());

      if (TestUtilities.PORTFOLIO_VDB_NAME.equals(vdb.getId())) {
        foundPortfolio = true;
        assertPortfolio(vdb);
      }
    }

    assertTrue(foundPortfolio);
  }
Пример #2
0
  @Test
  public void shouldGetVdbWhenPatternMatches() throws Exception {
    loadVdbs();

    final String pattern = STAR + "P" + STAR;
    this.response =
        request(
                UriBuilder.fromUri(_uriBuilder.generateVdbsUri())
                    .queryParam(KomodoVdbService.QueryParamKeys.PATTERN, pattern)
                    .build())
            .get();

    final String entities = response.readEntity(String.class);
    assertThat(entities, is(notNullValue()));

    // System.out.println("Response:\n" + entities);
    // make sure the VDB JSON document is returned for each vdb
    RestVdb[] vdbs = KomodoJsonMarshaller.unmarshallArray(entities, RestVdb[].class);
    assertEquals(2, vdbs.length);

    // Should return both MyPartsVDB_Dynamic and Portfoliio
    for (RestVdb vdb : vdbs) {
      if (TestUtilities.PARTS_VDB_NAME.equals(vdb.getName())) {
        // Not checking this one
      } else if (TestUtilities.PORTFOLIO_VDB_NAME.equals(vdb.getName())) assertPortfolio(vdb);
      else fail("Invalid VDB returned from search pattern " + pattern);
    }
  }