Package com.opengamma.id

Examples of com.opengamma.id.ObjectId


  public void test_ReplaceVersion_noUid() {
    Clock origClock = _exgMaster.getClock();
    try {
      Instant now = Instant.now();

      ObjectId baseOid = setupTestData(now);
      _exgMaster.setClock(Clock.fixed(now.plus(2, HOURS), ZoneOffset.UTC));

      final ExternalIdBundle bundle = ExternalIdBundle.of("B", "B0");
      final ExternalIdBundle region = ExternalIdBundle.of("R", "R0");
      List<ExchangeDocument> replacement = newArrayList();
      for (int i = 0; i <= 2; i++) {
        ManageableExchange ex = new ManageableExchange(bundle, "replace_" + i, region, null);
        ExchangeDocument doc = new ExchangeDocument(ex);
        doc.setVersionFromInstant(now.plus(1, MINUTES).plus(i * 20, SECONDS));
        replacement.add(doc);
      }

      _exgMaster.replaceVersion(baseOid.atVersion("no such uid"), replacement);
    } finally {
      _exgMaster.setClock(origClock);
    }
  }
View Full Code Here


    _htsMaster.updateTimeSeriesDataPoints(ObjectId.of("DbHts", "DP101"), null);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_update_versioned_notFoundId() {
    ObjectId oid = ObjectId.of("DbHts", "DP0");
    _htsMaster.updateTimeSeriesDataPoints(oid, ImmutableLocalDateDoubleTimeSeries.EMPTY_SERIES);
  }
View Full Code Here

  public void test_update_102_startsEmpty() {
    LocalDate[] dates = {LocalDate.of(2011, 7, 1), LocalDate.of(2011, 7, 2), LocalDate.of(2011, 7, 4)};
    double[] values = {1.1d, 2.2d, 3.3d};
    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    ObjectId oid = ObjectId.of("DbHts", "DP102");
    UniqueId uniqueId = _htsMaster.updateTimeSeriesDataPoints(oid, series);
   
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(uniqueId);
    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(series, test.getTimeSeries());
View Full Code Here

  public void test_update_101_startsFull() {
    LocalDate[] dates = {LocalDate.of(2011, 7, 1), LocalDate.of(2011, 7, 2), LocalDate.of(2011, 7, 4)};
    double[] values = {1.1d, 2.2d, 3.3d};
    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    UniqueId uniqueId = _htsMaster.updateTimeSeriesDataPoints(oid, series);
   
    ManageableHistoricalTimeSeries testAdded = _htsMaster.getTimeSeries(uniqueId, HistoricalTimeSeriesGetFilter.ofRange(LocalDate.of(2011, 7, 1), null));
    assertEquals(uniqueId, testAdded.getUniqueId());
    assertEquals(series, testAdded.getTimeSeries());
View Full Code Here

      ManageableExchange exchange = new ManageableExchange(bundle, "initial", region, null);
      ExchangeDocument initialDoc = new ExchangeDocument(exchange);

      _exgMaster.add(initialDoc);

      ObjectId baseOid = initialDoc.getObjectId();

      List<ExchangeDocument> firstReplacement = newArrayList();
      for (int i = 0; i < 5; i++) {
        ManageableExchange ex = new ManageableExchange(bundle, "setup_" + i, region, null);
        ExchangeDocument doc = new ExchangeDocument(ex);
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test
  public void test_getObjectId() {
    ObjectId oid = ObjectId.of("DbHts", "201");
    HistoricalTimeSeriesInfoDocument test = _htsMaster.get(oid, VersionCorrection.LATEST);
    assert203(test);
  }
View Full Code Here

    assert203(test);
  }

  @Test
  public void test_getObjectId_earlierCorrection() {
    ObjectId oid = ObjectId.of("DbHts", "201");
    HistoricalTimeSeriesInfoDocument test = _htsMaster.get(oid, VersionCorrection.ofCorrectedTo(_version2Instant));
    assert202(test);
  }
View Full Code Here

    final List<Future<Pair<UniqueId, ObjectId>>> futures = new LinkedList<Future<Pair<UniqueId, ObjectId>>>();
    PortfolioNodeTraverser.depthFirst(new AbstractPortfolioNodeTraversalCallback() {
      @Override
      public void preOrderOperation(final PortfolioNode parentNode, final Position position) {
        final ExternalId positionId = position.getUniqueId().toExternalId();
        ObjectId id = s_cache.get(positionId);
        if (id == null) {
          futures.add(_executor.submit(new Callable<Pair<UniqueId, ObjectId>>() {
            @Override
            public Pair<UniqueId, ObjectId> call() throws Exception {
              final PositionSearchRequest searchRequest = new PositionSearchRequest();
              searchRequest.setPositionProviderId(positionId);
              final PositionSearchResult searchResult = _positions.search(searchRequest);
              ObjectId id = null;
              if (searchResult.getFirstPosition() != null) {
                id = searchResult.getFirstPosition().getUniqueId().getObjectId();
                s_logger.debug("Found position {} in master at {}", position, id);
              }
              if (id == null) {
View Full Code Here

      future.cancel(false);
    }
  }

  protected ObjectId mapPositionIdentifier(final Position position) {
    ObjectId id = _positionMap.get(position.getUniqueId());
    if (id == null) {
      s_logger.debug("Adding position {} to master", position);
      id = _positions.add(new PositionDocument(createManageablePosition(position))).getUniqueId().getObjectId();
      _positionMap.put(position.getUniqueId(), id);
      s_cache.put(position.getUniqueId().toExternalId(), id);
View Full Code Here

        if (_includePosition) {
          final String posIdScheme = rs.getString("POS_KEY_SCHEME");
          final String posIdValue = rs.getString("POS_KEY_VALUE");
          if (posIdScheme != null && posIdValue != null) {
            ObjectId id = ObjectId.of(posIdScheme, posIdValue);
            if (_nodePositionIds.add(id)) {
              _node.addPosition(id);
              assert (_nodePositionIds.size() == _node.getPositionIds().size());
            }
          }
View Full Code Here

TOP

Related Classes of com.opengamma.id.ObjectId

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.