/**
  * Builds a URI.
  *
  * @param baseUri the base URI, not null
  * @param objectId the object identifier, may be null
  * @param vc the version-correction, null means latest
  * @return the URI, not null
  */
 public static URI uriGet(URI baseUri, ObjectId objectId, VersionCorrection vc) {
   UriBuilder bld = UriBuilder.fromUri(baseUri).path("exchanges/{exchangeId}");
   if (vc != null) {
     bld.queryParam("versionAsOf", vc.getVersionAsOfString());
     bld.queryParam("correctedTo", vc.getCorrectedToString());
   }
   return bld.build(objectId);
 }
 /**
  * Builds a URI.
  *
  * @param baseUri the base URI, not null
  * @param vc the version-correction, null means latest
  * @param bundle the bundle, may be null
  * @return the URI, not null
  */
 public static URI uriSearch(URI baseUri, VersionCorrection vc, ExternalIdBundle bundle) {
   UriBuilder bld = UriBuilder.fromUri(baseUri).path("exchanges");
   if (vc != null) {
     bld.queryParam("versionAsOf", vc.getVersionAsOfString());
     bld.queryParam("correctedTo", vc.getCorrectedToString());
   }
   bld.queryParam("id", bundle.toStringList().toArray());
   return bld.build();
 }
Ejemplo n.º 3
0
  @Test
  public void testGetConfigByOid() {
    final SimpleExchange target = new SimpleExchange();
    target.setName("Test");

    when(_underlying.getConfig(eq(SimpleExchange.class), eq(OID), eq(VC))).thenReturn(target);

    Response test =
        _resource.get(
            OID.toString(),
            SimpleExchange.class.getName(),
            null,
            VC.getVersionAsOfString(),
            VC.getCorrectedToString());
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertSame(target, test.getEntity());
  }
Ejemplo n.º 4
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  @Test
  public void testSearch() {
    final SimpleExchange target = new SimpleExchange();
    target.setName("Test");
    Collection targetColl = ImmutableList.of(target);

    when(_underlying.getConfigs(eq(SimpleExchange.class), eq(NAME), eq(VC))).thenReturn(targetColl);

    Response test =
        _resource.search(
            SimpleExchange.class.getName(),
            VC.getVersionAsOfString(),
            VC.getCorrectedToString(),
            NAME);
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertEquals(FudgeListWrapper.of(targetColl), test.getEntity());
  }