org.killbill.xmlloader.XMLLoader.getObjectFromString()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(21.9k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.killbill.xmlloader.XMLLoader.getObjectFromString()方法的一些代码示例,展示了XMLLoader.getObjectFromString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLLoader.getObjectFromString()方法的具体详情如下:
包路径:org.killbill.xmlloader.XMLLoader
类名称:XMLLoader
方法名:getObjectFromString

XMLLoader.getObjectFromString介绍

暂无

代码示例

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testConfigLoad() throws Exception {
  XMLLoader.getObjectFromString(Resources.getResource("OverdueConfig.xml").toExternalForm(), DefaultOverdueConfig.class);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testCatalogLoad() {
  try {
    XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class);
    XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
    XMLLoader.getObjectFromString(Resources.getResource("WeaponsHire.xml").toExternalForm(), StandaloneCatalog.class);
    XMLLoader.getObjectFromString(Resources.getResource("WeaponsHireSmall.xml").toExternalForm(), StandaloneCatalog.class);
    XMLLoader.getObjectFromString(Resources.getResource("catalogTest.xml").toExternalForm(), StandaloneCatalog.class);
    XMLLoader.getObjectFromString(Resources.getResource("UsageExperimental.xml").toExternalForm(), StandaloneCatalog.class);
  } catch (Exception e) {
    Assert.fail(e.toString());
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
  public void testMarshallUnmarshall() throws Exception {
    final DefaultOverdueConfig overdueConfig = XMLLoader.getObjectFromString(Resources.getResource("OverdueConfig3.xml").toExternalForm(), DefaultOverdueConfig.class);
    final String overdueConfigStr = XMLWriter.writeXML(overdueConfig, DefaultOverdueConfig.class);

    //System.err.println(overdueConfigStr);
    final DefaultOverdueConfig overdueConfig2 = XMLLoader.getObjectFromStream(new ByteArrayInputStream(overdueConfigStr.getBytes(Charset.forName("UTF-8"))), DefaultOverdueConfig.class);
    final String overdueConfigStr2 = XMLWriter.writeXML(overdueConfig2, DefaultOverdueConfig.class);
    Assert.assertEquals(overdueConfigStr, overdueConfigStr2);
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testMarshallUnmarshall() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final String oldCatalogStr = XMLWriter.writeXML(catalog, StandaloneCatalog.class);
  //System.err.println(oldCatalogStr);
  final StandaloneCatalog oldCatalog = XMLLoader.getObjectFromStream(new ByteArrayInputStream(oldCatalogStr.getBytes(Charset.forName("UTF-8"))), StandaloneCatalog.class);
  final String oldCatalogStr2 = XMLWriter.writeXML(oldCatalog, StandaloneCatalog.class);
  assertEquals(oldCatalogStr2, oldCatalogStr);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testVersionedCatalog() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final DefaultVersionedCatalog versionedCatalog = new DefaultVersionedCatalog(clock);
  versionedCatalog.add(catalog);
  final String newCatalogStr = XMLWriter.writeXML(versionedCatalog, DefaultVersionedCatalog.class);
  //System.err.println(newCatalogStr);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow", expectedExceptions = CatalogApiException.class)
public void testWithInvalidPriceOverride() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  catalog.initialize(catalog);
  final Plan plan = catalog.findCurrentPlan("discount-standard-monthly");
  final List<PlanPhasePriceOverride> overrides = new ArrayList<PlanPhasePriceOverride>();
  final PlanPhasePriceOverride phase1 = new DefaultPlanPhasePriceOverride(plan.getAllPhases()[0].getName(), Currency.USD, null, BigDecimal.ONE, null);
  overrides.add(phase1);
  priceOverride.getOrCreateOverriddenPlan(catalog, plan, new DateTime(catalog.getEffectiveDate()), overrides, internalCallContext);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow")
public void testOverrideLastPhase() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class);
  final Plan plan = catalog.findCurrentPlan("standard-monthly");
  final PlanPhasePriceOverride[] resolvedOverrides = new PlanPhasePriceOverride[plan.getAllPhases().length];
  resolvedOverrides[0] = null;
  resolvedOverrides[1] = new DefaultPlanPhasePriceOverride(plan.getFinalPhase().getName(), Currency.USD, null, new BigDecimal("128.76"), null);
  final CatalogOverridePlanDefinitionModelDao newPlan = catalogOverrideDao.getOrCreateOverridePlanDefinition(plan, new DateTime(catalog.getEffectiveDate()), resolvedOverrides, internalCallContext);
  assertEquals(newPlan.getParentPlanName(), "standard-monthly");
  assertTrue(newPlan.getIsActive());
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testMappingFromExistingCatalog() throws Exception {
  final StandaloneCatalog inputCatalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final StandalonePluginCatalog pluginCatalog = buildStandalonePluginCatalog(inputCatalog);
  final StandaloneCatalogMapper mapper = new StandaloneCatalogMapper(inputCatalog.getCatalogName());
  final StandaloneCatalog output = mapper.toStandaloneCatalog(pluginCatalog);
  output.setRecurringBillingMode(inputCatalog.getRecurringBillingMode());
  Assert.assertEquals(output, inputCatalog);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow")
public void testCreatePlanNoProduct() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final StaticCatalog standaloneCatalogWithPriceOverride = new StandaloneCatalogWithPriceOverride(catalog,
                                                  priceOverride,
                                                  internalCallContext.getTenantRecordId(),
                                                  internalCallContextFactory);
  try {
    final PlanSpecifier specWithNullProduct = new PlanSpecifier(null, BillingPeriod.ANNUAL, "DEFAULT");
    standaloneCatalogWithPriceOverride.createOrFindCurrentPlan(specWithNullProduct, null);
    Assert.fail();
  } catch (final CatalogApiException e) {
    Assert.assertEquals(e.getCode(), ErrorCode.CAT_NULL_PRODUCT_NAME.getCode());
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow")
  public void testCreatePlanInvalidProduct() throws Exception {
    final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
    final StaticCatalog standaloneCatalogWithPriceOverride = new StandaloneCatalogWithPriceOverride(catalog,
                                                    priceOverride,
                                                    internalCallContext.getTenantRecordId(),
                                                    internalCallContextFactory);

    try {
      final PlanSpecifier specWithNullProduct = new PlanSpecifier("INVALID", BillingPeriod.ANNUAL, "DEFAULT");
      standaloneCatalogWithPriceOverride.createOrFindCurrentPlan(specWithNullProduct, null);
      Assert.fail();
    } catch (final CatalogApiException e) {
      Assert.assertEquals(e.getCode(), ErrorCode.CAT_NO_SUCH_PRODUCT.getCode());
    }
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow")
public void testOverrideTwoOutOfThreePhases() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final Plan plan = catalog.findCurrentPlan("discount-standard-monthly");
  final PlanPhasePriceOverride[] resolvedOverrides = new PlanPhasePriceOverride[plan.getAllPhases().length];
  resolvedOverrides[0] = new DefaultPlanPhasePriceOverride(plan.getAllPhases()[0].getName(), Currency.USD, BigDecimal.TEN, null, null);
  resolvedOverrides[1] = null;
  resolvedOverrides[2] = new DefaultPlanPhasePriceOverride(plan.getFinalPhase().getName(), Currency.USD, null, new BigDecimal("348.64"), null);
  final CatalogOverridePlanDefinitionModelDao newPlan = catalogOverrideDao.getOrCreateOverridePlanDefinition(plan, new DateTime(catalog.getEffectiveDate()), resolvedOverrides, internalCallContext);
  assertEquals(newPlan.getParentPlanName(), "discount-standard-monthly");
  assertTrue(newPlan.getIsActive());
  final List<CatalogOverridePhaseDefinitionModelDao> phases = catalogOverrideDao.getOverriddenPlanPhases(newPlan.getRecordId(), internalCallContext);
  assertEquals(phases.size(), 2);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow", description = "https://github.com/killbill/killbill/issues/842")
public void testCreateAmbiguousPlan() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final StaticCatalog standaloneCatalogWithPriceOverride = new StandaloneCatalogWithPriceOverride(catalog,
                                                  priceOverride,

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testUsageCapacityInAdvance() {
  try {
    final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("UsageExperimental.xml").toExternalForm(), StandaloneCatalog.class);
    final Usage[] usages = getUsages(catalog, "capacity-in-advance-monthly");
    assertEquals(usages.length, 1);
    final Usage usage = usages[0];
    assertEquals(usage.getName(), "capacity-in-advance-monthly-usage1");
    assertEquals(usage.getBillingPeriod(), BillingPeriod.MONTHLY);
    assertEquals(usage.getUsageType(), UsageType.CAPACITY);
    assertEquals(usage.getBillingMode(), BillingMode.IN_ADVANCE);
    assertEquals(usage.getTierBlockPolicy(), TierBlockPolicy.ALL_TIERS);
    assertEquals(usage.getBlocks().length, 0);
    assertEquals(usage.getTiers().length, 0);
    assertEquals(usage.getLimits().length, 1);
    assertEquals(usage.getLimits()[0].getUnit().getName(), "members");
    assertEquals(usage.getLimits()[0].getMax(), new Double("100"));
    assertEquals(usage.getRecurringPrice().getPrices().length, 1);
    assertEquals(usage.getRecurringPrice().getPrices()[0].getCurrency(), Currency.BTC);
    assertEquals(usage.getRecurringPrice().getPrices()[0].getValue(), new BigDecimal("100.00"));
  } catch (Exception e) {
    Assert.fail(e.toString());
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testUsageConsumableInAdvancePrepayCredit() {
  try {
    final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("UsageExperimental.xml").toExternalForm(), StandaloneCatalog.class);
    final Usage[] usages = getUsages(catalog, "consumable-in-advance-prepay-credit-monthly");
    assertEquals(usages.length, 1);
    final Usage usage = usages[0];
    assertEquals(usage.getName(), "consumable-in-advance-prepay-credit-monthly-usage1");
    assertEquals(usage.getBillingPeriod(), BillingPeriod.MONTHLY);
    assertEquals(usage.getUsageType(), UsageType.CONSUMABLE);
    assertEquals(usage.getBillingMode(), BillingMode.IN_ADVANCE);
    assertEquals(usage.getLimits().length, 0);
    assertEquals(usage.getTiers().length, 0);
    assertEquals(usage.getBlocks().length, 1);
    assertEquals(usage.getBlocks()[0].getUnit().getName(), "cell-phone-minutes");
    assertEquals(usage.getBlocks()[0].getSize(), new Double("1000"));
    assertEquals(usage.getBlocks()[0].getPrice().getPrices().length, 1);
    assertEquals(usage.getBlocks()[0].getPrice().getPrices()[0].getCurrency(), Currency.BTC);
    assertEquals(usage.getBlocks()[0].getPrice().getPrices()[0].getValue(), new BigDecimal("0.10"));
  } catch (Exception e) {
    Assert.fail(e.toString());
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testUsageConsumableInAdvanceTopUp() {
  try {
    final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("UsageExperimental.xml").toExternalForm(), StandaloneCatalog.class);
    final Usage[] usages = getUsages(catalog, "consumable-in-advance-topup");
    assertEquals(usages.length, 1);
    final Usage usage = usages[0];
    assertEquals(usage.getName(), "consumable-in-advance-topup-usage1");
    assertEquals(usage.getBillingPeriod(), BillingPeriod.NO_BILLING_PERIOD);
    assertEquals(usage.getUsageType(), UsageType.CONSUMABLE);
    assertEquals(usage.getBillingMode(), BillingMode.IN_ADVANCE);
    assertEquals(usage.getLimits().length, 0);
    assertEquals(usage.getTiers().length, 0);
    assertEquals(usage.getBlocks().length, 1);
    assertEquals(usage.getBlocks()[0].getUnit().getName(), "fastrack-tokens");
    assertEquals(usage.getBlocks()[0].getSize(), new Double("10"));
    assertEquals(usage.getBlocks()[0].getPrice().getPrices().length, 1);
    assertEquals(usage.getBlocks()[0].getPrice().getPrices()[0].getCurrency(), Currency.BTC);
    assertEquals(usage.getBlocks()[0].getPrice().getPrices()[0].getValue(), new BigDecimal("0.10"));
    assertEquals(usage.getBlocks()[0].getMinTopUpCredit(), new Double("5"));
  } catch (Exception e) {
    Assert.fail(e.toString());
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "slow")
public void testGetOverriddenPlanPhases() throws Exception {
  final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarAdvanced.xml").toExternalForm(), StandaloneCatalog.class);
  final Plan plan = catalog.findCurrentPlan("discount-standard-monthly");
  final PlanPhasePriceOverride[] resolvedOverrides = new PlanPhasePriceOverride[plan.getAllPhases().length];
  resolvedOverrides[0] = new DefaultPlanPhasePriceOverride(plan.getAllPhases()[0].getName(), Currency.USD, BigDecimal.TEN, BigDecimal.ONE, null);
  resolvedOverrides[1] = new DefaultPlanPhasePriceOverride(plan.getAllPhases()[1].getName(), Currency.USD, BigDecimal.ONE, BigDecimal.TEN, null);
  resolvedOverrides[2] = new DefaultPlanPhasePriceOverride(plan.getFinalPhase().getName(), Currency.USD, BigDecimal.ZERO, new BigDecimal("348.64"), null);
  final CatalogOverridePlanDefinitionModelDao newPlan = catalogOverrideDao.getOrCreateOverridePlanDefinition(plan, new DateTime(catalog.getEffectiveDate()), resolvedOverrides, internalCallContext);
  final List<CatalogOverridePhaseDefinitionModelDao> phases = catalogOverrideDao.getOverriddenPlanPhases(newPlan.getRecordId(), internalCallContext);
  assertEquals(phases.size(), 3);
  for (int i = 0; i < 3; i++) {
    final CatalogOverridePhaseDefinitionModelDao curPhase = phases.get(i);
    assertEquals(curPhase.getCurrency(), resolvedOverrides[i].getCurrency().name());
    assertEquals(curPhase.getFixedPrice().compareTo(resolvedOverrides[i].getFixedPrice()), 0);
    assertEquals(curPhase.getRecurringPrice().compareTo(resolvedOverrides[i].getRecurringPrice()), 0);
    assertEquals(curPhase.getParentPhaseName(), resolvedOverrides[i].getPhaseName());
  }
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testAddPlanOnExistingCatalog() throws Exception {
  final StandaloneCatalog originalCatalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class);
  assertEquals(originalCatalog.getPriceLists().getAllPriceLists().size(), 1);
  assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getName(), new PriceListDefault().getName());
  assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().size(), 3);
  final CatalogUpdater catalogUpdater = new CatalogUpdater(originalCatalog);
  final SimplePlanDescriptor desc = new DefaultSimplePlanDescriptor("standard-annual", "Standard", ProductCategory.BASE, Currency.USD, BigDecimal.TEN, BillingPeriod.MONTHLY, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
  catalogUpdater.addSimplePlanDescriptor(desc);
  final StandaloneCatalog catalog = catalogUpdater.getCatalog();
  final Plan plan = catalog.findCurrentPlan("standard-annual");
  assertEquals(plan.getName(), "standard-annual");
  assertEquals(plan.getInitialPhases().length, 0);
  assertEquals(plan.getFinalPhase().getPhaseType(), PhaseType.EVERGREEN);
  assertNull(plan.getFinalPhase().getFixed());
  assertEquals(plan.getFinalPhase().getName(), "standard-annual-evergreen");
  assertEquals(plan.getFinalPhase().getRecurring().getBillingPeriod(), BillingPeriod.MONTHLY);
  assertEquals(plan.getFinalPhase().getRecurring().getRecurringPrice().getPrices().length, 1);
  assertEquals(plan.getFinalPhase().getRecurring().getRecurringPrice().getPrices()[0].getValue(), BigDecimal.TEN);
  assertEquals(plan.getFinalPhase().getRecurring().getRecurringPrice().getPrices()[0].getCurrency(), Currency.USD);
  assertEquals(catalog.getPriceLists().getAllPriceLists().size(), 1);
  final PriceList priceList = catalog.getPriceLists().getAllPriceLists().get(0);
  assertEquals(priceList.getName(), new PriceListDefault().getName());
  assertEquals(priceList.getPlans().size(), 4);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testAddExistingPlanWithNewCurrency() throws Exception {
  final StandaloneCatalog originalCatalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class);
  assertEquals(originalCatalog.getPriceLists().getAllPriceLists().size(), 1);
  assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getName(), new PriceListDefault().getName());
  assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().size(), 3);
  final CatalogUpdater catalogUpdater = new CatalogUpdater(originalCatalog);
  final SimplePlanDescriptor desc = new DefaultSimplePlanDescriptor("standard-monthly", "Standard", ProductCategory.BASE, Currency.EUR, BigDecimal.TEN, BillingPeriod.MONTHLY, 30, TimeUnit.DAYS, ImmutableList.<String>of());
  catalogUpdater.addSimplePlanDescriptor(desc);
  final StandaloneCatalog catalog = catalogUpdater.getCatalog();
  final Plan plan = catalog.findCurrentPlan("standard-monthly");
  assertEquals(plan.getName(), "standard-monthly");
  assertEquals(plan.getInitialPhases().length, 1);
  assertEquals(plan.getInitialPhases()[0].getPhaseType(), PhaseType.TRIAL);
  assertEquals(plan.getInitialPhases()[0].getFixed().getPrice().getPrices().length, 0);
  assertEquals(plan.getInitialPhases()[0].getFixed().getPrice().getPrice(Currency.EUR), BigDecimal.ZERO);
  assertEquals(plan.getInitialPhases()[0].getName(), "standard-monthly-trial");
  assertEquals(plan.getFinalPhase().getPhaseType(), PhaseType.EVERGREEN);
  assertNull(plan.getFinalPhase().getFixed());
  assertEquals(plan.getFinalPhase().getName(), "standard-monthly-evergreen");
  assertEquals(plan.getFinalPhase().getRecurring().getBillingPeriod(), BillingPeriod.MONTHLY);
  assertEquals(plan.getFinalPhase().getRecurring().getRecurringPrice().getPrices().length, 3);
  assertEquals(plan.getFinalPhase().getRecurring().getRecurringPrice().getPrice(Currency.EUR), BigDecimal.TEN);
}

代码示例来源:origin: killbill/killbill

@Test(groups = "fast")
public void testLoadCatalogWithValidationIssues() throws Exception {
  try {
    XMLLoader.getObjectFromString(Resources.getResource("CatalogWithValidationErrors.xml").toExternalForm(), StandaloneCatalog.class);
    Assert.fail();
  } catch (final ValidationException e) {
    Assert.assertEquals(e.getErrors().size(), 13);
    Assert.assertEquals(e.getErrors().get(0).getDescription(), "Invalid product for plan 'standard'");
    Assert.assertEquals(e.getErrors().get(1).getDescription(), "Duration can only have 'UNLIMITED' unit if the number is omitted");
    Assert.assertEquals(e.getErrors().get(2).getDescription(), "Finite Duration must have a well defined length");
    Assert.assertEquals(e.getErrors().get(3).getDescription(), "Initial Phase standard-trial-evergreen of plan standard-trial cannot be of type EVERGREEN");
    Assert.assertEquals(e.getErrors().get(4).getDescription(), "Final Phase standard-trial-trial of plan standard-trial cannot be of type TRIAL");
    Assert.assertEquals(e.getErrors().get(5).getDescription(), "Duplicate rule for change plan DefaultCaseChangePlanPolicy {policy=IMMEDIATE, phaseType=null, fromProduct=DefaultProduct{name='Standard', category=BASE, included=org.killbill.billing.catalog.CatalogEntityCollection@0, available=org.killbill.billing.catalog.CatalogEntityCollection@0, limits=[], catalogName='CatalogWithValidationErrors'}, fromProductCategory=null, fromBillingPeriod=null, fromPriceList=null, toProduct=null, toProductCategory=null, toBillingPeriod=null, toPriceList=null}");
    Assert.assertEquals(e.getErrors().get(6).getDescription(), "Missing default rule case for plan change");
    Assert.assertEquals(e.getErrors().get(7).getDescription(), "Duplicate rule for plan cancellation DefaultCaseCancelPolicy{policy =IMMEDIATE, phaseType =null, product=DefaultProduct{name='Standard', category=BASE, included=org.killbill.billing.catalog.CatalogEntityCollection@0, available=org.killbill.billing.catalog.CatalogEntityCollection@0, limits=[], catalogName='CatalogWithValidationErrors'}, productCategory=null, billingPeriod=null, priceList=null}");
    Assert.assertEquals(e.getErrors().get(8).getDescription(), "Missing default rule case for plan cancellation");
    Assert.assertEquals(e.getErrors().get(9).getDescription(), "Duplicate rule for plan change alignment DefaultCaseChangePlanAlignment {alignment=START_OF_BUNDLE, phaseType=null, fromProduct=null, fromProductCategory=null, fromBillingPeriod=null, fromPriceList=null, toProduct=null, toProductCategory=null, toBillingPeriod=null, toPriceList=null}");
    Assert.assertEquals(e.getErrors().get(10).getDescription(), "Duplicate rule for create plan alignment DefaultCaseCreateAlignment {alignment =START_OF_BUNDLE, product=null, productCategory=null, billingPeriod=null, priceList=null}");
    Assert.assertEquals(e.getErrors().get(11).getDescription(), "Duplicate rule for billing alignment DefaultCaseBillingAlignment {alignment=ACCOUNT, phaseType=null, product=null, productCategory=null, billingPeriod=null, priceList=null}");
    Assert.assertEquals(e.getErrors().get(12).getDescription(), "Duplicate rule for price list transition DefaultCasePriceList {fromProduct=null, fromProductCategory=null, fromBillingPeriod=null, fromPriceList=null, toPriceList=DefaultPriceList{name='DEFAULT}}");
  }
}

代码示例来源:origin: killbill/killbill

final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("UsageExperimental.xml").toExternalForm(), StandaloneCatalog.class);

相关文章