@Override public Result<BlackBondFuturesProviderInterface> getBlackBondFuturesProvider(Environment env, BondFutureOptionTrade tradeWrapper) { Result<IssuerProviderBundle> bundleResult = _discountingMulticurveCombinerFn.getMulticurveBundle(env, tradeWrapper.getTrade()); if (bundleResult.isSuccess()) { IssuerProviderDiscount multicurve = (IssuerProviderDiscount) bundleResult.getValue().getParameterIssuerProvider(); Surface<Double, Double, Double> blackParameters = testSurface; LegalEntity simpleLegalEntity = new LegalEntity("", "", Sets.<CreditRating>newHashSet(), Sector.of(""), Region.of("")); BlackBondFuturesProviderInterface black = new BlackBondFuturesFlatProviderDiscount(multicurve, blackParameters, simpleLegalEntity); return Result.success(black); } return Result.failure(bundleResult); }
public static CurveConstructionConfiguration getBondCurveConfig() { Set<LegalEntityFilter<LegalEntity>> filters = Sets.newHashSet(); filters.add(new LegalEntityShortName()); Set<Object> govKeys = Sets.newHashSet(); govKeys.add(GOVERNMENT_BOND_ISSUER_KEY); List<CurveTypeConfiguration> configs = Lists.newArrayList(); configs.add(new IssuerCurveTypeConfiguration(govKeys, filters)); configs.add(new DiscountingCurveTypeConfiguration(Currency.GBP.getCode())); Map<String, List<? extends CurveTypeConfiguration>> curveTypes = Maps.newHashMap(); curveTypes.put(BOND_GBP_CURVE_NAME, configs); return new CurveConstructionConfiguration(BOND_CURVE_CONFIG_NAME, Lists.newArrayList(new CurveGroupConfiguration(0, curveTypes)), Collections.<String>emptyList()); }
private static CurveConstructionConfiguration getBondPreCalibratedCurveConfig() { Set<LegalEntityFilter<LegalEntity>> filters = Sets.newHashSet(); filters.add(new LegalEntityShortName()); Set<Object> govKeys = Sets.newHashSet(); govKeys.add(GOVERNMENT_BOND_ISSUER_KEY); Set<Object> corpKeys = Sets.newHashSet(); corpKeys.add(CORPORATE_BOND_ISSUER_KEY); List<CurveTypeConfiguration> configs = Lists.newArrayList(); configs.add(new IssuerCurveTypeConfiguration(corpKeys, filters)); configs.add(new IssuerCurveTypeConfiguration(govKeys, filters)); Map<String, List<? extends CurveTypeConfiguration>> curveTypes = Maps.newHashMap(); curveTypes.put(BOND_GBP_PRE_CALIBRATED_CURVE_NAME, configs); return new CurveConstructionConfiguration(BOND_PRE_CALIBRATED_CURVE_CONFIG_NAME, Lists.newArrayList(new CurveGroupConfiguration(0, curveTypes)), Collections.<String>emptyList()); }
private Set<String> getArtifactIds(Collection<MavenDeployer> deployers) { Set<String> result = Sets.newHashSet(); for (MavenDeployer deployer : deployers) { result.add(deployer.getPom().getArtifactId()); } return result; }
@Test public void storeJobAndTriggers() throws ObjectAlreadyExistsException, JobPersistenceException { Map<JobDetail, Set<? extends Trigger>> triggersAndJobs = Maps .newHashMap(); JobDetail job1 = buildJob(); OperableTrigger trigger1 = buildTrigger(job1); Set<Trigger> set1 = Sets.newHashSet(); set1.add(trigger1); triggersAndJobs.put(job1, set1); JobDetail job2 = buildJob(); OperableTrigger trigger2 = buildTrigger(job2); Set<Trigger> set2 = Sets.newHashSet(); set2.add(trigger2); triggersAndJobs.put(job2, set2); jobStore.storeJobsAndTriggers(triggersAndJobs, false); JobDetail retrieveJob1 = retrieveJob(job1.getKey().getName()); assertNotNull(retrieveJob1); JobDetail retrieveJob2 = retrieveJob(job2.getKey().getName()); assertNotNull(retrieveJob2); OperableTrigger retrieveTrigger1 = retrieveTrigger(trigger1.getKey()); assertNotNull(retrieveTrigger1); OperableTrigger retrieveTrigger2 = retrieveTrigger(trigger2.getKey()); assertNotNull(retrieveTrigger2); }
@Test(expectedExceptions = { ObjectAlreadyExistsException.class }) public void storeJobAndTriggersThrowException() throws ObjectAlreadyExistsException, JobPersistenceException { Map<JobDetail, Set<? extends Trigger>> triggersAndJobs = Maps.newHashMap(); JobDetail job1 = buildJob(); storeJob(job1); OperableTrigger trigger1 = buildTrigger(job1); Set<Trigger> set1 = Sets.newHashSet(); set1.add(trigger1); triggersAndJobs.put(job1, set1); jobStore.storeJobsAndTriggers(triggersAndJobs, false); }
@Test public void storeJobAndTriggers() throws ObjectAlreadyExistsException, JobPersistenceException { final Map<JobDetail, Set<? extends Trigger>> triggersAndJobs = Maps .newHashMap(); final JobDetail job1 = buildJob(); final Trigger trigger1 = buildTrigger(job1); final Set<Trigger> set1 = Sets.newHashSet(); set1.add(trigger1); triggersAndJobs.put(job1, set1); final JobDetail job2 = buildJob(); final Trigger trigger2 = buildTrigger(job2); final Set<Trigger> set2 = Sets.newHashSet(); set2.add(trigger2); triggersAndJobs.put(job2, set2); jobStore.storeJobsAndTriggers(triggersAndJobs, false); final JobDetail retrieveJob1 = retrieveJob(job1.getKey().getName()); assertThat(retrieveJob1).isNotNull(); final JobDetail retrieveJob2 = retrieveJob(job2.getKey().getName()); assertThat(retrieveJob2).isNotNull(); final Trigger retrieveTrigger1 = retrieveTrigger(trigger1.getKey()); assertThat(retrieveTrigger1).isNotNull(); final Trigger retrieveTrigger2 = retrieveTrigger(trigger2.getKey()); assertThat(retrieveTrigger2).isNotNull(); }
@Test(expectedExceptions = { ObjectAlreadyExistsException.class }) public void storeJobAndTriggersThrowException() throws ObjectAlreadyExistsException, JobPersistenceException { Map<JobDetail, Set<? extends Trigger>> triggersAndJobs = Maps.newHashMap(); JobDetail job1 = buildJob(); storeJob(job1); Trigger trigger1 = buildTrigger(job1); Set<Trigger> set1 = Sets.newHashSet(); set1.add(trigger1); triggersAndJobs.put(job1, set1); jobStore.storeJobsAndTriggers(triggersAndJobs, false); }
private HaeinsaTestingCluster() throws Exception { Configuration conf = HBaseConfiguration.create(); HBaseTestingUtility utility = new HBaseTestingUtility(conf); utility.cleanupTestDir(); cluster = utility.startMiniCluster(); configuration = cluster.getConfiguration(); threadPool = Executors.newCachedThreadPool(); haeinsaTablePool = TestingUtility.createHaeinsaTablePool(configuration, threadPool); hbaseTablePool = new HTablePool(configuration, 128, PoolType.Reusable); transactionManager = new HaeinsaTransactionManager(haeinsaTablePool); createdTableNames = Sets.newHashSet(); }