Package com.opengamma.engine.target.Primitive

Examples of com.opengamma.engine.target.Primitive.ExternalIdentifiablePrimitive


  public void testPresent() {
    final MarketDataAvailabilityFilter availability = create();
    final ComputationTargetSpecification targetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Security", "Foo"));
    final ValueRequirement desiredValue = new ValueRequirement("Market_Value", targetSpec);
    assertTrue(availability.isAvailable(targetSpec, new Primitive(UniqueId.of("Security", "Foo")), desiredValue));
    assertTrue(availability.isAvailable(targetSpec, new ExternalIdentifiablePrimitive(UniqueId.of("Security", "Foo"), ExternalId.of("Foo", "Bar")), desiredValue));
  }
View Full Code Here


  }

  public void testGetAvailability_externalId_nomatch() {
    final MarketDataAvailabilityFilter availability = create();
    final ComputationTargetSpecification targetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Security", "Foo"));
    final Object target = new ExternalIdentifiablePrimitive(UniqueId.of("Security", "Foo"), ExternalId.of("BAD", "Foo"));
    ValueRequirement desiredValue = new ValueRequirement("Cow", targetSpec);
    assertFalse(availability.isAvailable(targetSpec, target, desiredValue));
    desiredValue = new ValueRequirement("Foo", targetSpec);
    assertFalse(availability.isAvailable(targetSpec, target, desiredValue));
  }
View Full Code Here

  }

  public void testGetAvailability_externalId_match() {
    final MarketDataAvailabilityFilter availability = create();
    final ComputationTargetSpecification targetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Security", "Foo"));
    final Object target = new ExternalIdentifiablePrimitive(UniqueId.of("Security", "Foo"), ExternalId.of("Ticker", "Foo"));
    ValueRequirement desiredValue = new ValueRequirement("Cow", targetSpec);
    assertFalse(availability.isAvailable(targetSpec, target, desiredValue));
    desiredValue = new ValueRequirement("Foo", targetSpec);
    assertTrue(availability.isAvailable(targetSpec, target, desiredValue));
  }
View Full Code Here

  }

  public void testPresent_externalId() {
    final MarketDataAvailabilityFilter availability = create();
    final ComputationTargetSpecification targetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Security", "Foo"));
    final Object target = new ExternalIdentifiablePrimitive(UniqueId.of("Security", "Foo"), ExternalId.of("Ticker", "Foo"));
    final ValueRequirement desiredValue = new ValueRequirement("Bar", targetSpec);
    assertTrue(availability.isAvailable(targetSpec, target, desiredValue));
  }
View Full Code Here

  }

  public void testGetAvailability_externalId() {
    final MarketDataAvailabilityProvider availability = create();
    final ComputationTargetSpecification targetSpec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Security", "Foo"));
    final Object target = new ExternalIdentifiablePrimitive(UniqueId.of("Security", "Foo"), ExternalId.of("Ticker", "Foo"));
    final ValueRequirement desiredValue = new ValueRequirement("Bar", targetSpec);
    assertEquals(availability.getAvailability(targetSpec, target, desiredValue).getProperty(ValuePropertyNames.FUNCTION), "externalId");
  }
View Full Code Here

      protected void populateAvailabilityHintKey(final Collection<Serializable> key) {
        // Don't care
      }

    };
    final Object target = new ExternalIdentifiablePrimitive(targetSpec.getUniqueId(), identifier);
    assertTrue(filter.isAvailable(targetSpec, target, desiredValue));
    final AbstractMarketDataAvailabilityProvider provider = Mockito.mock(AbstractMarketDataAvailabilityProvider.class);
    final ValueSpecification valueSpec = new ValueSpecification(desiredValue.getValueName(), targetSpec, ValueProperties.with(ValuePropertyNames.FUNCTION, "Mock").get());
    Mockito.when(provider.getAvailability(targetSpec, identifier, desiredValue)).thenReturn(valueSpec);
    assertEquals(filter.withProvider(provider).getAvailability(targetSpec, target, desiredValue), valueSpec);
View Full Code Here

      if (schemes != null) {
        final String[] values = unescape(uniqueId.getValue(), 0);
        if (values != null) {
          if (schemes.length == values.length) {
            if (schemes.length == 1) {
              return new ExternalIdentifiablePrimitive(uniqueId, ExternalId.of(schemes[0], values[0]));
            } else {
              final ExternalId[] identifiers = new ExternalId[schemes.length];
              for (int i = 0; i < schemes.length; i++) {
                identifiers[i] = ExternalId.of(schemes[i], values[i]);
              }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.target.Primitive.ExternalIdentifiablePrimitive

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.