killbill-memoizeit

catalog: Modify catalog api to return Collection instead of

10/4/2016 12:49:35 AM

Changes

Details

diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithCatalogUpdate.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithCatalogUpdate.java
index 4635782..c314ac2 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithCatalogUpdate.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationWithCatalogUpdate.java
@@ -101,7 +101,7 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc1 = new DefaultSimplePlanDescriptor("foo-monthly", "Foo", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc1, init, testCallContext);
         StaticCatalog catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
         final Entitlement baseEntitlement = createEntitlement("foo-monthly", true);
 
@@ -111,7 +111,7 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc2 = new DefaultSimplePlanDescriptor("superfoo-monthly", "SuperFoo", ProductCategory.BASE, account.getCurrency(), new BigDecimal("20.00"), BillingPeriod.MONTHLY, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc2, init, testCallContext);
         catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentPlans().length, 2);
+        assertEquals(catalog.getCurrentPlans().size(), 2);
 
         // Change Plan to the newly added Plan and verify correct default rules behavior (IMMEDIATE change)
         busHandler.pushExpectedEvents(NextEvent.CHANGE, NextEvent.INVOICE, NextEvent.INVOICE_PAYMENT, NextEvent.PAYMENT);
@@ -131,8 +131,8 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc1 = new DefaultSimplePlanDescriptor("xxx-monthly", "XXX", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc1, init, testCallContext);
         StaticCatalog catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentProducts().length, 1);
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentProducts().size(), 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
         final Entitlement baseEntitlement1 = createEntitlement("xxx-monthly", true);
 
@@ -140,8 +140,8 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc2 = new DefaultSimplePlanDescriptor("xxx-14-monthly", "XXX", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 14, TimeUnit.DAYS, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc2, init, testCallContext);
         catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentProducts().length, 1);
-        assertEquals(catalog.getCurrentPlans().length, 2);
+        assertEquals(catalog.getCurrentProducts().size(), 1);
+        assertEquals(catalog.getCurrentPlans().size(), 2);
 
         final Entitlement baseEntitlement2 = createEntitlement("xxx-14-monthly", false);
 
@@ -149,8 +149,8 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc3 = new DefaultSimplePlanDescriptor("xxx-30-monthly", "XXX", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 30, TimeUnit.DAYS, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc3, init, testCallContext);
         catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentProducts().length, 1);
-        assertEquals(catalog.getCurrentPlans().length, 3);
+        assertEquals(catalog.getCurrentProducts().size(), 1);
+        assertEquals(catalog.getCurrentPlans().size(), 3);
 
         final Entitlement baseEntitlement3 = createEntitlement("xxx-30-monthly", false);
 
@@ -172,12 +172,12 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc1 = new DefaultSimplePlanDescriptor("zoe-monthly", "Zoe", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc1, init, testCallContext);
         StaticCatalog catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
         final SimplePlanDescriptor desc2 = new DefaultSimplePlanDescriptor("zoe-14-monthly", "Zoe", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 14, TimeUnit.DAYS, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc2, init, testCallContext);
         catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentPlans().length, 2);
+        assertEquals(catalog.getCurrentPlans().size(), 2);
 
         try {
             final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("Zoe", BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
@@ -195,9 +195,9 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc1 = new DefaultSimplePlanDescriptor("bar-monthly", "Bar", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.MONTHLY, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc1, init, testCallContext);
         StaticCatalog catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
-        final Plan plan = catalog.getCurrentPlans()[0];
+        final Plan plan = catalog.getCurrentPlans().iterator().next();
         final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("bar-monthly", null);
 
         final List<PlanPhasePriceOverride> overrides = new ArrayList<PlanPhasePriceOverride>();
@@ -236,7 +236,7 @@ public class TestIntegrationWithCatalogUpdate extends TestIntegrationBase {
         final SimplePlanDescriptor desc1 = new DefaultSimplePlanDescriptor("thirty-monthly", "Thirty", ProductCategory.BASE, account.getCurrency(), BigDecimal.TEN, BillingPeriod.THIRTY_DAYS, 0, TimeUnit.UNLIMITED, ImmutableList.<String>of());
         catalogUserApi.addSimplePlan(desc1, init, testCallContext);
         StaticCatalog catalog = catalogUserApi.getCurrentCatalog("dummy", testCallContext);
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
 
         final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("thirty-monthly", null);
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/CatalogEntityCollection.java b/catalog/src/main/java/org/killbill/billing/catalog/CatalogEntityCollection.java
index 78cdda0..b9bad42 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/CatalogEntityCollection.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/CatalogEntityCollection.java
@@ -41,6 +41,14 @@ public class CatalogEntityCollection<T extends CatalogEntity> implements Collect
         }
     }
 
+
+    public CatalogEntityCollection(final Collection<T> entities) {
+        this.data = new TreeMap<String, T>(Ordering.<String>natural());
+        for (final T cur : entities) {
+            addEntry(cur);
+        }
+    }
+
     //
     // Returning such entries will be log(N)
     //
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/CatalogUpdater.java b/catalog/src/main/java/org/killbill/billing/catalog/CatalogUpdater.java
index fcfe43c..aa1c163 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/CatalogUpdater.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/CatalogUpdater.java
@@ -29,9 +29,11 @@ import org.killbill.billing.catalog.api.BillingMode;
 import org.killbill.billing.catalog.api.CatalogApiException;
 import org.killbill.billing.catalog.api.Currency;
 import org.killbill.billing.catalog.api.PhaseType;
+import org.killbill.billing.catalog.api.Plan;
 import org.killbill.billing.catalog.api.PlanAlignmentChange;
 import org.killbill.billing.catalog.api.PlanAlignmentCreate;
 import org.killbill.billing.catalog.api.PriceListSet;
+import org.killbill.billing.catalog.api.Product;
 import org.killbill.billing.catalog.api.ProductCategory;
 import org.killbill.billing.catalog.api.SimplePlanDescriptor;
 import org.killbill.billing.catalog.api.TimeUnit;
@@ -44,6 +46,8 @@ import org.killbill.billing.catalog.rules.DefaultCasePriceList;
 import org.killbill.billing.catalog.rules.DefaultPlanRules;
 import org.killbill.xmlloader.XMLWriter;
 
+import com.google.common.collect.ImmutableList;
+
 public class CatalogUpdater {
 
     private static URI DUMMY_URI;
@@ -53,7 +57,9 @@ public class CatalogUpdater {
             DUMMY_URI = new URI("dummy");
         } catch (URISyntaxException e) {
         }
-    };
+    }
+
+    ;
 
     private final DefaultMutableStaticCatalog catalog;
 
