Package com.opengamma.id

Examples of com.opengamma.id.UniqueId


   
    PositionDocument doc = new PositionDocument();
    doc.setPosition(position);
    PositionDocument test = _posMaster.add(doc);
   
    UniqueId portfolioId = test.getUniqueId();
    assertNotNull(portfolioId);
    assertEquals("DbPos", portfolioId.getScheme());
    assertTrue(portfolioId.isVersioned());
    assertTrue(Long.parseLong(portfolioId.getValue()) >= 1000);
    assertEquals("0", portfolioId.getVersion());
    assertEquals(now, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(now, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageablePosition testPosition = test.getPosition();
    assertNotNull(testPosition);
    assertEquals(portfolioId, testPosition.getUniqueId());
    assertEquals(BigDecimal.TEN, testPosition.getQuantity());
    ExternalIdBundle secKey = testPosition.getSecurityLink().getExternalId();
    assertEquals(1, secKey.size());
    assertTrue(secKey.getExternalIds().contains(ExternalId.of("A", "B")));
   
    assertNotNull(testPosition.getTrades());
    assertTrue(testPosition.getTrades().size() == 2);
    for (ManageableTrade testTrade : testPosition.getTrades()) {
      assertNotNull(testTrade);
      UniqueId tradeId = testTrade.getUniqueId();
      assertNotNull(tradeId);
      assertEquals("DbPos", portfolioId.getScheme());
      assertTrue(portfolioId.isVersioned());
      assertTrue(Long.parseLong(portfolioId.getValue()) >= 1000);
      assertEquals("0", portfolioId.getVersion());
View Full Code Here


   
    PositionDocument doc = new PositionDocument();
    doc.setPosition(position);
    PositionDocument test = _posMaster.add(doc);
   
    UniqueId uniqueId = test.getUniqueId();
    assertNotNull(uniqueId);
    assertEquals("DbPos", uniqueId.getScheme());
    assertTrue(uniqueId.isVersioned());
    assertTrue(Long.parseLong(uniqueId.getValue()) >= 1000);
    assertEquals("0", uniqueId.getVersion());
    assertEquals(now, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(now, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageablePosition testPosition = test.getPosition();
View Full Code Here

  @Test
  public void test_update_getUpdateGet() {
    Instant now = Instant.now(_prtMaster.getClock());
   
    UniqueId oldPortfolioId = UniqueId.of("DbPrt", "101", "0");
    PortfolioDocument base = _prtMaster.get(oldPortfolioId);
    Map<String, String> oldAttr = base.getPortfolio().getAttributes();
    assertNotNull(oldAttr);
    ManageablePortfolio port = new ManageablePortfolio("NewName");
    port.setUniqueId(oldPortfolioId);
View Full Code Here

    super(ValueRequirementNames.VOLATILITY_SURFACE_DATA);
  }

  @Override
  VolatilitySurfaceKey getKey(ValueSpecification spec) {
    UniqueId uniqueId = spec.getTargetSpecification().getUniqueId();
    String surface = getSingleProperty(spec, ValuePropertyNames.SURFACE);
    String instrumentType = getSingleProperty(spec, "InstrumentType"); //TODO constant
    String quoteType = getSingleProperty(spec, SurfaceAndCubePropertyNames.PROPERTY_SURFACE_QUOTE_TYPE);
    String quoteUnits = getSingleProperty(spec, SurfaceAndCubePropertyNames.PROPERTY_SURFACE_UNITS);
    return new VolatilitySurfaceKey(uniqueId, surface, instrumentType, quoteType, quoteUnits);
View Full Code Here

        202, 3);
  }

  //-------------------------------------------------------------------------
  protected void assert101(final SecurityDocument test) {
    UniqueId uniqueId = UniqueId.of("DbSec", "101", "0");
    assertNotNull(test);
    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
View Full Code Here

    assertEquals("EQUITY", security.getSecurityType());
    assertEquals(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("E", "F")), security.getExternalIdBundle());
  }

  protected void assert102(final SecurityDocument test) {
    UniqueId uniqueId = UniqueId.of("DbSec", "102", "0");
    assertNotNull(test);
    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
View Full Code Here

    assertEquals("EQUITY", security.getSecurityType());
    assertEquals(ExternalIdBundle.of(ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("GH", "HI")), security.getExternalIdBundle());
  }

  protected void assert201(final SecurityDocument test) {
    UniqueId uniqueId = UniqueId.of("DbSec", "201", "0");
    assertNotNull(test);
    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(_version2Instant, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
View Full Code Here

    assertEquals("EQUITY", security.getSecurityType());
    assertEquals(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")), security.getExternalIdBundle());
  }

  protected void assert202(final SecurityDocument test) {
    UniqueId uniqueId = UniqueId.of("DbSec", "201", "1");
    assertNotNull(test);
    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version2Instant, test.getVersionFromInstant());
    assertEquals(null, test.getVersionToInstant());
    assertEquals(_version2Instant, test.getCorrectionFromInstant());
View Full Code Here

  private static UniqueId createSyntheticIdentifier() {
    return s_syntheticIdentifiers.get();
  }

  public Portfolio aggregate(Portfolio inputPortfolio) {
    UniqueId portfolioId = inputPortfolio.getUniqueId();
    UniqueId aggId;
    if (portfolioId != null) {
      String aggPortfolioId = buildPortfolioName(portfolioId.getValue());
      aggId = UniqueId.of(portfolioId.getScheme(), aggPortfolioId);
    } else {
      aggId = createSyntheticIdentifier();
View Full Code Here

  @Test
  public void multipleEntitySubscription() throws IOException, JSONException {
    String clientId = _webPushTestUtils.handshake();
    String restUrl1 = "/jax/test/" + _uidStr;
    String uid2Str = "Tst~102";
    UniqueId uid2 = UniqueId.parse(uid2Str);
    UniqueId uid2V1 = uid2.withVersion("1");
    String restUrl2 = "/jax/test/" + uid2Str;
    _webPushTestUtils.readFromPath(restUrl1, clientId);
    _webPushTestUtils.readFromPath(restUrl2, clientId);
    _changeManager.entityChanged(ChangeType.CHANGED, _uidV1.getObjectId(), null, null, Instant.now());
    _changeManager.entityChanged(ChangeType.CHANGED, uid2V1.getObjectId(), null, null, Instant.now());
    String json = _webPushTestUtils.readFromPath("/updates/" + clientId);
    WebPushTestUtils.checkJsonResults(json, restUrl1, restUrl2);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.id.UniqueId

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.