Package com.opengamma.core.exchange.impl

Examples of com.opengamma.core.exchange.impl.SimpleExchange


  //-------------------------------------------------------------------------
  @SuppressWarnings({"unchecked", "rawtypes" })
  @Test
  public void testGetConfigByUid() {
    final SimpleExchange target = new SimpleExchange();
    target.setName("Test");
    when(_underlying.get(eq(UID))).thenReturn((ConfigItem) ConfigItem.of(target));
    final Response test = _resource.get(UID.toString());
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertEquals(target, OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConfigItem.class, (FudgeMsg) test.getEntity()).getValue());
  }
View Full Code Here


  }

  @SuppressWarnings({"unchecked", "rawtypes" })
  @Test
  public void testGetConfigByOid() {
    final SimpleExchange target = new SimpleExchange();
    target.setName("Test");
    when(_underlying.get(eq(OID), eq(VC))).thenReturn((ConfigItem) ConfigItem.of(target));
    final Response test = _resource.getByOidVersionCorrection(OID.toString(), VC.toString());
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertEquals(target, OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConfigItem.class, (FudgeMsg) test.getEntity()).getValue());
  }
View Full Code Here

    assertEquals(target, OpenGammaFudgeContext.getInstance().fromFudgeMsg(ConfigItem.class, (FudgeMsg) test.getEntity()).getValue());
  }

  @Test
  public void testSearch() {
    final ConfigItem<SimpleExchange> target = ConfigItem.of(new SimpleExchange());
    target.setName("Test");
    when(_underlying.get(eq(SimpleExchange.class), eq(NAME), eq(VC))).thenReturn(Collections.singleton(target));
    final Response test = _resource.search(SimpleExchange.class.getName(), VC.toString(), NAME);
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    final FudgeMsg msg = (FudgeMsg) test.getEntity();
View Full Code Here

    final ExchangeSource underlying = Mockito.mock(ExchangeSource.class);
    Mockito.when(underlying.getSingle(Mockito.<ExternalId>anyObject())).thenAnswer(new Answer<Exchange>() {
      @Override
      public Exchange answer(InvocationOnMock invocation) throws Throwable {
        getCount.incrementAndGet();
        SimpleExchange simpleExchange = new SimpleExchange();
        simpleExchange.setUniqueId(UniqueId.of("Test", "Foo", "0"));
        simpleExchange.setExternalIdBundle(ExternalIdBundle.of((ExternalId) invocation.getArguments()[0]));
        return simpleExchange;
      }
    });
    EHCachingExchangeSource source = new EHCachingExchangeSource(underlying, _cacheManager);
    assertEquals(0, getCount.get());
View Full Code Here

TOP

Related Classes of com.opengamma.core.exchange.impl.SimpleExchange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.