@@ -68,8 +74,8 @@ public class CatalogUpdater {
                 .setCatalogName(catalogName)
                 .setEffectiveDate(effectiveDate.toDate())
                 .setRecurringBillingMode(billingMode)
-                .setProducts(new DefaultProduct[0])
-                .setPlans(new DefaultPlan[0])
+                .setProducts(ImmutableList.<Product>of())
+                .setPlans(ImmutableList.<Plan>of())
                 .setPriceLists(new DefaultPriceListSet(defaultPriceList, new DefaultPriceList[0]))
                 .setPlanRules(getSaneDefaultPlanRules(defaultPriceList));
         if (currencies != null && currencies.length > 0) {
@@ -92,7 +98,6 @@ public class CatalogUpdater {
         }
     }
 
-
     public void addSimplePlanDescriptor(final SimplePlanDescriptor desc) throws CatalogApiException {
 
         // We need at least a planId
@@ -100,12 +105,12 @@ public class CatalogUpdater {
             throw new CatalogApiException(ErrorCode.CAT_INVALID_SIMPLE_PLAN_DESCRIPTOR, desc);
         }
 
-        DefaultPlan plan = getExistingPlan(desc.getPlanId());
+        DefaultPlan plan = (DefaultPlan) getExistingPlan(desc.getPlanId());
         if (plan == null && desc.getProductName() == null) {
             throw new CatalogApiException(ErrorCode.CAT_INVALID_SIMPLE_PLAN_DESCRIPTOR, desc);
         }
 
-        DefaultProduct product = plan != null ? (DefaultProduct) plan.getProduct() : getExistingProduct(desc.getProductName());
+        DefaultProduct product = plan != null ? (DefaultProduct) plan.getProduct() : (DefaultProduct)  getExistingProduct(desc.getProductName());
         if (product == null) {
             product = new DefaultProduct();
             product.setName(desc.getProductName());
@@ -171,9 +176,9 @@ public class CatalogUpdater {
 
         if (desc.getProductCategory() == ProductCategory.ADD_ON) {
             for (final String bp : desc.getAvailableBaseProducts()) {
-                final DefaultProduct targetBasePlan = getExistingProduct(bp);
+                final Product targetBasePlan = getExistingProduct(bp);
                 boolean found = false;
-                for (DefaultProduct cur : targetBasePlan.getAvailable()) {
+                for (Product cur : targetBasePlan.getAvailable()) {
                     if (cur.getName().equals(product.getName())) {
                         found = true;
                         break;
@@ -278,8 +283,8 @@ public class CatalogUpdater {
         }
     }
 
-    private DefaultProduct getExistingProduct(final String productName) {
-        for (final DefaultProduct input : catalog.getCurrentProducts()) {
+    private Product getExistingProduct(final String productName) {
+        for (final Product input : catalog.getCurrentProducts()) {
             if (input.getName().equals(productName)) {
                 return input;
             }
@@ -287,8 +292,8 @@ public class CatalogUpdater {
         return null;
     }
 
-    private DefaultPlan getExistingPlan(final String planName) {
-        for (final DefaultPlan input : catalog.getCurrentPlans()) {
+    private Plan getExistingPlan(final String planName) {
+        for (final Plan input : catalog.getCurrentPlans()) {
             if (input.getName().equals(planName)) {
                 return input;
             }
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultMutableStaticCatalog.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultMutableStaticCatalog.java
index 8e31268..8e83016 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultMutableStaticCatalog.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultMutableStaticCatalog.java
@@ -61,35 +61,16 @@ public class DefaultMutableStaticCatalog extends StandaloneCatalog implements Mu
 
     @Override
     public void addProduct(final Product product) throws CatalogApiException {
-        final Product[] newEntries = allocateNewEntries(getCurrentProducts(), product);
-        setProducts((DefaultProduct[]) newEntries);
+        getCatalogEntityCollectionProduct().add(product);
     }
 
     @Override
     public void addPlan(final Plan plan) throws CatalogApiException {
-        final Plan[] newEntries = allocateNewEntries(getCurrentPlans(), plan);
-        setPlans((DefaultPlan[]) newEntries);
 
-        final DefaultPriceList priceList = getPriceLists().findPriceListFrom(plan.getPriceListName());
-        final List<DefaultPlan> newPriceListPlan = new ArrayList<DefaultPlan>();
-        for (Plan input : newEntries) {
-            if (plan.getName().equals(input.getName())) {
-                newPriceListPlan.add((DefaultPlan) plan);
-                continue;
-            }
-            if (priceList.getPlans() != null) {
-                for (final Plan priceListPlan : priceList.getPlans()) {
-                    if (priceListPlan.getName().equals(input.getName())) {
-                        newPriceListPlan.add((DefaultPlan) priceListPlan);
-                        break;
-                    }
-                }
-            }
-        }
+        getCatalogEntityCollectionPlan().add(plan);
 
-        final Plan[] newPriceListEntries = new DefaultPlan[newPriceListPlan.size()];
-        final Plan[] bar = newPriceListPlan.toArray(newPriceListEntries);
-        priceList.setPlans((DefaultPlan[]) bar);
+        final DefaultPriceList priceList = getPriceLists().findPriceListFrom(plan.getPriceListName());
+        priceList.getCatalogEntityCollectionPlan().add(plan);
     }
 
     @Override
@@ -104,9 +85,8 @@ public class DefaultMutableStaticCatalog extends StandaloneCatalog implements Mu
         currentPrices.setPrices((DefaultPrice[]) newEntries);
     }
 
-    public void addProductAvailableAO(final DefaultProduct targetBasePlan, final DefaultProduct aoProduct) throws CatalogApiException {
-        final Product[] newEntries = allocateNewEntries(targetBasePlan.getAvailable(), aoProduct);
-        targetBasePlan.setAvailable((DefaultProduct[]) newEntries);
+    public void addProductAvailableAO(final Product targetBasePlan, final DefaultProduct aoProduct) throws CatalogApiException {
+        ((DefaultProduct) targetBasePlan).getCatalogEntityCollectionAvailable().add(aoProduct);
     }
 
     private <T> T[] allocateNewEntries(final T[] existingEntries, final T newEntry) throws CatalogApiException {
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java
index 61eb0ae..b99ec4b 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java
@@ -218,8 +218,8 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
         return this;
     }
 
-    public DefaultPlan setProduct(final DefaultProduct product) {
-        this.product = product;
+    public DefaultPlan setProduct(final Product product) {
+        this.product = (DefaultProduct) product;
         return this;
     }
 
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java
index feb06e6..7335354 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java
@@ -17,6 +17,7 @@
 package org.killbill.billing.catalog;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -43,10 +44,11 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
 
     @XmlElementWrapper(name = "plans", required = false)
     @XmlIDREF
-    @XmlElement(name = "plan", required = false)
-    private CatalogEntityCollection<DefaultPlan> plans;
+    @XmlElement(type=DefaultPlan.class, name = "plan", required = false)
+    private CatalogEntityCollection<Plan> plans;
 
     public DefaultPriceList() {
+        this.plans = new CatalogEntityCollection();
     }
 
     public DefaultPriceList(final DefaultPlan[] plans, final String name) {
@@ -55,10 +57,14 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
     }
 
     @Override
-    public Plan[] getPlans() {
-        return (Plan[]) plans.toArray(new DefaultPlan[plans.size()]);
+    public Collection<Plan> getPlans() {
+        return plans;
     }
 
+
+    public CatalogEntityCollection<Plan> getCatalogEntityCollectionPlan() {
+        return plans;
+    }
     /* (non-Javadoc)
       * @see org.killbill.billing.catalog.IPriceList#getName()
       */
@@ -71,18 +77,18 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
       * @see org.killbill.billing.catalog.IPriceList#findPlan(org.killbill.billing.catalog.api.IProduct, org.killbill.billing.catalog.api.BillingPeriod)
       */
     @Override
-    public DefaultPlan[] findPlans(final Product product, final BillingPeriod period) {
-        final List<DefaultPlan> result = new ArrayList<DefaultPlan>(plans.size());
+    public Collection<Plan> findPlans(final Product product, final BillingPeriod period) {
+        final List<Plan> result = new ArrayList<Plan>(plans.size());
         for (final Plan cur : getPlans()) {
             if (cur.getProduct().equals(product) &&
                 (cur.getRecurringBillingPeriod() != null && cur.getRecurringBillingPeriod().equals(period))) {
-                result.add((DefaultPlan) cur);
+                result.add(cur);
             }
         }
-        return result.toArray(new DefaultPlan[result.size()]);
+        return result;
     }
 
-    public DefaultPlan findPlan(final String planName) {
+    public Plan findPlan(final String planName) {
         return plans.findByName(planName);
     }
 
@@ -96,7 +102,7 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
         return this;
     }
 
-    public DefaultPriceList setPlans(final DefaultPlan[] plans) {
+    public DefaultPriceList setPlans(final Collection<Plan> plans) {
         this.plans = new CatalogEntityCollection(plans);
         return this;
     }
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceListSet.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceListSet.java
index 7e0f5e0..c159833 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceListSet.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceListSet.java
@@ -21,11 +21,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 
 import org.killbill.billing.ErrorCode;
 import org.killbill.billing.catalog.api.BillingPeriod;
 import org.killbill.billing.catalog.api.CatalogApiException;
+import org.killbill.billing.catalog.api.Plan;
 import org.killbill.billing.catalog.api.PriceList;
 import org.killbill.billing.catalog.api.PriceListSet;
 import org.killbill.billing.catalog.api.Product;
@@ -52,21 +54,21 @@ public class DefaultPriceListSet extends ValidatingConfig<StandaloneCatalog> imp
         this.childPriceLists = childPriceLists != null ? childPriceLists : new DefaultPriceList[0];
     }
 
-    public DefaultPlan getPlanFrom(final Product product, final BillingPeriod period, final String priceListName) throws CatalogApiException {
+    public Plan getPlanFrom(final Product product, final BillingPeriod period, final String priceListName) throws CatalogApiException {
 
-        DefaultPlan[] plans = null;
+        Collection<Plan> plans = null;
         final DefaultPriceList pl = findPriceListFrom(priceListName);
         if (pl != null) {
             plans = pl.findPlans(product, period);
         }
-        if (plans.length == 0) {
+        if (plans.size() == 0) {
             plans = defaultPricelist.findPlans(product, period);
         }
-        switch(plans.length) {
+        switch(plans.size()) {
             case 0:
                 return null;
             case 1:
-                return plans[0];
+                return plans.iterator().next();
             default:
                 throw new CatalogApiException(ErrorCode.CAT_MULTIPLE_MATCHING_PLANS_FOR_PRICELIST,
                                               priceListName, product.getName(), period);
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java
index 91e4ffb..ffb8e96 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java
@@ -18,6 +18,7 @@ package org.killbill.billing.catalog;
 
 import java.net.URI;
 import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -35,7 +36,6 @@ import org.killbill.xmlloader.ValidationErrors;
 
 @XmlAccessorType(XmlAccessType.NONE)
 public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implements Product {
-    private static final DefaultProduct[] EMPTY_PRODUCT_LIST = new DefaultProduct[0];
 
     @XmlAttribute(required = true)
     @XmlID
@@ -46,13 +46,13 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
 
     @XmlElementWrapper(name = "included", required = false)
     @XmlIDREF
-    @XmlElement(name = "addonProduct", required = false)
-    private DefaultProduct[] included;
+    @XmlElement(type=DefaultProduct.class, name = "addonProduct", required = false)
+    private CatalogEntityCollection<Product> included;
 
     @XmlElementWrapper(name = "available", required = false)
     @XmlIDREF
-    @XmlElement(name = "addonProduct", required = false)
-    private DefaultProduct[] available;
+    @XmlElement(type=DefaultProduct.class, name = "addonProduct", required = false)
+    private CatalogEntityCollection<Product> available;
 
     @XmlElementWrapper(name = "limits", required = false)
     @XmlElement(name = "limit", required = false)
@@ -72,22 +72,29 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
     }
 
     @Override
-    public DefaultProduct[] getIncluded() {
-        return included;
+    public Collection<Product> getIncluded() {
+        return included.getEntries();
     }
 
     @Override
-    public DefaultProduct[] getAvailable() {
-        return available;
+    public Collection<Product> getAvailable() {
+        return available.getEntries();
     }
 
+
+    public CatalogEntityCollection<Product> getCatalogEntityCollectionAvailable() {
+        return available;
+    };
+
     public DefaultProduct() {
-        included = EMPTY_PRODUCT_LIST;
-        available = EMPTY_PRODUCT_LIST;
-        limits = new DefaultLimit[0];
+        this.included = new CatalogEntityCollection<Product>();
+        this.available = new CatalogEntityCollection<Product>();
+        this.limits = new DefaultLimit[0];
     }
 
     public DefaultProduct(final String name, final ProductCategory category) {
+        this.included = new CatalogEntityCollection<Product>();
+        this.available = new CatalogEntityCollection<Product>();
         this.category = category;
         this.name = name;
     }
@@ -98,7 +105,7 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
     }
 
     public boolean isIncluded(final DefaultProduct addon) {
-        for (final DefaultProduct p : included) {
+        for (final Product p : included.getEntries()) {
             if (addon == p) {
                 return true;
             }
@@ -107,7 +114,7 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
     }
 
     public boolean isAvailable(final DefaultProduct addon) {
-        for (final DefaultProduct p : included) {
+        for (final Product p : included.getEntries()) {
             if (addon == p) {
                 return true;
             }
@@ -168,13 +175,13 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
         return this;
     }
 
-    public DefaultProduct setIncluded(final DefaultProduct[] included) {
-        this.included = included;
+    public DefaultProduct setIncluded(final Collection<Product> included) {
+        this.included = new CatalogEntityCollection<Product>(included);
         return this;
     }
 
-    public DefaultProduct setAvailable(final DefaultProduct[] available) {
-        this.available = available;
+    public DefaultProduct setAvailable(final Collection<Product> available) {
+        this.available = new CatalogEntityCollection<Product>(available);
         return this;
     }
 
@@ -185,9 +192,14 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
 
     @Override
     public String toString() {
-        return "DefaultProduct [name=" + name + ", category=" + category + ", included="
-                + Arrays.toString(included) + ", available=" + Arrays.toString(available) + ", catalogName="
-                + catalogName + "]";
+        return "DefaultProduct{" +
+               "name='" + name + '\'' +
+               ", category=" + category +
+               ", included=" + included +
+               ", available=" + available +
+               ", limits=" + Arrays.toString(limits) +
+               ", catalogName='" + catalogName + '\'' +
+               '}';
     }
 
     @Override
@@ -195,41 +207,40 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (!(o instanceof DefaultProduct)) {
             return false;
         }
 
-        final DefaultProduct that = (DefaultProduct) o;
+        final DefaultProduct product = (DefaultProduct) o;
 
-        if (!Arrays.equals(available, that.available)) {
-            return false;
-        }
-        if (catalogName != null ? !catalogName.equals(that.catalogName) : that.catalogName != null) {
+        if (name != null ? !name.equals(product.name) : product.name != null) {
             return false;
         }
-        if (category != that.category) {
+        if (category != product.category) {
             return false;
         }
-        if (!Arrays.equals(included, that.included)) {
+        if (included != null ? !included.equals(product.included) : product.included != null) {
             return false;
         }
-        if (!Arrays.equals(limits, that.limits)) {
+        if (available != null ? !available.equals(product.available) : product.available != null) {
             return false;
         }
-        if (name != null ? !name.equals(that.name) : that.name != null) {
+        // Probably incorrect - comparing Object[] arrays with Arrays.equals
+        if (!Arrays.equals(limits, product.limits)) {
             return false;
         }
+        return catalogName != null ? catalogName.equals(product.catalogName) : product.catalogName == null;
 
-        return true;
     }
 
     @Override
     public int hashCode() {
         int result = name != null ? name.hashCode() : 0;
         result = 31 * result + (category != null ? category.hashCode() : 0);
-        result = 31 * result + (included != null ? Arrays.hashCode(included) : 0);
-        result = 31 * result + (available != null ? Arrays.hashCode(available) : 0);
-        result = 31 * result + (limits != null ? Arrays.hashCode(limits) : 0);
+        result = 31 * result + (included != null ? included.hashCode() : 0);
+        result = 31 * result + (available != null ? available.hashCode() : 0);
+        result = 31 * result + Arrays.hashCode(limits);
+        result = 31 * result + (catalogName != null ? catalogName.hashCode() : 0);
         return result;
     }
 }
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java b/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java
index 1b42d71..7c90442 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java
@@ -19,6 +19,8 @@ package org.killbill.billing.catalog.plugin;
 
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import javax.annotation.Nullable;
@@ -81,8 +83,8 @@ public class StandaloneCatalogMapper {
     private final String catalogName;
     private final BillingMode recurringBillingMode;
 
-    private Iterable<DefaultProduct> tmpDefaultProducts;
-    private Iterable<DefaultPlan> tmpDefaultPlans;
+    private Collection<Product> tmpDefaultProducts;
+    private Collection<Plan> tmpDefaultPlans;
     private DefaultPriceListSet tmpDefaultPriceListSet;
 
     public StandaloneCatalogMapper(final String catalogName, final BillingMode recurringBillingMode) {
@@ -105,10 +107,10 @@ public class StandaloneCatalogMapper {
         result.setPlanRules(toDefaultPlanRules(pluginCatalog.getPlanRules()));
 
         for (final Product cur : pluginCatalog.getProducts()) {
-            for (DefaultProduct target : result.getCurrentProducts()) {
+            for (Product target :  result.getCurrentProducts()) {
                 if (target.getName().equals(cur.getName())) {
-                    target.setAvailable(toFilteredDefaultProduct(ImmutableList.copyOf(cur.getAvailable())));
-                    target.setIncluded(toFilteredDefaultProduct(ImmutableList.copyOf(cur.getIncluded())));
+                    ((DefaultProduct) target).setAvailable(toFilteredDefaultProduct(ImmutableList.copyOf(cur.getAvailable())));
+                    ((DefaultProduct) target).setIncluded(toFilteredDefaultProduct(ImmutableList.copyOf(cur.getIncluded())));
                     break;
                 }
             }
@@ -250,22 +252,22 @@ public class StandaloneCatalogMapper {
     }
 
 
-    private DefaultProduct[] toDefaultProducts(final Iterable<Product> input) {
+    private Collection<Product> toDefaultProducts(final Iterable<Product> input) {
         if (tmpDefaultProducts == null) {
-            final Function<Product, DefaultProduct> productTransformer = new Function<Product, DefaultProduct>() {
+            final Function<Product, Product> productTransformer = new Function<Product, Product>() {
                 @Override
-                public DefaultProduct apply(final Product input) {
+                public Product apply(final Product input) {
                     return toDefaultProduct(input);
                 }
             };
-            tmpDefaultProducts = ImmutableList.copyOf(Iterables.transform(input, productTransformer));
+            tmpDefaultProducts = ImmutableList.<Product>copyOf(Iterables.transform(input, productTransformer));
         }
-        return toArray(tmpDefaultProducts);
+        return tmpDefaultProducts;
     }
 
-    private DefaultProduct[] toFilteredDefaultProduct(final Iterable<Product> input) {
+    private Collection<Product> toFilteredDefaultProduct(final Iterable<Product> input) {
         if (!input.iterator().hasNext()) {
-            return new DefaultProduct[0];
+            return Collections.emptyList();
         }
         final List<String> inputProductNames = ImmutableList.copyOf(Iterables.transform(input, new Function<Product, String>() {
             @Override
@@ -273,33 +275,33 @@ public class StandaloneCatalogMapper {
                 return input.getName();
             }
         }));
-        final List<DefaultProduct> filteredAndOrdered = new ArrayList<DefaultProduct>(inputProductNames.size());
+        final Collection<Product> filteredAndOrdered = new ArrayList<Product>(inputProductNames.size());
         for (final String cur : inputProductNames) {
-            final DefaultProduct found = findOrIllegalState(tmpDefaultProducts, new Predicate<DefaultProduct>() {
+            final Product found = findOrIllegalState(tmpDefaultProducts, new Predicate<Product>() {
                 @Override
-                public boolean apply(final DefaultProduct inputPredicate) {
+                public boolean apply(final Product inputPredicate) {
                     return inputPredicate.getName().equals(cur);
                 }
             }, "Failed to find product " + cur);
             filteredAndOrdered.add(found);
         }
-        return toArray(filteredAndOrdered);
+        return filteredAndOrdered;
     }
 
-    private DefaultPlan[] toDefaultPlans(final Iterable<Plan> input) {
+    private Collection<Plan> toDefaultPlans(final Iterable<Plan> input) {
         if (tmpDefaultPlans == null) {
-            final Function<Plan, DefaultPlan> planTransformer = new Function<Plan, DefaultPlan>() {
+            final Function<Plan, Plan> planTransformer = new Function<Plan, Plan>() {
                 @Override
-                public DefaultPlan apply(final Plan input) {
+                public Plan apply(final Plan input) {
                     return toDefaultPlan(input);
                 }
             };
-            tmpDefaultPlans = ImmutableList.copyOf(Iterables.transform(input, planTransformer));
+            tmpDefaultPlans = ImmutableList.<Plan>copyOf(Iterables.transform(input, planTransformer));
         }
-        return toArray(tmpDefaultPlans);
+        return tmpDefaultPlans;
     }
 
-    private DefaultPlan[] toFilterDefaultPlans(final Iterable<Plan> input) {
+    private Collection<Plan> toFilterDefaultPlans(final Iterable<Plan> input) {
         if (tmpDefaultPlans == null) {
             throw new IllegalStateException("Cannot filter on uninitialized plans");
         }
@@ -309,17 +311,17 @@ public class StandaloneCatalogMapper {
                 return input.getName();
             }
         }));
-        final List<DefaultPlan> filteredAndOrdered = new ArrayList<DefaultPlan>(inputPlanNames.size());
+        final List<Plan> filteredAndOrdered = new ArrayList<Plan>(inputPlanNames.size());
         for (final String cur : inputPlanNames) {
-            final DefaultPlan found = findOrIllegalState(tmpDefaultPlans, new Predicate<DefaultPlan>() {
+            final Plan found = findOrIllegalState(tmpDefaultPlans, new Predicate<Plan>() {
                 @Override
-                public boolean apply(final DefaultPlan inputPredicate) {
+                public boolean apply(final Plan inputPredicate) {
                     return inputPredicate.getName().equals(cur);
                 }
             }, "Failed to find plan " + cur);
             filteredAndOrdered.add(found);
         }
-        return toArray(filteredAndOrdered);
+        return filteredAndOrdered;
     }
 
     private DefaultPriceListSet toDefaultPriceListSet(final PriceList defaultPriceList, final Iterable<PriceList> childrenPriceLists) {
@@ -395,14 +397,14 @@ public class StandaloneCatalogMapper {
         return result;
     }
 
-    private DefaultProduct toDefaultProduct(@Nullable final Product input) {
+    private Product toDefaultProduct(@Nullable final Product input) {
         if (input == null) {
             return null;
         }
         if (tmpDefaultProducts != null) {
-            final DefaultProduct existingProduct = findOrIllegalState(tmpDefaultProducts, new Predicate<DefaultProduct>() {
+            final Product existingProduct = findOrIllegalState(tmpDefaultProducts, new Predicate<Product>() {
                 @Override
-                public boolean apply(final DefaultProduct predicateInput) {
+                public boolean apply(final Product predicateInput) {
                     return predicateInput.getName().equals(input.getName());
                 }
             }, "Unknown product " + input.getName());
@@ -415,11 +417,11 @@ public class StandaloneCatalogMapper {
         return result;
     }
 
-    private DefaultPlan toDefaultPlan(final Plan input) {
+    private Plan toDefaultPlan(final Plan input) {
         if (tmpDefaultPlans != null) {
-            final DefaultPlan existingPlan = findOrIllegalState(tmpDefaultPlans, new Predicate<DefaultPlan>() {
+            final Plan existingPlan = findOrIllegalState(tmpDefaultPlans, new Predicate<Plan>() {
                 @Override
-                public boolean apply(final DefaultPlan predicateInput) {
+                public boolean apply(final Plan predicateInput) {
                     return predicateInput.getName().equals(input.getName());
                 }
             }, "Unknown plan " + input.getName());
@@ -513,4 +515,4 @@ public class StandaloneCatalogMapper {
         }
         return result;
     }
-}
+}
\ No newline at end of file
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCase.java b/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCase.java
index 49f5267..de0bef2 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCase.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCase.java
@@ -92,7 +92,7 @@ public abstract class DefaultCase<T> extends ValidatingConfig<StandaloneCatalog>
         return errors;
     }
 
-    protected abstract DefaultCase<T> setProduct(DefaultProduct product);
+    protected abstract DefaultCase<T> setProduct(Product product);
 
     protected abstract DefaultCase<T> setProductCategory(ProductCategory productCategory);
 
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseChange.java b/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseChange.java
index a046406..ea441bd 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseChange.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseChange.java
@@ -154,8 +154,8 @@ public abstract class DefaultCaseChange<T> extends ValidatingConfig<StandaloneCa
         return this;
     }
 
-    public DefaultCaseChange<T> setFromProduct(final DefaultProduct fromProduct) {
-        this.fromProduct = fromProduct;
+    public DefaultCaseChange<T> setFromProduct(final Product fromProduct) {
+        this.fromProduct = (DefaultProduct) fromProduct;
         return this;
     }
 
@@ -174,8 +174,8 @@ public abstract class DefaultCaseChange<T> extends ValidatingConfig<StandaloneCa
         return this;
     }
 
-    public DefaultCaseChange<T> setToProduct(final DefaultProduct toProduct) {
-        this.toProduct = toProduct;
+    public DefaultCaseChange<T> setToProduct(final Product toProduct) {
+        this.toProduct = (DefaultProduct) toProduct;
         return this;
     }
 
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseStandardNaming.java b/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseStandardNaming.java
index e922b0e..79c73aa 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseStandardNaming.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/rules/DefaultCaseStandardNaming.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlIDREF;
 import org.killbill.billing.catalog.DefaultPriceList;
 import org.killbill.billing.catalog.DefaultProduct;
 import org.killbill.billing.catalog.api.BillingPeriod;
+import org.killbill.billing.catalog.api.Product;
 import org.killbill.billing.catalog.api.ProductCategory;
 import org.killbill.billing.catalog.api.rules.Case;
 
@@ -59,8 +60,8 @@ public abstract class DefaultCaseStandardNaming<T> extends DefaultCase<T> implem
         return priceList;
     }
 
-    public DefaultCaseStandardNaming<T> setProduct(final DefaultProduct product) {
-        this.product = product;
+    public DefaultCaseStandardNaming<T> setProduct(final Product product) {
+        this.product = (DefaultProduct) product;
         return this;
     }
 
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java b/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java
index e58c8ca..0511e71 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java
@@ -77,15 +77,15 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
     private DefaultUnit[] units;
 
     @XmlElementWrapper(name = "products", required = false)
-    @XmlElement(name = "product", required = false)
-    private CatalogEntityCollection<DefaultProduct> products;
+    @XmlElement(type=DefaultProduct.class, name = "product", required = false)
+    private CatalogEntityCollection<Product> products;
 
     @XmlElement(name = "rules", required = true)
     private DefaultPlanRules planRules;
 
     @XmlElementWrapper(name = "plans", required = false)
-    @XmlElement(name = "plan", required = false)
-    private CatalogEntityCollection<DefaultPlan> plans;
+    @XmlElement(type=DefaultPlan.class, name = "plan", required = false)
+    private CatalogEntityCollection<Plan> plans;
 
     @XmlElement(name = "priceLists", required = true)
     private DefaultPriceListSet priceLists;
@@ -93,6 +93,8 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
     private URI catalogURI;
 
     public StandaloneCatalog() {
+        this.plans = new CatalogEntityCollection<Plan>();
+        this.products = new CatalogEntityCollection<Product>();
     }
 
     protected StandaloneCatalog(final Date effectiveDate) {
@@ -121,17 +123,13 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
      * @see org.killbill.billing.catalog.ICatalog#getProducts()
      */
     @Override
-    public DefaultProduct[] getCurrentProducts() {
-        return (DefaultProduct[]) products.toArray(new DefaultProduct[products.size()]);
-    }
-
-    public Collection<DefaultProduct> getAllProducts() {
+    public Collection<Product> getCurrentProducts() {
         return products.getEntries();
     }
 
 
-    public Collection<DefaultPlan> getAllPlans() {
-        return plans.getEntries();
+    public CatalogEntityCollection<Product>  getCatalogEntityCollectionProduct() {
+        return products;
     }
 
     /* (non-Javadoc)
@@ -147,9 +145,16 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
         return supportedCurrencies;
     }
 
+
+
     @Override
-    public DefaultPlan[] getCurrentPlans() {
-        return (DefaultPlan[])  plans.toArray(new DefaultPlan[plans.size()]);
+    public Collection<Plan> getCurrentPlans() {
+        return plans.getEntries();
+    }
+
+
+    public CatalogEntityCollection<Plan> getCatalogEntityCollectionPlan() {
+        return plans;
     }
 
     public boolean isTemplateCatalog() {
@@ -178,8 +183,8 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
       * @see org.killbill.billing.catalog.ICatalog#getPlan(java.lang.String, java.lang.String)
       */
     @Override
-    public DefaultPlan createOrFindCurrentPlan(final PlanSpecifier spec, final PlanPhasePriceOverridesWithCallContext unused) throws CatalogApiException {
-        final DefaultPlan result;
+    public Plan createOrFindCurrentPlan(final PlanSpecifier spec, final PlanPhasePriceOverridesWithCallContext unused) throws CatalogApiException {
+        final Plan result;
         if (spec.getPlanName() != null) {
             result = findCurrentPlan(spec.getPlanName());
         } else {
@@ -208,7 +213,7 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
         if (name == null || plans == null) {
             throw new CatalogApiException(ErrorCode.CAT_NO_SUCH_PLAN, name);
         }
-        final DefaultPlan result = plans.findByName(name);
+        final DefaultPlan result = (DefaultPlan) plans.findByName(name);
         if (result != null) {
             return result;
         }
@@ -297,11 +302,11 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
         super.initialize(catalog, sourceURI);
         planRules.initialize(catalog, sourceURI);
         priceLists.initialize(catalog, sourceURI);
-        for (final DefaultProduct p : products) {
-            p.initialize(catalog, sourceURI);
+        for (final Product p : products.getEntries()) {
+            ((DefaultProduct)p).initialize(catalog, sourceURI);
         }
-        for (final DefaultPlan p : plans) {
-            p.initialize(catalog, sourceURI);
+        for (final Plan p : plans.getEntries()) {
+            ((DefaultPlan) p).initialize(catalog, sourceURI);
         }
     }
 
@@ -318,8 +323,8 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
         return phase.compliesWithLimits(unit, value);
     }
 
-    public StandaloneCatalog setProducts(final DefaultProduct[] products) {
-        this.products = new CatalogEntityCollection<DefaultProduct>(products);
+    public StandaloneCatalog setProducts(final Collection<Product> products) {
+        this.products = new CatalogEntityCollection<Product>(products);
         return this;
     }
 
@@ -328,8 +333,8 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
         return this;
     }
 
-    public StandaloneCatalog setPlans(final DefaultPlan[] plans) {
-        this.plans = new CatalogEntityCollection<DefaultPlan>(plans);
+    public StandaloneCatalog setPlans(final Collection<Plan> plans) {
+        this.plans = new CatalogEntityCollection<Plan>(plans);
         return this;
     }
 
@@ -385,7 +390,7 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
                     for (BillingPeriod billingPeriod : BillingPeriod.values()) {
                         for (PriceList priceList : getPriceLists().getAllPriceLists()) {
                             if (priceListName == null || priceListName.equals(priceList.getName())) {
-                                Plan[] addonInList = priceList.findPlans(availAddon, billingPeriod);
+                                Collection<Plan> addonInList = priceList.findPlans(availAddon, billingPeriod);
                                 for (Plan cur : addonInList) {
                                     availAddons.add(new DefaultListing(cur, priceList));
                                 }
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalogWithPriceOverride.java b/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalogWithPriceOverride.java
index fbffc1f..8a42e4b 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalogWithPriceOverride.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalogWithPriceOverride.java
@@ -70,8 +70,8 @@ public class StandaloneCatalogWithPriceOverride extends StandaloneCatalog implem
 
 
     @Override
-    public DefaultPlan createOrFindCurrentPlan(final PlanSpecifier spec, final PlanPhasePriceOverridesWithCallContext overrides) throws CatalogApiException {
-        final DefaultPlan defaultPlan = super.createOrFindCurrentPlan(spec, null);
+    public Plan createOrFindCurrentPlan(final PlanSpecifier spec, final PlanPhasePriceOverridesWithCallContext overrides) throws CatalogApiException {
+        final Plan defaultPlan = super.createOrFindCurrentPlan(spec, null);
         if (overrides == null ||
             overrides.getOverrides() == null ||
             overrides.getOverrides().isEmpty()) {
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java b/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java
index ea97bcb..fbf5591 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/VersionedCatalog.java
@@ -20,6 +20,7 @@ package org.killbill.billing.catalog;
 
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
@@ -249,7 +250,7 @@ public class VersionedCatalog extends ValidatingConfig<VersionedCatalog> impleme
     }
 
     @Override
-    public DefaultProduct[] getProducts(final DateTime requestedDate) throws CatalogApiException {
+    public Collection<Product> getProducts(final DateTime requestedDate) throws CatalogApiException {
         return versionForDate(requestedDate).getCurrentProducts();
     }
 
@@ -259,7 +260,7 @@ public class VersionedCatalog extends ValidatingConfig<VersionedCatalog> impleme
     }
 
     @Override
-    public DefaultPlan[] getPlans(final DateTime requestedDate) throws CatalogApiException {
+    public Collection<Plan> getPlans(final DateTime requestedDate) throws CatalogApiException {
         return versionForDate(requestedDate).getCurrentPlans();
     }
 
@@ -435,7 +436,7 @@ public class VersionedCatalog extends ValidatingConfig<VersionedCatalog> impleme
     }
 
     @Override
-    public Product[] getCurrentProducts() throws CatalogApiException {
+    public Collection<Product> getCurrentProducts() throws CatalogApiException {
         return versionForDate(clock.getUTCNow()).getCurrentProducts();
     }
 
@@ -445,7 +446,7 @@ public class VersionedCatalog extends ValidatingConfig<VersionedCatalog> impleme
     }
 
     @Override
-    public Plan[] getCurrentPlans() throws CatalogApiException {
+    public Collection<Plan> getCurrentPlans() throws CatalogApiException {
         return versionForDate(clock.getUTCNow()).getCurrentPlans();
     }
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/caching/TestEhCacheCatalogCache.java b/catalog/src/test/java/org/killbill/billing/catalog/caching/TestEhCacheCatalogCache.java
index a5e675b..dca3946 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/caching/TestEhCacheCatalogCache.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/caching/TestEhCacheCatalogCache.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -33,6 +34,7 @@ import org.killbill.billing.catalog.StandaloneCatalog;
 import org.killbill.billing.catalog.StandaloneCatalogWithPriceOverride;
 import org.killbill.billing.catalog.VersionedCatalog;
 import org.killbill.billing.catalog.api.CatalogApiException;
+import org.killbill.billing.catalog.api.Product;
 import org.killbill.xmlloader.UriAccessor;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
@@ -83,8 +85,8 @@ public class TestEhCacheCatalogCache extends CatalogTestSuiteNoDB {
 
         final VersionedCatalog result = catalogCache.getCatalog(true, true, internalCallContext);
         Assert.assertNotNull(result);
-        final DefaultProduct[] products = result.getProducts(clock.getUTCNow());
-        Assert.assertEquals(products.length, 3);
+        final Collection<Product> products = result.getProducts(clock.getUTCNow());
+        Assert.assertEquals(products.size(), 3);
 
         // Verify the lookup with other contexts
         final VersionedCatalog resultForMultiTenantContext = new VersionedCatalog(result.getClock());
@@ -155,14 +157,14 @@ public class TestEhCacheCatalogCache extends CatalogTestSuiteNoDB {
         // Verify the lookup for this tenant
         final VersionedCatalog result = catalogCache.getCatalog(true, true, multiTenantContext);
         Assert.assertNotNull(result);
-        final DefaultProduct[] products = result.getProducts(clock.getUTCNow());
-        Assert.assertEquals(products.length, 6);
+        final Collection<Product> products = result.getProducts(clock.getUTCNow());
+        Assert.assertEquals(products.size(), 6);
 
         // Verify the lookup for another tenant
         final VersionedCatalog otherResult = catalogCache.getCatalog(true, true, otherMultiTenantContext);
         Assert.assertNotNull(otherResult);
-        final DefaultProduct[] otherProducts = otherResult.getProducts(clock.getUTCNow());
-        Assert.assertEquals(otherProducts.length, 3);
+        final Collection<Product> otherProducts = otherResult.getProducts(clock.getUTCNow());
+        Assert.assertEquals(otherProducts.size(), 3);
 
         shouldThrow.set(true);
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/io/TestXMLWriter.java b/catalog/src/test/java/org/killbill/billing/catalog/io/TestXMLWriter.java
index 5d7966f..b431e9a 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/io/TestXMLWriter.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/io/TestXMLWriter.java
@@ -117,7 +117,7 @@ public class TestXMLWriter extends CatalogTestSuiteNoDB {
 
         final String newCatalogStr = XMLWriter.writeXML((StandaloneCatalog) mutableCatalog, StandaloneCatalog.class);
         final StandaloneCatalog newCatalog = XMLLoader.getObjectFromStream(new URI("dummy"), new ByteArrayInputStream(newCatalogStr.getBytes(Charset.forName("UTF-8"))), StandaloneCatalog.class);
-        assertEquals(newCatalog.getCurrentPlans().length, catalog.getCurrentPlans().length + 1);
+        assertEquals(newCatalog.getCurrentPlans().size(), catalog.getCurrentPlans().size() + 1);
 
         final Plan plan = newCatalog.findCurrentPlan("dynamic-monthly");
         assertEquals(plan.getName(), "dynamic-monthly");
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java b/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java
index ed7bf4e..5c788a0 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java
@@ -20,6 +20,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
+import java.util.Iterator;
 import java.util.LinkedList;
 
 import org.joda.time.DateTime;
@@ -46,6 +47,8 @@ import org.killbill.billing.catalog.rules.DefaultCaseChangePlanPolicy;
 import org.killbill.billing.catalog.rules.DefaultCaseCreateAlignment;
 import org.killbill.billing.catalog.rules.DefaultPlanRules;
 
+import com.google.common.collect.ImmutableList;
+
 public class MockCatalog extends StandaloneCatalog implements Catalog {
 
     private static final String[] PRODUCT_NAMES = new String[]{"TestProduct1", "TestProduct2", "TestProduct3"};
@@ -57,7 +60,7 @@ public class MockCatalog extends StandaloneCatalog implements Catalog {
     public MockCatalog() {
         setEffectiveDate(new Date());
         setProducts(MockProduct.createAll());
-        setPlans((DefaultPlan[]) MockPlan.createAll());
+        setPlans(MockPlan.createAll());
         populateRules();
         populatePriceLists();
     }
@@ -76,14 +79,19 @@ public class MockCatalog extends StandaloneCatalog implements Catalog {
     }
 
     public void populatePriceLists() {
-        final DefaultPlan[] plans = getCurrentPlans();
-
-        final DefaultPriceList[] priceList = new DefaultPriceList[plans.length - 1];
-        for (int i = 1; i < plans.length; i++) {
-            priceList[i - 1] = new DefaultPriceList(new DefaultPlan[]{plans[i]}, plans[i].getName() + "-pl");
+        final Collection<Plan> plans = getCurrentPlans();
+
+        final DefaultPriceList[] priceList = new DefaultPriceList[plans.size() - 1];
+        int i = 1;
+        final Iterator<Plan> it = plans.iterator();
+        final Plan initialPlan = it.next();
+        while (it.hasNext()) {
+            final Plan plan = it.next();
+            priceList[i - 1] = new DefaultPriceList(new DefaultPlan[] { (DefaultPlan) plan}, plan.getName() + "-pl");
+            i++;
         }
 
-        final DefaultPriceListSet set = new DefaultPriceListSet(new PriceListDefault(new DefaultPlan[]{plans[0]}), priceList);
+        final DefaultPriceListSet set = new DefaultPriceListSet(new PriceListDefault(new DefaultPlan[]{(DefaultPlan) initialPlan}), priceList);
         setPriceLists(set);
     }
 
@@ -102,12 +110,12 @@ public class MockCatalog extends StandaloneCatalog implements Catalog {
     }
 
     @Override
-    public Product[] getProducts(final DateTime requestedDate) throws CatalogApiException {
+    public Collection<Product> getProducts(final DateTime requestedDate) throws CatalogApiException {
         return getCurrentProducts();
     }
 
     @Override
-    public Plan[] getPlans(final DateTime requestedDate) throws CatalogApiException {
+    public Collection<Plan> getPlans(final DateTime requestedDate) throws CatalogApiException {
         return getCurrentPlans();
     }
 
@@ -237,24 +245,11 @@ public class MockCatalog extends StandaloneCatalog implements Catalog {
         return canCreatePlan;
     }
 
-    @Override
-    public DefaultProduct[] getCurrentProducts() {
-        final Collection<DefaultProduct> unordered = super.getAllProducts();
-        final  DefaultProduct[] result = new DefaultProduct[unordered.size()];
-        convertCurrentEntries(unordered, result);
-        return result;
-    }
 
-
-    @Override
-    public DefaultPlan[] getCurrentPlans() {
-        final Collection<DefaultPlan> unordered = super.getAllPlans();
-        final DefaultPlan[] result = new DefaultPlan[unordered.size()];
-        convertCurrentEntries(unordered, result);
-        return result;
+    public DefaultProduct getCurrentProduct(int idx) {
+        return (DefaultProduct) getCurrentProducts().toArray()[idx];
     }
 
-
     private <T extends CatalogEntity> void convertCurrentEntries(final Collection<T> unordered, final T [] result) {
         // Tests are not so well written and make assumption on how such entries are ordered
         final LinkedList<T> list = new LinkedList<T>(unordered);
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/MockPlan.java b/catalog/src/test/java/org/killbill/billing/catalog/MockPlan.java
index 1781de8..54a95ba 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/MockPlan.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/MockPlan.java
@@ -16,6 +16,12 @@
 
 package org.killbill.billing.catalog;
 
+import java.util.Collection;
+
+import org.killbill.billing.catalog.api.Plan;
+
+import com.google.common.collect.ImmutableList;
+
 public class MockPlan extends DefaultPlan {
 
     public static MockPlan createBicycleTrialEvergreen1USD(final int trialDurationInDays) {
@@ -119,16 +125,14 @@ public class MockPlan extends DefaultPlan {
         setPlansAllowedInBundle(1);
     }
 
-    public static DefaultPlan[] createAll() {
-        return new DefaultPlan[]{
-                createBicycleTrialEvergreen1USD(),
-                createBicycleNoTrialEvergreen1USD(),
-                createPickupTrialEvergreen10USD(),
-                createSportsCarTrialEvergreen100USD(),
-                createJetTrialEvergreen1000USD(),
-                createJetTrialFixedTermEvergreen1000USD(),
-                createHornMonthlyNoTrial1USD()
-        };
+    public static Collection<Plan> createAll() {
+        return ImmutableList.<Plan>of(createBicycleTrialEvergreen1USD(),
+                               createBicycleNoTrialEvergreen1USD(),
+                               createPickupTrialEvergreen10USD(),
+                               createSportsCarTrialEvergreen100USD(),
+                               createJetTrialEvergreen1000USD(),
+                               createJetTrialFixedTermEvergreen1000USD(),
+                               createHornMonthlyNoTrial1USD());
     }
 
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/MockProduct.java b/catalog/src/test/java/org/killbill/billing/catalog/MockProduct.java
index 6014d43..5693004 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/MockProduct.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/MockProduct.java
@@ -16,8 +16,13 @@
 
 package org.killbill.billing.catalog;
 
+import java.util.Collection;
+
+import org.killbill.billing.catalog.api.Product;
 import org.killbill.billing.catalog.api.ProductCategory;
 
+import com.google.common.collect.ImmutableList;
+
 public class MockProduct extends DefaultProduct {
 
     public MockProduct() {
@@ -60,15 +65,14 @@ public class MockProduct extends DefaultProduct {
         return new MockProduct("6-RedPaintJob", ProductCategory.ADD_ON, "Vehcles");
     }
 
-    public static DefaultProduct[] createAll() {
-        return new MockProduct[]{
+    public static Collection<Product> createAll() {
+        return ImmutableList.<Product>of(
                 createBicycle(),
                 createPickup(),
                 createSportsCar(),
                 createJet(),
                 createHorn(),
-                createRedPaintJob()
-        };
+                createRedPaintJob());
     }
 
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCase.java b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCase.java
index 93774c4..6f55bcb 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCase.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCase.java
@@ -19,6 +19,7 @@ package org.killbill.billing.catalog.rules;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlIDREF;
 
+import org.killbill.billing.catalog.api.Product;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -84,8 +85,8 @@ public class TestCase extends CatalogTestSuiteNoDB {
             return priceList;
         }
 
-        protected DefaultCaseResult setProduct(final DefaultProduct product) {
-            this.product = product;
+        protected DefaultCaseResult setProduct(final Product product) {
+            this.product = (DefaultProduct) product;
             return this;
         }
 
@@ -109,7 +110,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
     public void testBasic() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -120,7 +121,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
     }
@@ -129,7 +130,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
     public void testWildCardProduct() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -141,7 +142,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
-        assertion(Result.FOO, cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
+        assertion(Result.FOO, cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
     }
@@ -150,7 +151,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
     public void testWildCardProductCategory() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -162,7 +163,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.ADD_ON, BillingPeriod.MONTHLY, priceList.getName(), cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
@@ -172,7 +173,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
     public void testWildCardBillingPeriod() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -184,7 +185,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
     }
@@ -193,7 +194,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
     public void testWildCardPriceList() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -205,7 +206,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
     }
@@ -214,7 +215,7 @@ public class TestCase extends CatalogTestSuiteNoDB {
     public void testCaseOrder() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final DefaultCaseResult cr0 = new DefaultCaseResult(
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCaseChange.java b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCaseChange.java
index e207fff..6528a3f 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCaseChange.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCaseChange.java
@@ -71,10 +71,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testBasic() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -92,14 +92,14 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      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.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -122,13 +122,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -143,10 +143,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardFromProduct() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -164,14 +164,14 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertion(Result.FOO, cr,
-                  cat.getCurrentProducts()[1].getName(), product2.getName(),
+                  cat.getCurrentProduct(1).getName(), product2.getName(),
                   BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                   priceList1.getName(), priceList2.getName(),
                   PhaseType.EVERGREEN, cat);
 
 
         assertionNull(cr,
-                      product1.getName(), cat.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.ANNUAL, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -187,13 +187,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -208,10 +208,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardToProduct() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -229,7 +229,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      cat.getCurrentProduct(1).getName(), product2.getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -237,7 +237,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
 
 
         assertion(Result.FOO, cr,
-                  product1.getName(), cat.getCurrentProducts()[1].getName(),
+                  product1.getName(), cat.getCurrentProduct(1).getName(),
                   BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                   priceList1.getName(), priceList2.getName(),
                   PhaseType.EVERGREEN, cat);
@@ -259,13 +259,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -280,10 +280,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardFromProductCategory() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -301,14 +301,14 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      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.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -337,13 +337,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -358,10 +358,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardToProductCategory() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -379,14 +379,14 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      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.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -416,13 +416,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -437,10 +437,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardFromBillingPeriod() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -458,14 +458,14 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      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.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -487,13 +487,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -508,10 +508,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildCardToBillingPeriod() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -529,7 +529,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      cat.getCurrentProduct(1).getName(), product2.getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -537,7 +537,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
 
 
         assertionNull(cr,
-                      product1.getName(), cat.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -559,13 +559,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -580,10 +580,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildCardFromPriceList() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -601,7 +601,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      cat.getCurrentProduct(1).getName(), product2.getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -609,7 +609,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
 
 
         assertionNull(cr,
-                      product1.getName(), cat.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -638,7 +638,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
@@ -653,10 +653,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardToPriceList() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -674,7 +674,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      cat.getCurrentProduct(1).getName(), product2.getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -682,7 +682,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
 
 
         assertionNull(cr,
-                      product1.getName(), cat.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -705,7 +705,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertion(Result.FOO, cr,
@@ -726,10 +726,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testWildcardPlanPhase() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr = new DefaultCaseChangeResult(
@@ -747,7 +747,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
                   PhaseType.EVERGREEN, cat);
 
         assertionNull(cr,
-                      cat.getCurrentProducts()[1].getName(), product2.getName(),
+                      cat.getCurrentProduct(1).getName(), product2.getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -755,7 +755,7 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
 
 
         assertionNull(cr,
-                      product1.getName(), cat.getCurrentProducts()[1].getName(),
+                      product1.getName(), cat.getCurrentProduct(1).getName(),
                       ProductCategory.BASE, ProductCategory.BASE,
                       BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
                       priceList1.getName(), priceList2.getName(),
@@ -778,13 +778,13 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           cat.getCurrentProducts()[1].getName(), priceList2.getName(),
+                           cat.getCurrentProduct(1).getName(), priceList2.getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertionException(cr,
                            product1.getName(), product2.getName(),
                            BillingPeriod.MONTHLY, BillingPeriod.MONTHLY,
-                           priceList1.getName(), cat.getCurrentProducts()[1].getName(),
+                           priceList1.getName(), cat.getCurrentProduct(1).getName(),
                            PhaseType.EVERGREEN, cat);
 
         assertion(Result.FOO, cr,
@@ -798,10 +798,10 @@ public class TestCaseChange extends CatalogTestSuiteNoDB {
     public void testOrder() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
-        final DefaultProduct product2 = cat.getCurrentProducts()[2];
+        final DefaultProduct product2 = cat.getCurrentProduct(2);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
 
         final DefaultCaseChangeResult cr0 = new DefaultCaseChangeResult(
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCasePhase.java b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCasePhase.java
index 22ecc52..2db00d3 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCasePhase.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestCasePhase.java
@@ -61,7 +61,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testBasic() {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -73,7 +73,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
@@ -83,7 +83,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testWildCardProduct() {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -95,7 +95,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
-        assertion(Result.FOO, cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
+        assertion(Result.FOO, cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
@@ -105,7 +105,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testWildCardProductCategory() {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -117,7 +117,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.ADD_ON, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
@@ -128,7 +128,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testWildCardBillingPeriod() {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -140,7 +140,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
@@ -150,7 +150,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testWildCardPriceList() {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -162,7 +162,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
@@ -172,7 +172,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testWildCardPhaseType() {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr = new DefaultCaseResult(
@@ -184,7 +184,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
                 Result.FOO);
 
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
-        assertionNull(cr, cat.getCurrentProducts()[1].getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
+        assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
         assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
         assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
@@ -194,7 +194,7 @@ public class TestCasePhase extends CatalogTestSuiteNoDB {
     public void testOrder() throws CatalogApiException {
         final MockCatalog cat = new MockCatalog();
 
-        final DefaultProduct product = cat.getCurrentProducts()[0];
+        final DefaultProduct product = cat.getCurrentProduct(0);
         final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
 
         final DefaultCaseResult cr0 = new DefaultCaseResult(
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestPlanRules.java b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestPlanRules.java
index 66fa6bf..950ea45 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/rules/TestPlanRules.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/rules/TestPlanRules.java
@@ -57,7 +57,7 @@ public class TestPlanRules extends CatalogTestSuiteNoDB {
 
     @Test(groups = "fast")
     public void testExistingPriceListIsKept() throws CatalogApiException {
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
 
         final PlanPhaseSpecifier from = new PlanPhaseSpecifier(product1.getName(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN);
@@ -79,8 +79,8 @@ public class TestPlanRules extends CatalogTestSuiteNoDB {
 
     @Test(groups = "fast")
     public void testBaseCase() throws CatalogApiException {
-        final DefaultProduct product1 = cat.getCurrentProducts()[0];
-        final DefaultProduct product2 = cat.getCurrentProducts()[1];
+        final DefaultProduct product1 = cat.getCurrentProduct(0);
+        final DefaultProduct product2 = cat.getCurrentProduct(1);
         final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
         final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[0];
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/TestCatalogUpdater.java b/catalog/src/test/java/org/killbill/billing/catalog/TestCatalogUpdater.java
index 8b98de5..a973ad1 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/TestCatalogUpdater.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/TestCatalogUpdater.java
@@ -58,7 +58,7 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         final CatalogUpdater catalogUpdater = new CatalogUpdater("dummy", BillingMode.IN_ADVANCE, now, null);
         final String catalogXML = catalogUpdater.getCatalogXML();
         final StandaloneCatalog catalog = XMLLoader.getObjectFromStream(new URI("dummy"), new ByteArrayInputStream(catalogXML.getBytes(Charset.forName("UTF-8"))), StandaloneCatalog.class);
-        assertEquals(catalog.getCurrentPlans().length, 0);
+        assertEquals(catalog.getCurrentPlans().size(), 0);
     }
 
     @Test(groups = "fast")
@@ -73,13 +73,13 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
 
         final StandaloneCatalog catalog = catalogUpdater.getCatalog();
 
-        assertEquals(catalog.getCurrentProducts().length, 1);
+        assertEquals(catalog.getCurrentProducts().size(), 1);
 
-        final Product product = catalog.getCurrentProducts()[0];
+        final Product product = catalog.getCurrentProducts().iterator().next();
         assertEquals(product.getName(), "Foo");
         assertEquals(product.getCategory(), ProductCategory.BASE);
 
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
         final Plan plan = catalog.findCurrentPlan("foo-monthly");
         assertEquals(plan.getName(), "foo-monthly");
@@ -97,8 +97,8 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         assertEquals(catalog.getPriceLists().getAllPriceLists().size(), 1);
         final PriceList priceList = catalog.getPriceLists().getAllPriceLists().get(0);
         assertEquals(priceList.getName(), new PriceListDefault().getName());
-        assertEquals(priceList.getPlans().length, 1);
-        assertEquals(priceList.getPlans()[0].getName(), "foo-monthly");
+        assertEquals(priceList.getPlans().size(), 1);
+        assertEquals(priceList.getPlans().iterator().next().getName(), "foo-monthly");
     }
 
 
@@ -114,13 +114,13 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
 
         final StandaloneCatalog catalog = catalogUpdater.getCatalog();
 
-        assertEquals(catalog.getCurrentProducts().length, 1);
+        assertEquals(catalog.getCurrentProducts().size(), 1);
 
-        final Product product = catalog.getCurrentProducts()[0];
+        final Product product = catalog.getCurrentProducts().iterator().next();
         assertEquals(product.getName(), "Foo");
         assertEquals(product.getCategory(), ProductCategory.BASE);
 
-        assertEquals(catalog.getCurrentPlans().length, 1);
+        assertEquals(catalog.getCurrentPlans().size(), 1);
 
         final Plan plan = catalog.findCurrentPlan("foo-monthly");
         assertEquals(plan.getName(), "foo-monthly");
@@ -144,8 +144,8 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         assertEquals(catalog.getPriceLists().getAllPriceLists().size(), 1);
         final PriceList priceList = catalog.getPriceLists().getAllPriceLists().get(0);
         assertEquals(priceList.getName(), new PriceListDefault().getName());
-        assertEquals(priceList.getPlans().length, 1);
-        assertEquals(priceList.getPlans()[0].getName(), "foo-monthly");
+        assertEquals(priceList.getPlans().size(), 1);
+        assertEquals(priceList.getPlans().iterator().next().getName(), "foo-monthly");
     }
 
 
@@ -156,7 +156,7 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         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().length, 3);
+        assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().size(), 3);
 
         final CatalogUpdater catalogUpdater = new CatalogUpdater(originalCatalog);
 
@@ -181,7 +181,7 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         assertEquals(catalog.getPriceLists().getAllPriceLists().size(), 1);
         final PriceList priceList = catalog.getPriceLists().getAllPriceLists().get(0);
         assertEquals(priceList.getName(), new PriceListDefault().getName());
-        assertEquals(priceList.getPlans().length, 4);
+        assertEquals(priceList.getPlans().size(), 4);
     }
 
 
@@ -191,7 +191,7 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         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().length, 3);
+        assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().size(), 3);
 
         final CatalogUpdater catalogUpdater = new CatalogUpdater(originalCatalog);
 
@@ -222,7 +222,7 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         final StandaloneCatalog originalCatalog = enhanceOriginalCatalogForInvalidTestCases("SpyCarBasic.xml");
         assertEquals(originalCatalog.getPriceLists().getAllPriceLists().size(), 1);
         assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getName(), new PriceListDefault().getName());
-        assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().length, 5);
+        assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().size(), 5);
 
         CatalogUpdater catalogUpdater = new CatalogUpdater(originalCatalog);
 
@@ -263,7 +263,7 @@ public class TestCatalogUpdater extends CatalogTestSuiteNoDB {
         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().length, 3);
+        assertEquals(originalCatalog.getPriceLists().getAllPriceLists().get(0).getPlans().size(), 3);
 
         final CatalogUpdater catalogUpdater = new CatalogUpdater(originalCatalog);
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/TestInternationalPrice.java b/catalog/src/test/java/org/killbill/billing/catalog/TestInternationalPrice.java
index a3803e2..12cc090 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/TestInternationalPrice.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/TestInternationalPrice.java
@@ -63,9 +63,9 @@ public class TestInternationalPrice extends CatalogTestSuiteNoDB {
     public void testPriceInitialization() throws URISyntaxException, CatalogApiException {
         final StandaloneCatalog c = new MockCatalog();
         c.setSupportedCurrencies(new Currency[]{Currency.GBP, Currency.EUR, Currency.USD, Currency.BRL, Currency.MXN});
-        ((DefaultInternationalPrice) c.getCurrentPlans()[0].getFinalPhase().getRecurring().getRecurringPrice()).setPrices(null);
+        ((DefaultInternationalPrice) c.getCurrentPlans().iterator().next().getFinalPhase().getRecurring().getRecurringPrice()).setPrices(null);
         c.initialize(c, new URI("foo://bar"));
-        Assert.assertEquals(c.getCurrentPlans()[0].getFinalPhase().getRecurring().getRecurringPrice().getPrice(Currency.GBP), new BigDecimal(0));
+        Assert.assertEquals(c.getCurrentPlans().iterator().next().getFinalPhase().getRecurring().getRecurringPrice().getPrice(Currency.GBP), new BigDecimal(0));
     }
 
     @Test(groups = "fast")
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/TestStandaloneCatalog.java b/catalog/src/test/java/org/killbill/billing/catalog/TestStandaloneCatalog.java
index 93b491e..78b4554 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/TestStandaloneCatalog.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/TestStandaloneCatalog.java
@@ -16,12 +16,15 @@
 
 package org.killbill.billing.catalog;
 
+import org.killbill.billing.catalog.api.Plan;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
 import org.killbill.billing.catalog.api.CatalogApiException;
 import org.killbill.billing.catalog.api.PhaseType;
 
+import com.google.common.collect.ImmutableList;
+
 public class TestStandaloneCatalog extends CatalogTestSuiteNoDB {
 
     @Test(groups = "fast")
@@ -38,7 +41,7 @@ public class TestStandaloneCatalog extends CatalogTestSuiteNoDB {
         phaseDiscount1.setPlan(plan1);
         phaseDiscount2.setPlan(plan2);
 
-        final StandaloneCatalog cat = new MockCatalog().setPlans(new DefaultPlan[]{plan1, plan2});
+        final StandaloneCatalog cat = new MockCatalog().setPlans(ImmutableList.<Plan>of(plan1, plan2));
 
         Assert.assertEquals(cat.findCurrentPhase("TestPlan1-discount"), phaseDiscount1);
         Assert.assertEquals(cat.findCurrentPhase("TestPlan2-discount"), phaseDiscount2);
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/CatalogJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/CatalogJson.java
index 79a2b8b..1f44b5d 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/CatalogJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/CatalogJson.java
@@ -20,6 +20,7 @@ package org.killbill.billing.jaxrs.json;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -80,7 +81,7 @@ public class CatalogJson {
         currencies = Arrays.asList(catalog.getSupportedCurrencies(requestedDate));
         priceLists = new ArrayList<PriceListJson>();
 
-        final Plan[] plans = catalog.getPlans(requestedDate);
+        final Collection<Plan> plans = catalog.getPlans(requestedDate);
         final Map<String, ProductJson> productMap = new HashMap<String, ProductJson>();
         for (final Plan plan : plans) {
             // Build the product associated with this plan
@@ -190,7 +191,7 @@ public class CatalogJson {
         return pricesJson;
     }
 
-    private List<String> toProductNames(final Product[] in) {
+    private List<String> toProductNames(final Collection<Product> in) {
         return Lists.transform(ImmutableList.<Product>copyOf(in),
                                new Function<Product, String>() {
                                    @Override
diff --git a/subscription/src/main/java/org/killbill/billing/subscription/engine/addon/AddonUtils.java b/subscription/src/main/java/org/killbill/billing/subscription/engine/addon/AddonUtils.java
index 7098709..8fd9da7 100644
--- a/subscription/src/main/java/org/killbill/billing/subscription/engine/addon/AddonUtils.java
+++ b/subscription/src/main/java/org/killbill/billing/subscription/engine/addon/AddonUtils.java
@@ -16,6 +16,7 @@
 
 package org.killbill.billing.subscription.engine.addon;
 
+import java.util.Collection;
 import java.util.List;
 
 import org.joda.time.DateTime;
@@ -105,7 +106,7 @@ public class AddonUtils {
 
     private boolean isAddonAvailable(final Product baseProduct, final Plan targetAddOnPlan) {
         final Product targetAddonProduct = targetAddOnPlan.getProduct();
-        final Product[] availableAddOns = baseProduct.getAvailable();
+        final Collection<Product> availableAddOns = baseProduct.getAvailable();
 
         for (final Product curAv : availableAddOns) {
             if (curAv.getName().equals(targetAddonProduct.getName())) {
@@ -117,7 +118,7 @@ public class AddonUtils {
 
     private boolean isAddonIncluded(final Product baseProduct, final Plan targetAddOnPlan) {
         final Product targetAddonProduct = targetAddOnPlan.getProduct();
-        final Product[] includedAddOns = baseProduct.getIncluded();
+        final Collection<Product> includedAddOns = baseProduct.getIncluded();
         for (final Product curAv : includedAddOns) {
             if (curAv.getName().equals(targetAddonProduct.getName())) {
                 return true;
diff --git a/util/src/test/java/org/killbill/billing/mock/MockPriceList.java b/util/src/test/java/org/killbill/billing/mock/MockPriceList.java
index 0d22447..9722cb2 100644
--- a/util/src/test/java/org/killbill/billing/mock/MockPriceList.java
+++ b/util/src/test/java/org/killbill/billing/mock/MockPriceList.java
@@ -16,6 +16,7 @@
 
 package org.killbill.billing.mock;
 
+import java.util.Collection;
 import java.util.UUID;
 
 import org.killbill.billing.catalog.api.BillingPeriod;
@@ -23,6 +24,8 @@ import org.killbill.billing.catalog.api.Plan;
 import org.killbill.billing.catalog.api.PriceList;
 import org.killbill.billing.catalog.api.Product;
 
+import com.google.common.collect.ImmutableList;
+
 public class MockPriceList implements PriceList {
     private final String name;
     private final Plan plan;
@@ -42,10 +45,8 @@ public class MockPriceList implements PriceList {
     }
 
     @Override
-    public Plan[] findPlans(final Product product, final BillingPeriod period) {
-        final Plan[] result = new Plan[1];
-        result[0] = plan;
-        return result;
+    public Collection<Plan> findPlans(final Product product, final BillingPeriod period) {
+        return ImmutableList.of(plan);
     }
 
     public Plan getPlan() {
@@ -53,7 +54,8 @@ public class MockPriceList implements PriceList {
     }
 
     @Override
-    public Plan[] getPlans() {
-        return new Plan[] { plan };
+    public Collection<Plan> getPlans() {
+        return ImmutableList.of(plan);
     }
+
 }
diff --git a/util/src/test/java/org/killbill/billing/mock/MockProduct.java b/util/src/test/java/org/killbill/billing/mock/MockProduct.java
index 046c18a..3e3ad3e 100644
--- a/util/src/test/java/org/killbill/billing/mock/MockProduct.java
+++ b/util/src/test/java/org/killbill/billing/mock/MockProduct.java
@@ -16,17 +16,21 @@
 
 package org.killbill.billing.mock;
 
+import java.util.Collection;
+
 import org.killbill.billing.catalog.api.Limit;
 import org.killbill.billing.catalog.api.Product;
 import org.killbill.billing.catalog.api.ProductCategory;
 
+import com.google.common.collect.ImmutableList;
+
 public class MockProduct implements Product {
 
     private final String name;
     private final ProductCategory category;
     private final String catalogName;
-    private final Product[] included;
-    private final Product[] available;
+    private final Collection<Product> included;
+    private final Collection<Product> available;
 
     public MockProduct() {
         this("TestProduct", ProductCategory.BASE, "Vehicules");
@@ -40,8 +44,8 @@ public class MockProduct implements Product {
         this.name = name;
         this.category = category;
         this.catalogName = catalogName;
-        this.included = included;
-        this.available = available;
+        this.included = ImmutableList.copyOf(included);
+        this.available = ImmutableList.copyOf(available);
     }
 
     @Override
@@ -60,12 +64,12 @@ public class MockProduct implements Product {
     }
 
     @Override
-    public Product[] getAvailable() {
+    public Collection<Product> getAvailable() {
         return available;
     }
 
     @Override
-    public Product[] getIncluded() {
+    public Collection<Product> getIncluded() {
         return included;
     }