Package com.opengamma.id

Examples of com.opengamma.id.UniqueId


  @Test
  public void swapWithNoExternalId() {
    SecurityMaster securityMaster = mock(SecurityMaster.class);
    ExternalIdVisitor visitor = new ExternalIdVisitor(securityMaster);
    SwapSecurity swap = createSwap();
    UniqueId uid = UniqueId.of("test", "123");
    swap.setUniqueId(uid);
    assertTrue(swap.getExternalIdBundle().isEmpty());
    swap.accept(visitor);
    assertEquals(ExternalId.of(ObjectId.EXTERNAL_SCHEME, uid.getObjectId().toString()),
                 swap.getExternalIdBundle().getExternalId(ObjectId.EXTERNAL_SCHEME));
    verify(securityMaster).update(new SecurityDocument(swap));
  }
View Full Code Here


  @Test
  public void swapWithExternalId() {
    SecurityMaster securityMaster = mock(SecurityMaster.class);
    ExternalIdVisitor visitor = new ExternalIdVisitor(securityMaster);
    SwapSecurity swap = createSwap();
    UniqueId uid = UniqueId.of("test", "123");
    swap.setUniqueId(uid);
    ExternalId externalId = ExternalId.of(UniqueId.EXTERNAL_SCHEME, "345");
    swap.setExternalIdBundle(ExternalIdBundle.of(externalId));
    swap.accept(visitor);
    assertEquals(externalId, swap.getExternalIdBundle().getExternalId(UniqueId.EXTERNAL_SCHEME));
View Full Code Here

    _secMaster.correct(null);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_correct_noSecurityId() {
    UniqueId uniqueId = UniqueId.of("DbSec", "101");
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument doc = new SecurityDocument();
    doc.setSecurity(security);
    _secMaster.correct(doc);
  }
View Full Code Here

    _secMaster.correct(doc);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_correct_notFound() {
    UniqueId uniqueId = UniqueId.of("DbSec", "0", "0");
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument doc = new SecurityDocument(security);
    _secMaster.correct(doc);
  }
View Full Code Here

  @Test
  public void test_correct_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);
   
    SecurityDocument corrected = _secMaster.correct(input);
View Full Code Here

        Set<ExternalId> externalIds = requirement.getIdentifiers().getExternalIds();
        ArgumentChecker.isTrue(externalIds.size() == 1, "One (and only one) external id must be specified currently.");
        ExternalId externalId = Iterables.get(externalIds, 0);
        uri = DependencyGraphTraceProviderResource.uriValueRequirementByExternalId(uri, constrainedValueName, targetType, externalId);
      } else if (targetReference instanceof ComputationTargetSpecification) {
        UniqueId uniqueId = ((ComputationTargetSpecification) targetReference).getUniqueId();
        uri = DependencyGraphTraceProviderResource.uriValueRequirementByUniqueId(uri, constrainedValueName, targetType, uniqueId);
      } else {
        throw new IllegalArgumentException(format("Unrecognised ValueRequirement class: %s", ValueRequirement.class.getName()));
      }
    }
View Full Code Here

  }

  @Test
  public void updateComputationTarget() {
    final UniqueId uniqueId = UniqueId.of("foo", "bar");

    final SimpleSecurity mockSecurity = new SimpleSecurity("option");
    mockSecurity.setUniqueId(uniqueId);
    mockSecurity.setName("myOption");
View Full Code Here

  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void delete() {

    final UniqueId marketDataUid = _cycleMetadataStub.getMarketDataSnapshotId();
    _batchMaster.createMarketData(marketDataUid);
    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);

    assertNotNull(_batchWriter.getRiskRun(run.getObjectId()));
    _batchMaster.deleteRiskRun(run.getObjectId());
View Full Code Here

    _batchMaster.addJobResults(null, result);
  }

  @Test
  public void addJobResultsWithoutExistingComputeNodeId() {
    final UniqueId marketDataUid = _cycleMetadataStub.getMarketDataSnapshotId();

    _batchMaster.createMarketData(marketDataUid);

    final RiskRun run = _batchMaster.startRiskRun(_cycleMetadataStub, Maps.<String, String>newHashMap(), RunCreationMode.AUTO, SnapshotMode.PREPARED);
View Full Code Here

    _cfgMaster.replaceVersion(null);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_replaceVersion_notFound() {
    UniqueId uniqueId = UniqueId.of("DbCfg", "0", "0");
    String val = "Test";
    ConfigDocument doc = new ConfigDocument(ConfigItem.of(val));
    doc.setUniqueId(uniqueId);
    _cfgMaster.replaceVersion(doc);
  }
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.