Search in sources :

Example 21 with DefaultProduct

use of org.killbill.billing.catalog.DefaultProduct in project killbill by killbill.

the class TestCaseChange method testWildcardFromProductCategory.

@Test(groups = "fast")
public void testWildcardFromProductCategory() throws CatalogApiException {
    final MockCatalog cat = new MockCatalog();
    final DefaultProduct product1 = cat.getCurrentProduct(0);
    final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
    final DefaultProduct product2 = cat.getCurrentProduct(2);
    final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
    final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, product2, null, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
Also used : MockCatalog(org.killbill.billing.catalog.MockCatalog) DefaultProduct(org.killbill.billing.catalog.DefaultProduct) DefaultPriceList(org.killbill.billing.catalog.DefaultPriceList) Test(org.testng.annotations.Test)

Example 22 with DefaultProduct

use of org.killbill.billing.catalog.DefaultProduct in project killbill by killbill.

the class TestCaseChange method testWildcardFromProduct.

@Test(groups = "fast")
public void testWildcardFromProduct() throws CatalogApiException {
    final MockCatalog cat = new MockCatalog();
    final DefaultProduct product1 = cat.getCurrentProduct(0);
    final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
    final DefaultProduct product2 = cat.getCurrentProduct(2);
    final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
    final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(null, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertion(Result.FOO, cr, cat.getCurrentProduct(1).getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
Also used : MockCatalog(org.killbill.billing.catalog.MockCatalog) DefaultProduct(org.killbill.billing.catalog.DefaultProduct) DefaultPriceList(org.killbill.billing.catalog.DefaultPriceList) Test(org.testng.annotations.Test)

Example 23 with DefaultProduct

use of org.killbill.billing.catalog.DefaultProduct in project killbill by killbill.

the class TestCaseChange method testWildcardToProduct.

@Test(groups = "fast")
public void testWildcardToProduct() throws CatalogApiException {
    final MockCatalog cat = new MockCatalog();
    final DefaultProduct product1 = cat.getCurrentProduct(0);
    final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
    final DefaultProduct product2 = cat.getCurrentProduct(2);
    final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
    final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, null, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertion(Result.FOO, cr, product1.getName(), cat.getCurrentProduct(1).getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
Also used : MockCatalog(org.killbill.billing.catalog.MockCatalog) DefaultProduct(org.killbill.billing.catalog.DefaultProduct) DefaultPriceList(org.killbill.billing.catalog.DefaultPriceList) Test(org.testng.annotations.Test)

Example 24 with DefaultProduct

use of org.killbill.billing.catalog.DefaultProduct in project killbill by killbill.

the class TestCaseChange method testWildcardToProductCategory.

@Test(groups = "fast")
public void testWildcardToProductCategory() throws CatalogApiException {
    final MockCatalog cat = new MockCatalog();
    final DefaultProduct product1 = cat.getCurrentProduct(0);
    final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
    final DefaultProduct product2 = cat.getCurrentProduct(2);
    final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
    final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, null, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
Also used : MockCatalog(org.killbill.billing.catalog.MockCatalog) DefaultProduct(org.killbill.billing.catalog.DefaultProduct) DefaultPriceList(org.killbill.billing.catalog.DefaultPriceList) Test(org.testng.annotations.Test)

Example 25 with DefaultProduct

use of org.killbill.billing.catalog.DefaultProduct in project killbill by killbill.

the class TestCaseChange method testWildCardToBillingPeriod.

@Test(groups = "fast")
public void testWildCardToBillingPeriod() throws CatalogApiException {
    final MockCatalog cat = new MockCatalog();
    final DefaultProduct product1 = cat.getCurrentProduct(0);
    final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
    final DefaultProduct product2 = cat.getCurrentProduct(2);
    final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
    final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(product1, product2, ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, null, priceList1, priceList2, PhaseType.EVERGREEN, Result.FOO);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, cat.getCurrentProduct(1).getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), cat.getCurrentProduct(1).getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.ANNUAL, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertion(Result.FOO, cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.ANNUAL, priceList1.getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, cat.getCurrentProduct(1).getName(), priceList2.getName(), PhaseType.EVERGREEN, cat);
    assertionException(cr, product1.getName(), product2.getName(), BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), cat.getCurrentProduct(1).getName(), PhaseType.EVERGREEN, cat);
    assertionNull(cr, product1.getName(), product2.getName(), ProductCategory.BASE, ProductCategory.BASE, BillingPeriod.MONTHLY, BillingPeriod.MONTHLY, priceList1.getName(), priceList2.getName(), PhaseType.TRIAL, cat);
}
Also used : MockCatalog(org.killbill.billing.catalog.MockCatalog) DefaultProduct(org.killbill.billing.catalog.DefaultProduct) DefaultPriceList(org.killbill.billing.catalog.DefaultPriceList) Test(org.testng.annotations.Test)

Aggregations

DefaultProduct (org.killbill.billing.catalog.DefaultProduct)29 Test (org.testng.annotations.Test)27 DefaultPriceList (org.killbill.billing.catalog.DefaultPriceList)26 MockCatalog (org.killbill.billing.catalog.MockCatalog)24 PlanPhaseSpecifier (org.killbill.billing.catalog.api.PlanPhaseSpecifier)4 PlanSpecifier (org.killbill.billing.catalog.api.PlanSpecifier)4 StandaloneCatalog (org.killbill.billing.catalog.StandaloneCatalog)2 CatalogApiException (org.killbill.billing.catalog.api.CatalogApiException)2 IllegalPlanChange (org.killbill.billing.catalog.api.IllegalPlanChange)2 PlanChangeResult (org.killbill.billing.catalog.api.PlanChangeResult)2 Product (org.killbill.billing.catalog.api.Product)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 URI (java.net.URI)1 DefaultDuration (org.killbill.billing.catalog.DefaultDuration)1 DefaultFixed (org.killbill.billing.catalog.DefaultFixed)1 DefaultInternationalPrice (org.killbill.billing.catalog.DefaultInternationalPrice)1 DefaultMutableStaticCatalog (org.killbill.billing.catalog.DefaultMutableStaticCatalog)1 DefaultPlan (org.killbill.billing.catalog.DefaultPlan)1 DefaultPlanPhase (org.killbill.billing.catalog.DefaultPlanPhase)1 DefaultPrice (org.killbill.billing.catalog.DefaultPrice)1