Details
diff --git a/catalog/src/test/java/com/ning/billing/catalog/CatalogTestSuite.java b/catalog/src/test/java/com/ning/billing/catalog/CatalogTestSuite.java
new file mode 100644
index 0000000..1db1839
--- /dev/null
+++ b/catalog/src/test/java/com/ning/billing/catalog/CatalogTestSuite.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.catalog;
+
+import com.ning.billing.KillbillTestSuite;
+
+public abstract class CatalogTestSuite extends KillbillTestSuite {
+}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/io/TestVersionedCatalogLoader.java b/catalog/src/test/java/com/ning/billing/catalog/io/TestVersionedCatalogLoader.java
index dc2b28b..ac30ca3 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/io/TestVersionedCatalogLoader.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/io/TestVersionedCatalogLoader.java
@@ -13,6 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
+
package com.ning.billing.catalog.io;
import javax.xml.bind.JAXBException;
@@ -26,47 +27,43 @@ import java.util.Iterator;
import java.util.List;
import org.joda.time.DateTime;
+import org.testng.Assert;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import com.google.common.io.Resources;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.StandaloneCatalog;
import com.ning.billing.catalog.VersionedCatalog;
import com.ning.billing.catalog.api.InvalidConfigException;
import com.ning.billing.lifecycle.KillbillService.ServiceException;
import com.ning.billing.util.clock.DefaultClock;
-import static org.testng.AssertJUnit.assertEquals;
-
-public class TestVersionedCatalogLoader {
+public class TestVersionedCatalogLoader extends CatalogTestSuite {
private final VersionedCatalogLoader loader = new VersionedCatalogLoader(new DefaultClock());
-
- @Test(enabled = true)
- public void testAppendToURI() throws MalformedURLException, IOException, URISyntaxException {
+ @Test(groups = "fast")
+ public void testAppendToURI() throws IOException, URISyntaxException {
final URL u1 = new URL("http://www.ning.com/foo");
- assertEquals("http://www.ning.com/foo/bar", loader.appendToURI(u1, "bar").toString());
+ Assert.assertEquals(loader.appendToURI(u1, "bar").toString(), "http://www.ning.com/foo/bar");
final URL u2 = new URL("http://www.ning.com/foo/");
- assertEquals("http://www.ning.com/foo/bar", loader.appendToURI(u2, "bar").toString());
-
+ Assert.assertEquals(loader.appendToURI(u2, "bar").toString(), "http://www.ning.com/foo/bar");
}
-
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testFindXmlFileReferences() throws MalformedURLException, URISyntaxException {
final String page = "dg.xml\n" +
"replica.foo\n" +
"snv1/\n" +
"viking.xml\n";
final List<URI> urls = loader.findXmlFileReferences(page, new URL("http://ning.com/"));
- assertEquals(2, urls.size());
- assertEquals("http://ning.com/dg.xml", urls.get(0).toString());
- assertEquals("http://ning.com/viking.xml", urls.get(1).toString());
-
+ Assert.assertEquals(urls.size(), 2);
+ Assert.assertEquals(urls.get(0).toString(), "http://ning.com/dg.xml");
+ Assert.assertEquals(urls.get(1).toString(), "http://ning.com/viking.xml");
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testExtractHrefs() {
final String page = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">" +
"<html>" +
@@ -86,12 +83,12 @@ public class TestVersionedCatalogLoader {
"<address>Apache/2.2.3 (CentOS) Server at <a href=\"mailto:kate@ning.com\">gepo.ningops.net</a> Port 80</address>" +
"</body></html>";
final List<String> hrefs = loader.extractHrefs(page);
- assertEquals(8, hrefs.size());
- assertEquals("/config/trunk/", hrefs.get(0));
- assertEquals("dg.xml", hrefs.get(1));
+ Assert.assertEquals(hrefs.size(), 8);
+ Assert.assertEquals(hrefs.get(0), "/config/trunk/");
+ Assert.assertEquals(hrefs.get(1), "dg.xml");
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testFindXmlUrlReferences() throws MalformedURLException, URISyntaxException {
final String page = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">" +
"<html>" +
@@ -111,22 +108,21 @@ public class TestVersionedCatalogLoader {
"<address>Apache/2.2.3 (CentOS) Server at <a href=\"mailto:kate@ning.com\">gepo.ningops.net</a> Port 80</address>" +
"</body></html>";
final List<URI> uris = loader.findXmlUrlReferences(page, new URL("http://ning.com/"));
- assertEquals(2, uris.size());
- assertEquals("http://ning.com/dg.xml", uris.get(0).toString());
- assertEquals("http://ning.com/viking.xml", uris.get(1).toString());
-
+ Assert.assertEquals(uris.size(), 2);
+ Assert.assertEquals(uris.get(0).toString(), "http://ning.com/dg.xml");
+ Assert.assertEquals(uris.get(1).toString(), "http://ning.com/viking.xml");
}
- @Test(enabled = true)
- public void testLoad() throws MalformedURLException, IOException, SAXException, InvalidConfigException, JAXBException, TransformerException, URISyntaxException, ServiceException {
+ @Test(groups = "fast")
+ public void testLoad() throws IOException, SAXException, InvalidConfigException, JAXBException, TransformerException, URISyntaxException, ServiceException {
final VersionedCatalog c = loader.load(Resources.getResource("versionedCatalog").toString());
- assertEquals(3, c.size());
+ Assert.assertEquals(c.size(), 3);
final Iterator<StandaloneCatalog> it = c.iterator();
DateTime dt = new DateTime("2011-01-01T00:00:00+00:00");
- assertEquals(dt.toDate(), it.next().getEffectiveDate());
+ Assert.assertEquals(it.next().getEffectiveDate(), dt.toDate());
dt = new DateTime("2011-02-02T00:00:00+00:00");
- assertEquals(dt.toDate(), it.next().getEffectiveDate());
+ Assert.assertEquals(it.next().getEffectiveDate(), dt.toDate());
dt = new DateTime("2011-03-03T00:00:00+00:00");
- assertEquals(dt.toDate(), it.next().getEffectiveDate());
+ Assert.assertEquals(it.next().getEffectiveDate(), dt.toDate());
}
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java b/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java
index b03f18b..8d91c8e 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/io/TestXMLReader.java
@@ -16,18 +16,22 @@
package com.ning.billing.catalog.io;
+import org.testng.Assert;
import org.testng.annotations.Test;
import com.google.common.io.Resources;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.StandaloneCatalog;
import com.ning.billing.util.config.XMLLoader;
-public class TestXMLReader {
-
- @Test(enabled = true)
- public void testCatalogLoad() throws Exception {
- XMLLoader.getObjectFromString(Resources.getResource("WeaponsHire.xml").toExternalForm(), StandaloneCatalog.class);
- XMLLoader.getObjectFromString(Resources.getResource("WeaponsHireSmall.xml").toExternalForm(), StandaloneCatalog.class);
+public class TestXMLReader extends CatalogTestSuite {
+ @Test(groups = "fast")
+ public void testCatalogLoad() {
+ try {
+ XMLLoader.getObjectFromString(Resources.getResource("WeaponsHire.xml").toExternalForm(), StandaloneCatalog.class);
+ XMLLoader.getObjectFromString(Resources.getResource("WeaponsHireSmall.xml").toExternalForm(), StandaloneCatalog.class);
+ } catch (Exception e) {
+ Assert.fail(e.toString());
+ }
}
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/rules/TestCase.java b/catalog/src/test/java/com/ning/billing/catalog/rules/TestCase.java
index 5ae3793..50c1186 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/rules/TestCase.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/rules/TestCase.java
@@ -23,6 +23,7 @@ import org.testng.Assert;
import org.testng.annotations.Test;
import com.ning.billing.ErrorCode;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.DefaultPriceList;
import com.ning.billing.catalog.DefaultProduct;
import com.ning.billing.catalog.MockCatalog;
@@ -33,13 +34,8 @@ import com.ning.billing.catalog.api.PlanSpecifier;
import com.ning.billing.catalog.api.PriceListSet;
import com.ning.billing.catalog.api.ProductCategory;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-public class TestCase {
-
+public class TestCase extends CatalogTestSuite {
protected class CaseResult extends Case<Result> {
-
@XmlElement(required = true)
private final Result policy;
@@ -107,14 +103,13 @@ public class TestCase {
}
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testBasic() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -129,14 +124,13 @@ public class TestCase {
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardProduct() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
-
final CaseResult cr = new CaseResult(
null,
ProductCategory.BASE,
@@ -152,14 +146,13 @@ public class TestCase {
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardProductCategory() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
-
final CaseResult cr = new CaseResult(
product,
null,
@@ -175,14 +168,13 @@ public class TestCase {
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardBillingPeriod() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -198,14 +190,13 @@ public class TestCase {
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardPriceList() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -228,7 +219,6 @@ public class TestCase {
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
-
final CaseResult cr0 = new CaseResult(
product,
ProductCategory.BASE,
@@ -258,17 +248,16 @@ public class TestCase {
Result.LALA);
final Result r1 = Case.getResult(new CaseResult[]{cr0, cr1, cr2, cr3},
- new PlanSpecifier(product.getName(), product.getCategory(), BillingPeriod.MONTHLY, priceList.getName()), cat);
- assertEquals(Result.FOO, r1);
+ new PlanSpecifier(product.getName(), product.getCategory(), BillingPeriod.MONTHLY, priceList.getName()), cat);
+ Assert.assertEquals(r1, Result.FOO);
final Result r2 = Case.getResult(new CaseResult[]{cr0, cr1, cr2},
- new PlanSpecifier(product.getName(), product.getCategory(), BillingPeriod.ANNUAL, priceList.getName()), cat);
- assertEquals(Result.DIPSY, r2);
+ new PlanSpecifier(product.getName(), product.getCategory(), BillingPeriod.ANNUAL, priceList.getName()), cat);
+ Assert.assertEquals(r2, Result.DIPSY);
}
-
protected void assertionNull(final CaseResult cr, final String productName, final ProductCategory productCategory, final BillingPeriod bp, final String priceListName, final StandaloneCatalog cat) throws CatalogApiException {
- assertNull(cr.getResult(new PlanSpecifier(productName, productCategory, bp, priceListName), cat));
+ Assert.assertNull(cr.getResult(new PlanSpecifier(productName, productCategory, bp, priceListName), cat));
}
protected void assertionException(final CaseResult cr, final String productName, final ProductCategory productCategory, final BillingPeriod bp, final String priceListName, final StandaloneCatalog cat) {
@@ -281,8 +270,6 @@ public class TestCase {
}
protected void assertion(final Result result, final CaseResult cr, final String productName, final ProductCategory productCategory, final BillingPeriod bp, final String priceListName, final StandaloneCatalog cat) throws CatalogApiException {
- assertEquals(result, cr.getResult(new PlanSpecifier(productName, productCategory, bp, priceListName), cat));
+ Assert.assertEquals(result, cr.getResult(new PlanSpecifier(productName, productCategory, bp, priceListName), cat));
}
-
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/rules/TestCaseChange.java b/catalog/src/test/java/com/ning/billing/catalog/rules/TestCaseChange.java
index a52b02c..e29d713 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/rules/TestCaseChange.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/rules/TestCaseChange.java
@@ -22,6 +22,7 @@ import org.testng.Assert;
import org.testng.annotations.Test;
import com.ning.billing.ErrorCode;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.DefaultPriceList;
import com.ning.billing.catalog.DefaultProduct;
import com.ning.billing.catalog.MockCatalog;
@@ -34,12 +35,8 @@ import com.ning.billing.catalog.api.PlanSpecifier;
import com.ning.billing.catalog.api.PriceListSet;
import com.ning.billing.catalog.api.ProductCategory;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-public class TestCaseChange {
+public class TestCaseChange extends CatalogTestSuite {
protected static class CaseChangeResult extends CaseChange<Result> {
-
@XmlElement(required = true)
private final Result result;
@@ -68,7 +65,7 @@ public class TestCaseChange {
}
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testBasic() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -78,7 +75,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -158,7 +154,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardFromProduct() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -168,7 +164,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
null, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -241,7 +236,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardToProduct() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -251,7 +246,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, null,
ProductCategory.BASE, ProductCategory.BASE,
@@ -331,7 +325,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardFromProductCategory() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -341,7 +335,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
null, ProductCategory.BASE,
@@ -421,7 +414,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardToProductCategory() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -431,7 +424,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, null,
@@ -511,7 +503,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardFromBillingPeriod() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -521,7 +513,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -601,8 +592,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
-
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardToBillingPeriod() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -612,7 +602,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -692,7 +681,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardFromPriceList() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -702,7 +691,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -782,7 +770,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardToPriceList() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -792,7 +780,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -872,7 +859,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildcardPlanPhase() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -882,7 +869,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -962,8 +948,7 @@ public class TestCaseChange {
PhaseType.TRIAL, cat);
}
-
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testOrder() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
@@ -973,7 +958,6 @@ public class TestCaseChange {
final DefaultProduct product2 = cat.getCurrentProducts()[2];
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[1];
-
final CaseChangeResult cr0 = new CaseChangeResult(
product1, product2,
ProductCategory.BASE, ProductCategory.BASE,
@@ -1015,20 +999,18 @@ public class TestCaseChange {
Result.LALA);
final Result r1 = CaseChange.getResult(new CaseChangeResult[]{cr0, cr1, cr2, cr3, cr4},
- new PlanPhaseSpecifier(product1.getName(), product1.getCategory(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN),
- new PlanSpecifier(product2.getName(), product2.getCategory(), BillingPeriod.MONTHLY, priceList2.getName()), cat);
+ new PlanPhaseSpecifier(product1.getName(), product1.getCategory(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN),
+ new PlanSpecifier(product2.getName(), product2.getCategory(), BillingPeriod.MONTHLY, priceList2.getName()), cat);
- assertEquals(Result.FOO, r1);
+ Assert.assertEquals(r1, Result.FOO);
final Result r2 = CaseChange.getResult(new CaseChangeResult[]{cr0, cr1, cr2, cr3, cr4},
- new PlanPhaseSpecifier(product1.getName(), product1.getCategory(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN),
- new PlanSpecifier(product2.getName(), product2.getCategory(), BillingPeriod.ANNUAL, priceList2.getName()), cat);
-
- assertEquals(Result.DIPSY, r2);
+ new PlanPhaseSpecifier(product1.getName(), product1.getCategory(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN),
+ new PlanSpecifier(product2.getName(), product2.getCategory(), BillingPeriod.ANNUAL, priceList2.getName()), cat);
+ Assert.assertEquals(r2, Result.DIPSY);
}
-
protected void assertionNull(final CaseChangeResult cr,
final String fromProductName, final String toProductName,
final ProductCategory fromProductCategory, final ProductCategory toProductCategory,
@@ -1036,8 +1018,8 @@ public class TestCaseChange {
final String fromPriceListName, final String toPriceListName,
final PhaseType phaseType, final StandaloneCatalog cat) {
try {
- assertNull(cr.getResult(new PlanPhaseSpecifier(fromProductName, fromProductCategory, fromBp, fromPriceListName, phaseType),
- new PlanSpecifier(toProductName, toProductCategory, toBp, toPriceListName), cat));
+ Assert.assertNull(cr.getResult(new PlanPhaseSpecifier(fromProductName, fromProductCategory, fromBp, fromPriceListName, phaseType),
+ new PlanSpecifier(toProductName, toProductCategory, toBp, toPriceListName), cat));
} catch (CatalogApiException e) {
Assert.fail("", e);
}
@@ -1065,11 +1047,10 @@ public class TestCaseChange {
final String fromPriceListName, final String toPriceListName,
final PhaseType phaseType, final StandaloneCatalog cat) {
try {
- assertEquals(result, cr.getResult(new PlanPhaseSpecifier(fromProductName, fromProductCategory, fromBp, fromPriceListName, phaseType),
- new PlanSpecifier(toProductName, toProductCategory, toBp, toPriceListName), cat));
+ Assert.assertEquals(result, cr.getResult(new PlanPhaseSpecifier(fromProductName, fromProductCategory, fromBp, fromPriceListName, phaseType),
+ new PlanSpecifier(toProductName, toProductCategory, toBp, toPriceListName), cat));
} catch (CatalogApiException e) {
Assert.fail("", e);
}
}
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/rules/TestCasePhase.java b/catalog/src/test/java/com/ning/billing/catalog/rules/TestCasePhase.java
index 26dfc5c..e7ae6a8 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/rules/TestCasePhase.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/rules/TestCasePhase.java
@@ -22,6 +22,7 @@ import org.testng.Assert;
import org.testng.annotations.Test;
import com.ning.billing.ErrorCode;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.DefaultPriceList;
import com.ning.billing.catalog.DefaultProduct;
import com.ning.billing.catalog.MockCatalog;
@@ -32,9 +33,8 @@ import com.ning.billing.catalog.api.PhaseType;
import com.ning.billing.catalog.api.PlanPhaseSpecifier;
import com.ning.billing.catalog.api.ProductCategory;
-public class TestCasePhase {
+public class TestCasePhase extends CatalogTestSuite {
protected class CaseResult extends CasePhase<Result> {
-
@XmlElement(required = true)
private final Result policy;
@@ -55,14 +55,13 @@ public class TestCasePhase {
}
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testBasic() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -79,14 +78,13 @@ public class TestCasePhase {
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardProduct() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr = new CaseResult(
null,
ProductCategory.BASE,
@@ -103,14 +101,13 @@ public class TestCasePhase {
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardProductCategory() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr = new CaseResult(
product,
null,
@@ -127,14 +124,13 @@ public class TestCasePhase {
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardBillingPeriod() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -151,14 +147,13 @@ public class TestCasePhase {
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardPriceList() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -175,14 +170,13 @@ public class TestCasePhase {
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testWildCardPhaseType() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr = new CaseResult(
product,
ProductCategory.BASE,
@@ -199,14 +193,13 @@ public class TestCasePhase {
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testOrder() throws CatalogApiException {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProducts()[0];
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
-
final CaseResult cr0 = new CaseResult(
product,
ProductCategory.BASE,
@@ -248,18 +241,17 @@ public class TestCasePhase {
Result.LALA);
final Result r1 = CasePhase.getResult(new CaseResult[]{cr0, cr1, cr2, cr3, cr4},
- new PlanPhaseSpecifier(product.getName(), product.getCategory(), BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN), cat);
+ new PlanPhaseSpecifier(product.getName(), product.getCategory(), BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN), cat);
Assert.assertEquals(Result.FOO, r1);
final Result r2 = CasePhase.getResult(new CaseResult[]{cr0, cr1, cr2, cr3, cr4},
- new PlanPhaseSpecifier(product.getName(), product.getCategory(), BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN), cat);
+ new PlanPhaseSpecifier(product.getName(), product.getCategory(), BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN), cat);
Assert.assertEquals(Result.DIPSY, r2);
}
-
protected void assertionNull(final CaseResult cr, final String productName, final ProductCategory productCategory, final BillingPeriod bp, final String priceListName, final PhaseType phaseType, final StandaloneCatalog cat) {
try {
Assert.assertNull(cr.getResult(new PlanPhaseSpecifier(productName, productCategory, bp, priceListName, phaseType), cat));
@@ -268,7 +260,6 @@ public class TestCasePhase {
}
}
-
protected void assertionException(final CaseResult cr, final String productName, final ProductCategory productCategory, final BillingPeriod bp, final String priceListName, final PhaseType phaseType, final StandaloneCatalog cat) {
try {
Assert.assertNull(cr.getResult(new PlanPhaseSpecifier(productName, productCategory, bp, priceListName, phaseType), cat));
@@ -285,6 +276,4 @@ public class TestCasePhase {
Assert.fail("", e);
}
}
-
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/rules/TestLoadRules.java b/catalog/src/test/java/com/ning/billing/catalog/rules/TestLoadRules.java
index 0e8b04e..27cf7d1 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/rules/TestLoadRules.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/rules/TestLoadRules.java
@@ -16,11 +16,13 @@
package com.ning.billing.catalog.rules;
-import java.io.File;
+import java.net.URI;
import org.testng.Assert;
import org.testng.annotations.Test;
+import com.google.common.io.Resources;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.StandaloneCatalog;
import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.PlanAlignmentCreate;
@@ -28,22 +30,22 @@ import com.ning.billing.catalog.api.PlanSpecifier;
import com.ning.billing.catalog.api.ProductCategory;
import com.ning.billing.util.config.XMLLoader;
-public class TestLoadRules {
-
- @Test
+public class TestLoadRules extends CatalogTestSuite {
+ @Test(groups = "fast")
public void test() throws Exception {
- final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(new File("src/test/resources/WeaponsHireSmall.xml").toURI(), StandaloneCatalog.class);
+ final URI uri = new URI(Resources.getResource("WeaponsHireSmall.xml").toExternalForm());
+ final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(uri, StandaloneCatalog.class);
Assert.assertNotNull(catalog);
final PlanRules rules = catalog.getPlanRules();
final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", ProductCategory.ADD_ON, BillingPeriod.MONTHLY,
- "DEFAULT");
+ "DEFAULT");
final PlanAlignmentCreate alignment = rules.getPlanCreateAlignment(specifier, catalog);
Assert.assertEquals(alignment, PlanAlignmentCreate.START_OF_SUBSCRIPTION);
final PlanSpecifier specifier2 = new PlanSpecifier("Extra-Ammo", ProductCategory.ADD_ON, BillingPeriod.MONTHLY,
- "DEFAULT");
+ "DEFAULT");
final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
diff --git a/catalog/src/test/java/com/ning/billing/catalog/rules/TestPlanRules.java b/catalog/src/test/java/com/ning/billing/catalog/rules/TestPlanRules.java
index bc876d3..2795dc1 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/rules/TestPlanRules.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/rules/TestPlanRules.java
@@ -22,6 +22,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import com.ning.billing.catalog.CatalogTestSuite;
import com.ning.billing.catalog.DefaultPriceList;
import com.ning.billing.catalog.DefaultProduct;
import com.ning.billing.catalog.MockCatalog;
@@ -36,12 +37,11 @@ import com.ning.billing.catalog.api.PlanPhaseSpecifier;
import com.ning.billing.catalog.api.PlanSpecifier;
import com.ning.billing.catalog.api.PriceListSet;
-public class TestPlanRules {
- Logger log = LoggerFactory.getLogger(TestPlanRules.class);
-
+public class TestPlanRules extends CatalogTestSuite {
+ private final Logger log = LoggerFactory.getLogger(TestPlanRules.class);
private MockCatalog cat = null;
- @BeforeTest
+ @BeforeTest(groups = "fast")
public void setup() {
cat = new MockCatalog();
@@ -57,7 +57,7 @@ public class TestPlanRules {
setPriceListCase(new CasePriceList[]{casePriceList});
}
- @Test
+ @Test(groups = "fast")
public void testCannotChangeToSamePlan() throws CatalogApiException {
final DefaultProduct product1 = cat.getCurrentProducts()[0];
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
@@ -73,10 +73,9 @@ public class TestPlanRules {
} catch (CatalogApiException e) {
Assert.fail("", e);
}
-
}
- @Test
+ @Test(groups = "fast")
public void testExistingPriceListIsKept() throws CatalogApiException {
final DefaultProduct product1 = cat.getCurrentProducts()[0];
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
@@ -97,11 +96,9 @@ public class TestPlanRules {
Assert.assertEquals(result.getPolicy(), ActionPolicy.END_OF_TERM);
Assert.assertEquals(result.getAlignment(), PlanAlignmentChange.START_OF_SUBSCRIPTION);
Assert.assertEquals(result.getNewPriceList(), priceList1);
-
}
-
- @Test
+ @Test(groups = "fast")
public void testBaseCase() throws CatalogApiException {
final DefaultProduct product1 = cat.getCurrentProducts()[0];
final DefaultProduct product2 = cat.getCurrentProducts()[1];
@@ -124,8 +121,5 @@ public class TestPlanRules {
Assert.assertEquals(result.getPolicy(), ActionPolicy.END_OF_TERM);
Assert.assertEquals(result.getAlignment(), PlanAlignmentChange.START_OF_SUBSCRIPTION);
Assert.assertEquals(result.getNewPriceList(), priceList2);
-
}
-
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestCatalogService.java b/catalog/src/test/java/com/ning/billing/catalog/TestCatalogService.java
index 38c21e2..3fa6949 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestCatalogService.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestCatalogService.java
@@ -24,9 +24,8 @@ import com.ning.billing.config.CatalogConfig;
import com.ning.billing.lifecycle.KillbillService.ServiceException;
import com.ning.billing.util.clock.DefaultClock;
-public class TestCatalogService {
-
- @Test
+public class TestCatalogService extends CatalogTestSuite {
+ @Test(groups = "fast")
public void testCatalogServiceDirectory() throws ServiceException {
final DefaultCatalogService service = new DefaultCatalogService(new CatalogConfig() {
@Override
@@ -40,7 +39,7 @@ public class TestCatalogService {
Assert.assertEquals(service.getFullCatalog().getCatalogName(), "WeaponsHireSmall");
}
- @Test
+ @Test(groups = "fast")
public void testCatalogServiceFile() throws ServiceException {
final DefaultCatalogService service = new DefaultCatalogService(new CatalogConfig() {
@Override
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestInternationalPrice.java b/catalog/src/test/java/com/ning/billing/catalog/TestInternationalPrice.java
index 62fbe6c..f543071 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestInternationalPrice.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestInternationalPrice.java
@@ -13,6 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
+
package com.ning.billing.catalog;
import java.math.BigDecimal;
@@ -28,10 +29,10 @@ import com.ning.billing.catalog.api.CatalogApiException;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.util.config.ValidationErrors;
-public class TestInternationalPrice {
+public class TestInternationalPrice extends CatalogTestSuite {
private static final Logger log = LoggerFactory.getLogger(TestInternationalPrice.class);
- @Test
+ @Test(groups = "fast")
public void testZeroValue() throws URISyntaxException, CatalogApiException {
final StandaloneCatalog c = new MockCatalog();
c.setSupportedCurrencies(new Currency[]{Currency.GBP, Currency.EUR, Currency.USD, Currency.BRL, Currency.MXN});
@@ -59,10 +60,9 @@ public class TestInternationalPrice {
Assert.assertEquals(p1.getPrice(Currency.USD), new BigDecimal(1));
Assert.assertEquals(p1.getPrice(Currency.BRL), new BigDecimal(1));
Assert.assertEquals(p1.getPrice(Currency.MXN), new BigDecimal(1));
-
}
- @Test
+ @Test(groups = "fast")
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});
@@ -71,7 +71,7 @@ public class TestInternationalPrice {
Assert.assertEquals(c.getCurrentPlans()[0].getFinalPhase().getRecurringPrice().getPrice(Currency.GBP), new BigDecimal(0));
}
- @Test
+ @Test(groups = "fast")
public void testNegativeValuePrices() {
final StandaloneCatalog c = new MockCatalog();
c.setSupportedCurrencies(new Currency[]{Currency.GBP, Currency.EUR, Currency.USD, Currency.BRL, Currency.MXN});
@@ -89,6 +89,4 @@ public class TestInternationalPrice {
errors.log(log);
Assert.assertEquals(errors.size(), 3);
}
-
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestPlan.java b/catalog/src/test/java/com/ning/billing/catalog/TestPlan.java
index 2aad0a6..cf2987e 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestPlan.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestPlan.java
@@ -27,12 +27,11 @@ import org.testng.annotations.Test;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.util.config.ValidationErrors;
-public class TestPlan {
+public class TestPlan extends CatalogTestSuite {
private static final Logger log = LoggerFactory.getLogger(TestPlan.class);
- @Test(groups = {"fast"}, enabled = true)
+ @Test(groups = "fast")
public void testDateValidation() {
-
final StandaloneCatalog c = new MockCatalog();
c.setSupportedCurrencies(new Currency[]{Currency.GBP, Currency.EUR, Currency.USD, Currency.BRL, Currency.MXN});
final DefaultPlan p1 = MockPlan.createBicycleTrialEvergreen1USD();
@@ -40,10 +39,9 @@ public class TestPlan {
final ValidationErrors errors = p1.validate(c, new ValidationErrors());
Assert.assertEquals(errors.size(), 1);
errors.log(log);
-
}
- @Test(groups = {"fast"}, enabled = true)
+ @Test(groups = "fast")
public void testDataCalc() {
final DefaultPlan p0 = MockPlan.createBicycleTrialEvergreen1USD();
@@ -55,6 +53,5 @@ public class TestPlan {
Assert.assertEquals(p0.dateOfFirstRecurringNonZeroCharge(requestedDate).compareTo(requestedDate.plusDays(30)), 0);
Assert.assertEquals(p1.dateOfFirstRecurringNonZeroCharge(requestedDate).compareTo(requestedDate.plusDays(100)), 0);
Assert.assertEquals(p2.dateOfFirstRecurringNonZeroCharge(requestedDate).compareTo(requestedDate.plusDays(0)), 0);
-
}
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestPlanPhase.java b/catalog/src/test/java/com/ning/billing/catalog/TestPlanPhase.java
index ee3f11e..600a620 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestPlanPhase.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestPlanPhase.java
@@ -26,10 +26,10 @@ import com.ning.billing.catalog.api.CatalogApiException;
import com.ning.billing.catalog.api.PhaseType;
import com.ning.billing.util.config.ValidationErrors;
-public class TestPlanPhase {
- Logger log = LoggerFactory.getLogger(TestPlanPhase.class);
+public class TestPlanPhase extends CatalogTestSuite {
+ private final Logger log = LoggerFactory.getLogger(TestPlanPhase.class);
- @Test(enabled = true)
+ @Test(groups = "fast")
public void testValidation() {
log.info("Testing Plan Phase Validation");
@@ -42,15 +42,15 @@ public class TestPlanPhase {
pp = MockPlanPhase.createUSDMonthlyEvergreen("1.00", null).setBillCycleDuration(BillingPeriod.NO_BILLING_PERIOD).setPlan(MockPlan.createBicycleNoTrialEvergreen1USD());// new MockPlanPhase().setBillCycleDuration(BillingPeriod.NO_BILLING_PERIOD).setRecurringPrice(new MockInternationalPrice());
errors = pp.validate(new MockCatalog(), new ValidationErrors());
errors.log(log);
- Assert.assertEquals(errors.size(), 1);
+ Assert.assertEquals(errors.size(), 2);
pp = MockPlanPhase.createUSDMonthlyEvergreen(null, null).setBillCycleDuration(BillingPeriod.NO_BILLING_PERIOD).setPlan(MockPlan.createBicycleNoTrialEvergreen1USD());//new MockPlanPhase().setRecurringPrice(null).setFixedPrice(null).setBillCycleDuration(BillingPeriod.NO_BILLING_PERIOD);
errors = pp.validate(new MockCatalog(), new ValidationErrors());
errors.log(log);
- Assert.assertEquals(errors.size(), 1);
+ Assert.assertEquals(errors.size(), 2);
}
- @Test
+ @Test(groups = "fast")
public void testPhaseNames() throws CatalogApiException {
final String planName = "Foo";
final String planNameExt = planName + "-";
@@ -71,12 +71,9 @@ public class TestPlanPhase {
Assert.assertEquals(ppnFixedTerm, planNameExt + "fixedterm");
Assert.assertEquals(ppnDiscount, planNameExt + "discount");
-
Assert.assertEquals(DefaultPlanPhase.planName(ppnDiscount), planName);
Assert.assertEquals(DefaultPlanPhase.planName(ppnTrial), planName);
Assert.assertEquals(DefaultPlanPhase.planName(ppnEvergreen), planName);
Assert.assertEquals(DefaultPlanPhase.planName(ppnFixedTerm), planName);
-
-
}
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestPriceListSet.java b/catalog/src/test/java/com/ning/billing/catalog/TestPriceListSet.java
index 107283d..2f54295 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestPriceListSet.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestPriceListSet.java
@@ -30,8 +30,8 @@ import static com.ning.billing.catalog.api.BillingPeriod.MONTHLY;
import static com.ning.billing.catalog.api.PhaseType.DISCOUNT;
import static com.ning.billing.catalog.api.PhaseType.EVERGREEN;
-public class TestPriceListSet {
- @Test(enabled = true)
+public class TestPriceListSet extends CatalogTestSuite {
+ @Test(groups = "fast")
public void testOverriding() throws CatalogApiException {
final DefaultProduct foo = new DefaultProduct("Foo", ProductCategory.BASE);
final DefaultProduct bar = new DefaultProduct("Bar", ProductCategory.BASE);
@@ -57,6 +57,7 @@ public class TestPriceListSet {
Assert.assertEquals(set.getPlanFrom("child", foo, BillingPeriod.MONTHLY).getFinalPhase().getPhaseType(), PhaseType.EVERGREEN);
}
+ @Test(groups = "fast")
public void testForNullBillingPeriod() throws CatalogApiException {
final DefaultProduct foo = new DefaultProduct("Foo", ProductCategory.BASE);
final DefaultProduct bar = new DefaultProduct("Bar", ProductCategory.BASE);
@@ -82,5 +83,4 @@ public class TestPriceListSet {
Assert.assertEquals(set.getPlanFrom(PriceListSet.DEFAULT_PRICELIST_NAME, foo, BillingPeriod.ANNUAL).getFinalPhase().getPhaseType(), PhaseType.EVERGREEN);
Assert.assertEquals(set.getPlanFrom(PriceListSet.DEFAULT_PRICELIST_NAME, foo, BillingPeriod.MONTHLY).getFinalPhase().getPhaseType(), PhaseType.EVERGREEN);
}
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestStandaloneCatalog.java b/catalog/src/test/java/com/ning/billing/catalog/TestStandaloneCatalog.java
index edca7f1..3f5cca3 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestStandaloneCatalog.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestStandaloneCatalog.java
@@ -22,9 +22,8 @@ import org.testng.annotations.Test;
import com.ning.billing.catalog.api.CatalogApiException;
import com.ning.billing.catalog.api.PhaseType;
-public class TestStandaloneCatalog {
-
- @Test
+public class TestStandaloneCatalog extends CatalogTestSuite {
+ @Test(groups = "fast")
public void testFindPhase() throws CatalogApiException {
final DefaultPlanPhase phaseTrial1 = new MockPlanPhase().setPhaseType(PhaseType.TRIAL);
final DefaultPlanPhase phaseTrial2 = new MockPlanPhase().setPhaseType(PhaseType.TRIAL);
@@ -44,9 +43,5 @@ public class TestStandaloneCatalog {
Assert.assertEquals(cat.findCurrentPhase("TestPlan2-discount"), phaseDiscount2);
Assert.assertEquals(cat.findCurrentPhase("TestPlan1-trial"), phaseTrial1);
Assert.assertEquals(cat.findCurrentPhase("TestPlan2-trial"), phaseTrial2);
-
-
}
-
-
}
diff --git a/catalog/src/test/java/com/ning/billing/catalog/TestVersionedCatalog.java b/catalog/src/test/java/com/ning/billing/catalog/TestVersionedCatalog.java
index a972fd5..2f0f873 100644
--- a/catalog/src/test/java/com/ning/billing/catalog/TestVersionedCatalog.java
+++ b/catalog/src/test/java/com/ning/billing/catalog/TestVersionedCatalog.java
@@ -13,13 +13,13 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
+
package com.ning.billing.catalog;
import javax.xml.bind.JAXBException;
import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.math.BigDecimal;
-import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.Date;
@@ -41,26 +41,23 @@ import com.ning.billing.catalog.io.VersionedCatalogLoader;
import com.ning.billing.lifecycle.KillbillService.ServiceException;
import com.ning.billing.util.clock.DefaultClock;
-import static org.testng.AssertJUnit.assertEquals;
-
-public class TestVersionedCatalog {
+public class TestVersionedCatalog extends CatalogTestSuite {
private static final Logger log = LoggerFactory.getLogger(TestVersionedCatalog.class);
private final VersionedCatalogLoader loader = new VersionedCatalogLoader(new DefaultClock());
private VersionedCatalog vc;
- @BeforeClass(groups = {"fast"})
+ @BeforeClass(groups = "fast")
public void setUp() throws ServiceException {
vc = loader.load(Resources.getResource("versionedCatalog").toString());
}
- @Test(groups = {"fast"}, enabled = true)
- public void testAddCatalog() throws MalformedURLException, IOException, SAXException, InvalidConfigException, JAXBException, TransformerException, URISyntaxException, ServiceException, CatalogApiException {
+ @Test(groups = "fast")
+ public void testAddCatalog() throws IOException, SAXException, InvalidConfigException, JAXBException, TransformerException, URISyntaxException, ServiceException, CatalogApiException {
vc.add(new StandaloneCatalog(new Date()));
- assertEquals(4, vc.size());
+ Assert.assertEquals(vc.size(), 4);
}
-
- @Test(groups = {"fast"}, enabled = true)
+ @Test(groups = "fast")
public void testFindPlanWithDates() throws Exception {
final DateTime dt0 = new DateTime("2010-01-01T00:00:00+00:00");
final DateTime dt1 = new DateTime("2011-01-01T00:01:00+00:00");
@@ -99,7 +96,7 @@ public class TestVersionedCatalog {
}
- @Test(groups = {"fast"}, enabled = true)
+ @Test(groups = "fast")
public void testErrorOnDateTooEarly() {
final DateTime dt0 = new DateTime("1977-01-01T00:00:00+00:00");
try {