Search in sources :

Example 11 with VersionedCatalog

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

the class TestVersionedCatalogLoader method testLoadCatalogFromExternalFile.

@Test(groups = "fast")
public void testLoadCatalogFromExternalFile() throws CatalogApiException, IOException, URISyntaxException {
    final File originFile = new File(Resources.getResource("SpyCarBasic.xml").toURI());
    final File destinationFile = new File(Files.createTempDir().toString() + "/SpyCarBasicRelocated.xml");
    destinationFile.deleteOnExit();
    Files.copy(originFile, destinationFile);
    final VersionedCatalog c = loader.loadDefaultCatalog(destinationFile.toURI().toString());
    Assert.assertEquals(c.getCatalogName(), "SpyCarBasic");
}
Also used : VersionedCatalog(org.killbill.billing.catalog.VersionedCatalog) File(java.io.File) Test(org.testng.annotations.Test)

Example 12 with VersionedCatalog

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

the class TestVersionedCatalogLoader method testLoadCatalogFromClasspathResourceFolder.

@Test(groups = "fast")
public void testLoadCatalogFromClasspathResourceFolder() throws CatalogApiException {
    final VersionedCatalog c = loader.loadDefaultCatalog("SpyCarBasic.xml");
    Assert.assertEquals(c.size(), 1);
    final DateTime dt = new DateTime("2013-02-08T00:00:00+00:00");
    Assert.assertEquals(c.getEffectiveDate(), dt.toDate());
    Assert.assertEquals(c.getCatalogName(), "SpyCarBasic");
}
Also used : VersionedCatalog(org.killbill.billing.catalog.VersionedCatalog) DateTime(org.joda.time.DateTime) Test(org.testng.annotations.Test)

Aggregations

VersionedCatalog (org.killbill.billing.catalog.VersionedCatalog)12 StandaloneCatalog (org.killbill.billing.catalog.StandaloneCatalog)8 Test (org.testng.annotations.Test)7 StandaloneCatalogWithPriceOverride (org.killbill.billing.catalog.StandaloneCatalogWithPriceOverride)5 URI (java.net.URI)4 DateTime (org.joda.time.DateTime)4 CatalogApiException (org.killbill.billing.catalog.api.CatalogApiException)4 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 URISyntaxException (java.net.URISyntaxException)3 JAXBException (javax.xml.bind.JAXBException)3 TransformerException (javax.xml.transform.TransformerException)3 InvalidConfigException (org.killbill.billing.catalog.api.InvalidConfigException)3 ValidationException (org.killbill.xmlloader.ValidationException)3 SAXException (org.xml.sax.SAXException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InternalTenantContext (org.killbill.billing.callcontext.InternalTenantContext)2 DefaultProduct (org.killbill.billing.catalog.DefaultProduct)2 Product (org.killbill.billing.catalog.api.Product)2 PriceOverride (org.killbill.billing.catalog.override.PriceOverride)2