コード例 #1
0
  @Test
  public void shouldGetVdbTranslator() throws Exception {
    loadVdbs();

    // get
    Properties settings =
        _uriBuilder.createSettings(SettingNames.VDB_NAME, TestUtilities.TWEET_EXAMPLE_VDB_NAME);
    _uriBuilder.addSetting(settings, SettingNames.TRANSLATOR_NAME, "rest");
    URI uri = _uriBuilder.buildVdbTranslatorUri(LinkType.SELF, settings);
    this.response = request(uri).get();
    final String entity = this.response.readEntity(String.class);
    assertThat(entity, is(notNullValue()));

    // System.out.println("Response from uri " + uri + ":\n" + entity);

    RestVdbTranslator translator = KomodoJsonMarshaller.unmarshall(entity, RestVdbTranslator.class);
    assertNotNull(translator);

    assertEquals(KomodoType.VDB_TRANSLATOR, translator.getkType());
    assertEquals("ws", translator.getType());
    assertEquals("Rest Web Service translator", translator.getDescription());

    Collection<RestLink> links = translator.getLinks();
    assertEquals(3, links.size());
  }
コード例 #2
0
  @Test
  public void shouldGetVdbTranslators() throws Exception {
    loadVdbs();

    // get
    URI uri =
        _uriBuilder.generateVdbChildGroupUri(
            TestUtilities.TWEET_EXAMPLE_VDB_NAME, LinkType.TRANSLATORS);
    this.response = request(uri).get();
    final String entity = this.response.readEntity(String.class);
    assertThat(entity, is(notNullValue()));

    // System.out.println("Response:\n" + entity);

    RestVdbTranslator[] translators =
        KomodoJsonMarshaller.unmarshallArray(entity, RestVdbTranslator[].class);
    assertNotNull(translators);
    assertEquals(1, translators.length);

    RestVdbTranslator translator = translators[0];

    assertEquals(KomodoType.VDB_TRANSLATOR, translator.getkType());
    assertEquals("ws", translator.getType());
    assertEquals("Rest Web Service translator", translator.getDescription());

    Collection<RestLink> links = translator.getLinks();
    assertEquals(3, links.size());
  }