@Test(dataProvider = "dpTestCreate") public void testCreate(final String totalQueryCostCeilingPerUser, final QueryLaunchingConstraint expectedConstraint) { Configuration conf = new Configuration(); conf.set(LensConfConstants.TOTAL_QUERY_COST_CEILING_PER_USER_KEY, totalQueryCostCeilingPerUser); ConfigBasedObjectCreationFactory<QueryLaunchingConstraint> fac = new TotalQueryCostCeilingConstraintFactory(); assertEquals(fac.create(conf), expectedConstraint); }
@Override public QueryLaunchingConstraint create(Configuration conf) { final Double costCeiling = Double.parseDouble(conf.get(TOTAL_QUERY_COST_CEILING_PER_USER_KEY)); Optional<QueryCost> totalQueryCostCeilingPerUser = Optional.absent(); if (costCeiling >= 0.0) { totalQueryCostCeilingPerUser = Optional.<QueryCost>of(new FactPartitionBasedQueryCost(costCeiling)); } return new TotalQueryCostCeilingConstraint(totalQueryCostCeilingPerUser); }
TotalQueryCostCeilingConstraintFactory implements ConfigBasedObjectCreationFactory<QueryLaunchingConstraint> { @Override public QueryLaunchingConstraint create(Configuration conf) { final Double costCeiling = Double.parseDouble(conf.get(TOTAL_QUERY_COST_CEILING_PER_USER_KEY)); Optional<QueryCost> totalQueryCostCeilingPerUser = Optional.absent(); if (costCeiling >= 0.0) { totalQueryCostCeilingPerUser = Optional.<QueryCost>of(new FactPartitionBasedQueryCost(costCeiling)); } return new TotalQueryCostCeilingConstraint(totalQueryCostCeilingPerUser); } }
TotalQueryCostCeilingConstraintFactory implements ConfigBasedObjectCreationFactory<QueryLaunchingConstraint> { @Override public QueryLaunchingConstraint create(Configuration conf) { final Double costCeiling = Double.parseDouble(conf.get(TOTAL_QUERY_COST_CEILING_PER_USER_KEY)); Optional<QueryCost> totalQueryCostCeilingPerUser = Optional.absent(); if (costCeiling >= 0.0) { totalQueryCostCeilingPerUser = Optional.<QueryCost>of(new FactPartitionBasedQueryCost(costCeiling)); } return new TotalQueryCostCeilingConstraint(totalQueryCostCeilingPerUser); }  }
TotalQueryCostCeilingConstraintFactory implements ConfigBasedObjectCreationFactory<QueryLaunchingConstraint> { @Override public QueryLaunchingConstraint create(Configuration conf) { final Double costCeiling = Double.parseDouble(conf.get(TOTAL_QUERY_COST_CEILING_PER_USER_KEY)); Optional<QueryCost> totalQueryCostCeilingPerUser = Optional.absent(); if (costCeiling >= 0.0) { totalQueryCostCeilingPerUser = Optional.<QueryCost>of(new FactPartitionBasedQueryCost(costCeiling)); } return new TotalQueryCostCeilingConstraint(totalQueryCostCeilingPerUser); }  @Override QueryLaunchingConstraint create(Configuration conf); }
TotalQueryCostCeilingConstraintFactory implements ConfigBasedObjectCreationFactory<QueryLaunchingConstraint> { @Override public QueryLaunchingConstraint create(Configuration conf) { final Double costCeiling = Double.parseDouble(conf.get(TOTAL_QUERY_COST_CEILING_PER_USER_KEY)); Optional<QueryCost> totalQueryCostCeilingPerUser = Optional.absent(); if (costCeiling >= 0.0) { totalQueryCostCeilingPerUser = Optional.<QueryCost>of(new FactPartitionBasedQueryCost(costCeiling)); } return new TotalQueryCostCeilingConstraint(totalQueryCostCeilingPerUser); }  @Override QueryLaunchingConstraint create(Configuration conf);  }