Package com.opengamma.core.change

Examples of com.opengamma.core.change.ChangeManager


  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++) {
          if (event.equals("cycle started")) {
View Full Code Here


  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    ComponentInfo info = new ComponentInfo(RegionMaster.class, getClassifier());
   
    // create
    String scheme = (getUniqueIdScheme() != null ? getUniqueIdScheme() : InMemoryRegionMaster.DEFAULT_OID_SCHEME);
    ChangeManager cm = new BasicChangeManager();
    if (getJmsChangeManagerTopic() != null) {
      cm = new JmsChangeManager(getJmsConnector(), getJmsChangeManagerTopic());
      repo.registerLifecycle((Lifecycle) cm);
      if (getJmsConnector().getClientBrokerUri() != null) {
        info.addAttribute(ComponentInfoAttributes.JMS_BROKER_URI, getJmsConnector().getClientBrokerUri().toString());
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    final LongPollingConnectionManager longPolling = buildLongPolling();
    ChangeManager changeMgr = buildChangeManager();
    MasterChangeManager masterChangeMgr = buildMasterChangeManager();
    final ConnectionManagerImpl connectionMgr = new ConnectionManagerImpl(changeMgr, masterChangeMgr, longPolling);
    AggregatorNamesResource aggregatorsResource = new AggregatorNamesResource(getPortfolioAggregationFunctions().getMappedFunctions().keySet());
    MarketDataSnapshotListResource snapshotResource = new MarketDataSnapshotListResource(getMarketDataSnapshotMaster());
    MasterConfigSource configSource = new MasterConfigSource(getConfigMaster());
View Full Code Here

    Mockito.verifyNoMoreInteractions(underlying);
  }

  public void testCacheManager() {
    final TempTargetRepository underlying = Mockito.mock(TempTargetRepository.class);
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(underlying.changeManager()).thenReturn(changeManager);
    final TempTargetRepository cache = new EHCachingTempTargetRepository(underlying, _cacheManager);
    assertSame(cache.changeManager(), changeManager);
    Mockito.verify(underlying, Mockito.only()).changeManager();
  }
View Full Code Here

   * Creates a fresh mock master and configures it to respond as though it contains the above documents
   * @return the mock master
   */
  protected AbstractChangeProvidingMaster<D> populateMockMaster(M mockUnderlyingMaster) {

    ChangeManager changeManager = new BasicChangeManager();
    when(mockUnderlyingMaster.changeManager()).thenReturn(changeManager);

    // Set up VersionFrom, VersionTo, CorrectionFrom, CorrectionTo

    // Document A 100: v 1999 to 2010, c to 2011
View Full Code Here

TOP

Related Classes of com.opengamma.core.change.ChangeManager

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.