killbill-uncached
Changes
catalog/src/test/resources/SpyCarBasic.xml 159(+159 -0)
Details
diff --git a/catalog/src/main/java/com/ning/billing/catalog/CreateCatalogSchema.java b/catalog/src/main/java/com/ning/billing/catalog/CreateCatalogSchema.java
new file mode 100644
index 0000000..1ccaf64
--- /dev/null
+++ b/catalog/src/main/java/com/ning/billing/catalog/CreateCatalogSchema.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2010-2011 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 java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+
+import com.ning.billing.util.config.catalog.XMLSchemaGenerator;
+
+public class CreateCatalogSchema {
+
+ /**
+ * @param args
+ */
+ public static void main(final String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Usage: <filepath>");
+ System.exit(0);
+ }
+
+ final File f = new File(args[0]);
+ final Writer w = new FileWriter(f);
+ w.write(XMLSchemaGenerator.xmlSchemaAsString(StandaloneCatalog.class));
+ w.close();
+
+ }
+
+}
diff --git a/catalog/src/main/java/com/ning/billing/catalog/LoadCatalog.java b/catalog/src/main/java/com/ning/billing/catalog/LoadCatalog.java
new file mode 100644
index 0000000..6cabe57
--- /dev/null
+++ b/catalog/src/main/java/com/ning/billing/catalog/LoadCatalog.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2010-2011 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 java.io.File;
+
+import com.ning.billing.util.config.catalog.XMLLoader;
+
+public class LoadCatalog {
+ public static void main(final String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Usage: <catalog filepath>");
+ System.exit(0);
+ }
+ File file = new File(args[0]);
+ if(!file.exists()) {
+ System.err.println("Error: '" + args[0] + "' does not exist");
+ }
+ StandaloneCatalog catalog = XMLLoader.getObjectFromUri(file.toURI(), StandaloneCatalog.class);
+ if (catalog != null) {
+ System.out.println("Success: Catalog loads!");
+ }
+ }
+
+}
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 dd50f9d..a9d1b03 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2013 Ning, Inc.
+ * Copyright 2010-2011 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
@@ -19,19 +19,18 @@ 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.CatalogTestSuiteNoDB;
import com.ning.billing.catalog.StandaloneCatalog;
import com.ning.billing.util.config.catalog.XMLLoader;
-import com.google.common.io.Resources;
-
public class TestXMLReader extends CatalogTestSuiteNoDB {
-
@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);
+ XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class);
} catch (Exception e) {
Assert.fail(e.toString());
}
catalog/src/test/resources/SpyCarBasic.xml 159(+159 -0)
diff --git a/catalog/src/test/resources/SpyCarBasic.xml b/catalog/src/test/resources/SpyCarBasic.xml
new file mode 100644
index 0000000..9ea43ad
--- /dev/null
+++ b/catalog/src/test/resources/SpyCarBasic.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="CatalogSchema.xsd ">
+
+ <effectiveDate>2013-02-08T00:00:00+00:00</effectiveDate>
+ <catalogName>SpyCarBasic</catalogName>
+
+ <currencies>
+ <currency>USD</currency>
+ <currency>GBP</currency>
+ </currencies>
+
+ <products>
+ <product name="Standard">
+ <category>BASE</category>
+ </product>
+ <product name="Sports">
+ <category>BASE</category>
+ </product>
+ <product name="Super">
+ <category>BASE</category>
+ </product>
+ </products>
+
+ <rules>
+ <changePolicy>
+ <changePolicyCase>
+ <policy>IMMEDIATE</policy>
+ </changePolicyCase>
+ </changePolicy>
+ <changeAlignment>
+ <changeAlignmentCase>
+ <alignment>START_OF_BUNDLE</alignment>
+ </changeAlignmentCase>
+ </changeAlignment>
+ <cancelPolicy>
+ <cancelPolicyCase>
+ <policy>IMMEDIATE</policy>
+ </cancelPolicyCase>
+ </cancelPolicy>
+ <createAlignment>
+ <createAlignmentCase>
+ <alignment>START_OF_BUNDLE</alignment>
+ </createAlignmentCase>
+ </createAlignment>
+ <billingAlignment>
+ <billingAlignmentCase>
+ <alignment>ACCOUNT</alignment>
+ </billingAlignmentCase>
+ </billingAlignment>
+ <priceList>
+ <priceListCase>
+ <toPriceList>DEFAULT</toPriceList>
+ </priceListCase>
+ </priceList>
+ </rules>
+
+ <plans>
+ <plan name="standard-monthly">
+ <product>Standard</product>
+ <initialPhases>
+ <phase type="TRIAL">
+ <duration>
+ <unit>DAYS</unit>
+ <number>30</number>
+ </duration>
+ <billingPeriod>NO_BILLING_PERIOD</billingPeriod>
+ <fixedPrice> <!-- empty price implies $0 -->
+ </fixedPrice>
+ </phase>
+ </initialPhases>
+ <finalPhase type="EVERGREEN">
+ <duration>
+ <unit>UNLIMITED</unit>
+ </duration>
+ <billingPeriod>MONTHLY</billingPeriod>
+ <recurringPrice>
+ <price>
+ <currency>GBP</currency>
+ <value>75.00</value>
+ </price>
+ <price>
+ <currency>USD</currency>
+ <value>100.00</value>
+ </price>
+ </recurringPrice>
+ </finalPhase>
+ </plan>
+ <plan name="sports-monthly">
+ <product>Sports</product>
+ <initialPhases>
+ <phase type="TRIAL">
+ <duration>
+ <unit>DAYS</unit>
+ <number>30</number>
+ </duration>
+ <billingPeriod>NO_BILLING_PERIOD</billingPeriod>
+ <fixedPrice> <!-- empty price implies $0 -->
+ </fixedPrice>
+ </phase>
+ </initialPhases>
+ <finalPhase type="EVERGREEN">
+ <duration>
+ <unit>UNLIMITED</unit>
+ </duration>
+ <billingPeriod>MONTHLY</billingPeriod>
+ <recurringPrice>
+ <price>
+ <currency>GBP</currency>
+ <value>375.00</value>
+ </price>
+ <price>
+ <currency>USD</currency>
+ <value>500.00</value>
+ </price>
+ </recurringPrice>
+ </finalPhase>
+ </plan>
+ <plan name="super-monthly">
+ <product>Super</product>
+ <initialPhases>
+ <phase type="TRIAL">
+ <duration>
+ <unit>DAYS</unit>
+ <number>30</number>
+ </duration>
+ <billingPeriod>NO_BILLING_PERIOD</billingPeriod>
+ <fixedPrice> <!-- empty price implies $0 -->
+ </fixedPrice>
+ </phase>
+ </initialPhases>
+ <finalPhase type="EVERGREEN">
+ <duration>
+ <unit>UNLIMITED</unit>
+ </duration>
+ <billingPeriod>MONTHLY</billingPeriod>
+ <recurringPrice>
+ <price>
+ <currency>GBP</currency>
+ <value>750.00</value>
+ </price>
+ <price>
+ <currency>USD</currency>
+ <value>1000.00</value>
+ </price>
+ </recurringPrice>
+ </finalPhase>
+ </plan>
+ </plans>
+ <priceLists>
+ <defaultPriceList name="DEFAULT">
+ <plans>
+ <plan>standard-monthly</plan>
+ <plan>sports-monthly</plan>
+ <plan>super-monthly</plan>
+ </plans>
+ </defaultPriceList>
+ </priceLists>
+</catalog>