Package com.opengamma.engine.calcnode

Examples of com.opengamma.engine.calcnode.StandardJob$WholeWatchedJob$Context


  public void testStandardJob_createWatchedJob_singleItem() {
    final JobDispatcher dispatcher = new JobDispatcher();
    final FunctionBlacklistMaintainer blacklist = Mockito.mock(FunctionBlacklistMaintainer.class);
    dispatcher.setFunctionBlacklistMaintainer(blacklist);
    final CalculationJob job = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_A), CacheSelectHint.allShared());
    final StandardJob standard = new StandardJob(dispatcher, job, Mockito.mock(JobResultReceiver.class));
    final WatchedJob watched = standard.createWatchedJob();
    assertNull(watched);
    Mockito.verify(blacklist).failedJobItem(JOB_ITEM_A);
  }
View Full Code Here


  }

  public void testStandardJob_createWatchedJob_noTail() {
    final JobDispatcher dispatcher = new JobDispatcher();
    final CalculationJob job = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_AB, JOB_ITEM_BC), CacheSelectHint.allShared());
    final StandardJob standard = new StandardJob(dispatcher, job, Mockito.mock(JobResultReceiver.class));
    final WatchedJob watched = standard.createWatchedJob();
    assertTrue(watched instanceof WatchedJob.Whole);
    watched.getJob().equals(job);
  }
View Full Code Here

    final JobDispatcher dispatcher = new JobDispatcher();
    final CalculationJob job1 = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_AB), CacheSelectHint.privateValues(Arrays.asList(VS_B)));
    final CalculationJob job2 = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, new long[] {job1.getSpecification().getJobId() }, Arrays.asList(JOB_ITEM_BC),
        CacheSelectHint.privateValues(Arrays.asList(VS_B)));
    job1.addTail(job2);
    final StandardJob standard = new StandardJob(dispatcher, job1, Mockito.mock(JobResultReceiver.class));
    final WatchedJob watched = standard.createWatchedJob();
    assertTrue(watched instanceof WholeWatchedJob);
    assertFalse(watched.getJob().getCacheSelectHint().isPrivateValue(VS_B));
    assertNull(watched.getJob().getTail());
  }
View Full Code Here

      @Override
      protected void dispatchJobImpl(final DispatchableJob job) {
        dispatched.add(job);
      }
    };
    final StandardJob parent = new StandardJob(dispatcher, job1, receiver);
    final WholeWatchedJob wjob1 = parent.createWholeWatchedJob(job1);
    final CalculationJobResult result1 = new CalculationJobResult(job1.getSpecification(), 0, Arrays.asList(CalculationJobResultItem.success()), "Test");
    wjob1.getResultReceiver(result1).resultReceived(result1);
    Mockito.verify(receiver).resultReceived(result1);
    Mockito.reset();
    assertEquals(dispatched.size(), 2);
View Full Code Here

    final JobDispatcher dispatcher = new JobDispatcher();
    final FunctionBlacklistMaintainer blacklist = Mockito.mock(FunctionBlacklistMaintainer.class);
    dispatcher.setFunctionBlacklistMaintainer(blacklist);
    final CalculationJob job = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_A), CacheSelectHint.allShared());
    final JobResultReceiver receiver = Mockito.mock(JobResultReceiver.class);
    final StandardJob standard = new StandardJob(dispatcher, job, receiver);
    final WatchedJob watched = new WatchedJob.Whole(standard, job, receiver);
    watched.prepareRetryJob(null);
    Mockito.verify(blacklist).failedJobItem(JOB_ITEM_A);
  }
View Full Code Here

      }
    };
    final CalculationJob job = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_A, JOB_ITEM_AB), CacheSelectHint.privateValues(Arrays
        .asList(VS_A)));
    final JobResultReceiver receiver = Mockito.mock(JobResultReceiver.class);
    final StandardJob standard = new StandardJob(dispatcher, job, receiver);
    final WatchedJob watched = new WatchedJob.Whole(standard, job, receiver);
    final DispatchableJob split = watched.prepareRetryJob(null);
    final CalculationJob job1 = split.getJob();
    assertEquals(job1.getJobItems(), Arrays.asList(JOB_ITEM_A));
    assertFalse(job1.getCacheSelectHint().isPrivateValue(VS_A));
View Full Code Here

      }
    };
    final CalculationJob job = new CalculationJob(createJobSpecification(), 0, VersionCorrection.LATEST, null, Arrays.asList(JOB_ITEM_A, JOB_ITEM_AB, JOB_ITEM_BC, JOB_ITEM_BCD),
        CacheSelectHint.sharedValues(Arrays.asList(VS_D)));
    final JobResultReceiver receiver = Mockito.mock(JobResultReceiver.class);
    final StandardJob standard = new StandardJob(dispatcher, job, receiver);
    final WatchedJob watched = new WatchedJob.Whole(standard, job, receiver);
    final DispatchableJob split = watched.prepareRetryJob(null);
    final CalculationJob job1 = split.getJob();
    assertEquals(job1.getJobItems(), Arrays.asList(JOB_ITEM_A, JOB_ITEM_AB));
    assertTrue(job1.getCacheSelectHint().isPrivateValue(VS_A));
View Full Code Here

            throw new InvokerException(ioe.getMessage(), ioe.getCause());
        } catch (XMLStreamException xse) {
            throw new InvokerException(xse.getMessage(), xse.getCause());
        }
        executor = new SCXMLExecutor(evaluator, new SimpleDispatcher(), new SimpleErrorReporter());
        Context rootCtx = evaluator.newContext(null);
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            rootCtx.setLocal(entry.getKey(), entry.getValue());
        }
        executor.setRootContext(rootCtx);
        try {
            executor.setStateMachine(scxml);
        }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Set<Entry<String, Object>> entrySet() {
        Set<Entry<String, Object>> entrySet = new HashSet<Entry<String, Object>>();
        Context current = leaf;
        while (current != null) {
            entrySet.addAll(current.getVars().entrySet());
            current = current.getParent();
        }
        return entrySet;
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Object get(final Object key) {
        if (key != null) {
            Context current = leaf;
            while (current != null) {
                if (current.getVars().containsKey(key.toString())) {
                    return current.getVars().get(key);
                }
                current = current.getParent();
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.calcnode.StandardJob$WholeWatchedJob$Context

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.