Package com.opengamma.engine

Examples of com.opengamma.engine.ComputationTargetSpecification


    req = req.containing(ComputationTargetType.SECURITY, ExternalId.of("Foo", "Underlying"));
    assertEncodeDecodeCycle(ComputationTargetReference.class, req);
  }

  public void testSpecification_nested() {
    ComputationTargetSpecification spec = new ComputationTargetSpecification(ComputationTargetType.SECURITY, UniqueId.of("Foo", "Bar"));
    spec = spec.containing(ComputationTargetType.SECURITY, UniqueId.of("Foo", "Underlying"));
    assertEncodeDecodeCycle(ComputationTargetReference.class, spec);
  }
View Full Code Here


    final ComputationTargetRequirement req = new ComputationTargetRequirement(ComputationTargetType.POSITION.or(ComputationTargetType.SECURITY), ExternalId.of("Foo", "Bar"));
    assertEncodeDecodeCycle(ComputationTargetReference.class, req);
  }

  public void testSpecification_multiple() {
    final ComputationTargetSpecification spec = new ComputationTargetSpecification(ComputationTargetType.POSITION.or(ComputationTargetType.SECURITY), UniqueId.of("Foo", "Bar"));
    assertEncodeDecodeCycle(ComputationTargetReference.class, spec);
  }
View Full Code Here

    ValueProperties properties = ValueProperties.builder()
        .with(ValuePropertyNames.FUNCTION, "MarketDataSourcingFunction")
        .get();

    ComputationTargetSpecification targetSpecification =
        new ComputationTargetSpecification(ComputationTargetType.PRIMITIVE, uniqueId);

    return new ValueSpecification(valueName, targetSpecification, properties);
  }
View Full Code Here

public class InvalidTargetDependencyNodeFilterTest {

  public void testAccept() {
    final Set<UniqueId> invalid = ImmutableSet.of(UniqueId.of("Sec", "1"), UniqueId.of("Pos", "2"), UniqueId.of("Pos", "3", "X"));
    final InvalidTargetDependencyNodeFilter filter = new InvalidTargetDependencyNodeFilter(invalid);
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "1")))));
    assertFalse(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "2")))));
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "2", "V")))));
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "3")))));
    assertFalse(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "3", "X")))));
    assertTrue(filter.accept(new DependencyNode(new ComputationTargetSpecification(ComputationTargetType.POSITION, UniqueId.of("Pos", "3", "Y")))));
    assertTrue(filter.accept(new DependencyNode(ComputationTargetSpecification.NULL)));
  }
