Package org.threeten.bp

Examples of org.threeten.bp.Instant


    _secMaster.update(doc);
  }

  @Test
  public void test_update_getUpdateGet() {
    Instant now = Instant.now(_secMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbSec", "101", "0");
    SecurityDocument base = _secMaster.get(uniqueId);
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument input = new SecurityDocument(security);
View Full Code Here


    if (_securityUniqueId2Subscription.containsKey(identifier)) {

      Subscription sub = _securityUniqueId2Subscription.get(identifier);

      Date creationTime = sub.getCreationTime();
      Instant instant = Instant.ofEpochMilli(creationTime.getTime());

      Set<DistributorTrace> distributors = new HashSet<>();

      for (MarketDataDistributor distributor : sub.getDistributors()) {
        distributors.add(new DistributorTrace(
            distributor.getDistributionSpec().getJmsTopic(),
            Instant.ofEpochMilli(distributor.getExpiry()).toString(),
            distributor.hasExpired(),
            distributor.isPersistent(),
            distributor.getNumMessagesSent()));
      }

      return new SubscriptionTrace(identifier, instant.toString(), distributors, sub.getLiveDataHistory().getLastKnownValues().toString());
    } else {
      return new SubscriptionTrace(identifier);
    }
  }
View Full Code Here

    _usrMaster.add(doc);
  }

  @Test
  public void test_add() {
    Instant now = Instant.now(_usrMaster.getClock());
   
    ManageableOGUser user = new ManageableOGUser("AddedUser");
    user.setPasswordHash("TESTHASH");
    user.setName("Test Name");
    user.setEmailAddress("test@test.com");
View Full Code Here

    _holMaster.remove(uniqueId);
  }

  @Test
  public void test_remove_removed() {
    Instant now = Instant.now(_holMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbHol", "101", "0");
    _holMaster.remove(uniqueId);
    HolidayDocument test = _holMaster.get(uniqueId);
   
View Full Code Here

    _holMaster.update(doc);
  }

  @Test
  public void test_update_getUpdateGet() {
    Instant now = Instant.now(_holMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbHol", "101", "0");
    HolidayDocument base = _holMaster.get(uniqueId);
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
View Full Code Here

  @Test
  public void test_ReplaceVersion_of_some_middle_version() {
    Clock origClock = _cfgMaster.getClock();
    try {
      Instant now = Instant.now();

      ObjectId baseOid = setupTestData(now);
      _cfgMaster.setClock(Clock.fixed(now.plus(2, HOURS), ZoneOffset.UTC));
      ConfigDocument latestDoc = _cfgMaster.get(baseOid, VersionCorrection.LATEST);
      Instant latestFrom = latestDoc.getVersionFromInstant();

      List<ConfigDocument> replacement = newArrayList();
      for (int i = 0; i <= 10; i++) {
        String val = "test" + i;
        ConfigDocument doc = new ConfigDocument(ConfigItem.of(val, "some_name_"+i));
        doc.setVersionFromInstant(latestFrom.plus(i, MINUTES));
        replacement.add(doc);
      }

      _cfgMaster.replaceVersion(latestDoc.getUniqueId(), replacement);
View Full Code Here

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_ReplaceVersion_of_some_middle_version_timeBoundsNotExact() {
    Clock origClock = _cfgMaster.getClock();
    try {
      Instant now = Instant.now();

      ObjectId baseOid = setupTestData(now);
      _cfgMaster.setClock(Clock.fixed(now.plus(2, HOURS), ZoneOffset.UTC));
      ConfigDocument latestDoc = _cfgMaster.get(baseOid, VersionCorrection.LATEST);
      Instant latestFrom = latestDoc.getVersionFromInstant();

      List<ConfigDocument> replacement = newArrayList();
      for (int i = 1; i <= 10; i++) {
        String val = "test" + i;
        ConfigDocument doc = new ConfigDocument(ConfigItem.of(val));
        doc.setVersionFromInstant(latestFrom.plus(i, MINUTES));
        replacement.add(doc);
      }

      _cfgMaster.replaceVersion(latestDoc.getUniqueId(), replacement);
View Full Code Here

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_ReplaceVersion_which_is_not_current() {
    Clock origClock = _cfgMaster.getClock();
    try {
      Instant now = Instant.now();

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


      ConfigHistoryRequest<String> historyRequest = new ConfigHistoryRequest<String>();
      historyRequest.setObjectId(baseOid);
      historyRequest.setCorrectionsToInstant(null);
      ConfigHistoryResult<String> result = _cfgMaster.history(historyRequest);
      List<ConfigDocument> values = result.getDocuments();

      ConfigDocument lastButOneDoc = values.get(values.size() - 1);
      Instant lastButOneDocVersionFrom = lastButOneDoc.getVersionFromInstant();

      List<ConfigDocument> replacement = newArrayList();
      for (int i = 1; i <= 10; i++) {
        String val = "test" + i;
        ConfigDocument doc = new ConfigDocument(ConfigItem.of(val));
        doc.setVersionFromInstant(lastButOneDocVersionFrom.plus(i, MINUTES));
        replacement.add(doc);
      }

      _cfgMaster.replaceVersion(lastButOneDoc.getUniqueId(), replacement);
View Full Code Here

    _cfgMaster.correct(new ConfigDocument(doc));
  }

  @Test
  public void test_correct_getUpdateGet() {
    Instant now = Instant.now(_cfgMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbCfg", "101", "0");
    ConfigDocument base = _cfgMaster.get(uniqueId);

    ConfigItem<ExternalId> input = ConfigItem.of(ExternalId.of("A", "B"));
View Full Code Here

    assertEquals(2, searchResult.getDocuments().size());
  }

  @Test
  public void test_correct_nameChangeNullValue() {
    Instant now = Instant.now(_cfgMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbCfg", "101", "0");
    ConfigDocument base = _cfgMaster.get(uniqueId);
    ConfigItem<?> input = base.getConfig();
    input.setName("NewName"); // name change only
View Full Code Here

TOP

Related Classes of org.threeten.bp.Instant

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.