View Full Code Here

  @Override
  protected void testImpl(final Function2<ParallelRecompilationViewProcessWorker, ViewExecutionOptions, Void> callback) throws InterruptedException {
    final ExecutorService executor = Executors.newCachedThreadPool();
    try {
      final Map<ComputationTargetReference, UniqueId> resolutions = new HashMap<ComputationTargetReference, UniqueId>();
      resolutions.put(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO, UniqueId.of("Test", "0")), UniqueId.of("Test", "0", "0"));
      final ChangeManager changeManager = new BasicChangeManager();
      final ComputationTargetResolver targetResolver = Mockito.mock(ComputationTargetResolver.class);
      Mockito.when(targetResolver.changeManager()).thenReturn(changeManager);
      final FunctionCompilationContext ctx = new FunctionCompilationContext();
      ctx.setRawComputationTargetResolver(targetResolver);
      final CompiledFunctionService cfs = Mockito.mock(CompiledFunctionService.class);
      Mockito.when(cfs.getFunctionCompilationContext()).thenReturn(ctx);
      final ViewProcessContext vpContext = Mockito.mock(ViewProcessContext.class);
      Mockito.when(vpContext.getFunctionCompilationService()).thenReturn(cfs);
      final MockContext context = new MockContext(vpContext);
      final ViewExecutionOptions options = ExecutionOptions.infinite(MarketData.live(), ExecutionFlags.none().ignoreCompilationValidity().get());
      final ViewDefinition viewDefinition = Mockito.mock(ViewDefinition.class);
      final ParallelRecompilationViewProcessWorker worker = new ParallelRecompilationViewProcessWorker(workerFactory(executor, resolutions), context, options, viewDefinition);
      callback.execute(worker, options);
      s_logger.debug("Waiting for initial compilation");
      assertEquals(context.event(), "view definition compiled"); // From primary worker
      for (int j = 0; j < 5; j++) {
        // Expect a sequence of operations
        for (int i = 0; i < 3; i++) {
          s_logger.debug("Waiting for cycle to start");
          assertEquals(context.event(), "cycle started"); // From primary worker
          s_logger.info("Cycle started");
          assertEquals(context.event(), "cycle fragment completed");
          s_logger.info("Cycle fragment completed");
          assertEquals(context.event(), "cycle completed");
          s_logger.info("Cycle completed");
        }
        // Signal change ...
        s_logger.debug("Signalling change");
        resolutions.put(new ComputationTargetSpecification(ComputationTargetType.PORTFOLIO, UniqueId.of("Test", "0")), UniqueId.of("Test", "0", Integer.toString(j + 1)));
        changeManager.entityChanged(ChangeType.CHANGED, ObjectId.of("Test", "0"), Instant.now(), Instant.now(), Instant.now());
        s_logger.info("Change signalled");
        // ... and expect a view definition compiled to interrupt the sequence
        String event = context.event();
        for (int i = 0; i < 20; i++) {
View Full Code Here

  private UniqueId id(final int id) {
    return UniqueId.of("Test", Integer.toString(id));
  }

  private ComputationTargetSpecification target(final int id) {
    return new ComputationTargetSpecification(ComputationTargetType.PRIMITIVE, id(id));
  }
View Full Code Here

      final Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
    final ValueRequirement desiredValue = Iterables.getOnlyElement(desiredValues);
    final HistoricalTimeSeriesBundle bundle = new HistoricalTimeSeriesBundle();
    final CurveConstructionConfiguration constructionConfig = (CurveConstructionConfiguration) inputs.getValue(ValueRequirementNames.CURVE_CONSTRUCTION_CONFIG);
    final List<CurveGroupConfiguration> groups = constructionConfig.getCurveGroups();
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    for (final CurveGroupConfiguration group : groups) {
      //TODO do we want to put information in about whether or not to use fixing time series?
      //TODO do we want to exclude node types that definitely don't need fixing data?
      for (final Map.Entry<String, List<CurveTypeConfiguration>> entry : group.getTypesForCurves().entrySet()) {
        final String curveName = entry.getKey();
View Full Code Here

    final String curveConstructionConfig = Iterables.getOnlyElement(curveConstructionConfigs);
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final CurveConstructionConfiguration constructionConfig = new ConfigDBCurveConstructionConfigurationSource(configSource).getCurveConstructionConfiguration(curveConstructionConfig);
    final Set<ValueRequirement> requirements = new HashSet<>();
    final List<CurveGroupConfiguration> groups = constructionConfig.getCurveGroups();
    final ComputationTargetSpecification targetSpec = target.toSpecification();
    for (final CurveGroupConfiguration group : groups) {
      //TODO do we want to put information in about whether or not to use fixing time series?
      //TODO do we want to exclude node types that definitely don't need fixing data?
      for (final Map.Entry<String, List<CurveTypeConfiguration>> entry : group.getTypesForCurves().entrySet()) {
        final String curveName = entry.getKey();
View Full Code Here

      uniqueCurrencies.add(pair.getFirstCurrency());
      uniqueCurrencies.add(pair.getSecondCurrency());
    }
    for (Currency currency : uniqueCurrencies) {
      final String name = currency.getCode() + "FX";
      final ComputationTargetSpecification target = ComputationTargetSpecification.of(currency);
      final MultiCurveCalculationConfig config = new MultiCurveCalculationConfig(name, CURVE_NAMES, target, FXImpliedYieldCurveFunction.FX_IMPLIED,
          null, EXOGENOUS_CURVE_CONFIGS);
      ConfigMasterUtils.storeByName(configMaster, makeConfig(config));
    }
  }
View Full Code Here

  }

  @Override
  public void init(final FunctionCompilationContext context) {
    _definition = _helper.init(context, this);
    final ComputationTargetSpecification currencySpec = ComputationTargetSpecification.of(_helper.getCurrency());
    _marketDataResult = new ValueSpecification(ValueRequirementNames.VOLATILITY_CUBE_MARKET_DATA, currencySpec,
        createValueProperties().with(ValuePropertyNames.CUBE, _helper.getDefinitionName()).get());
    _results = Sets.newHashSet(_marketDataResult);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.ComputationTargetSpecification

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.