killbill-uncached

Fix broken tests after changes in jaxrs path for invoices per

9/17/2013 10:01:20 PM

Details

diff --git a/beatrix/src/main/java/com/ning/billing/beatrix/lifecycle/DefaultLifecycle.java b/beatrix/src/main/java/com/ning/billing/beatrix/lifecycle/DefaultLifecycle.java
index 04e324b..ad86ba9 100644
--- a/beatrix/src/main/java/com/ning/billing/beatrix/lifecycle/DefaultLifecycle.java
+++ b/beatrix/src/main/java/com/ning/billing/beatrix/lifecycle/DefaultLifecycle.java
@@ -100,7 +100,9 @@ public class DefaultLifecycle implements Lifecycle {
                 log.debug("got instance {}", instance.getName());
                 result.add(instance);
             } catch (final Exception e) {
-                logWarn("Failed to inject " + cur.getName(), e);
+                if (!cur.getSimpleName().startsWith("Test")) {
+                    logWarn("Failed to inject " + cur.getName(), e);
+                }
             }
 
         }
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java b/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java
index 694140b..6f2ee55 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java
@@ -61,11 +61,11 @@ public class TestLifecycle extends BeatrixTestSuite {
         }
     }
 
-    public interface Service1Interface extends KillbillService {
+    public interface TestService1Interface extends KillbillService {
 
     }
 
-    public static class Service1 extends ServiceBase implements Service1Interface {
+    public static class Service1 extends ServiceBase implements TestService1Interface {
         @LifecycleHandlerType(LifecycleLevel.INIT_BUS)
         public void initBus() {
             log.info("Service1 : got INIT_BUS");
@@ -90,11 +90,11 @@ public class TestLifecycle extends BeatrixTestSuite {
         }
     }
 
-    public interface Service2Interface extends KillbillService {
+    public interface TestService2Interface extends KillbillService {
 
     }
 
-    public static class Service2 extends ServiceBase implements Service2Interface {
+    public static class Service2 extends ServiceBase implements TestService2Interface {
         @LifecycleHandlerType(LifecycleLevel.LOAD_CATALOG)
         public void loadCatalog() {
             log.info("Service2 : got LOAD_CATALOG");
@@ -171,10 +171,10 @@ public class TestLifecycle extends BeatrixTestSuite {
         @Override
         protected void configure() {
             bind(DefaultLifecycle.class).to(LifecycleNoWarn.class).asEagerSingleton();
-            bind(Service1Interface.class).to(Service1.class);
+            bind(TestService1Interface.class).to(Service1.class);
             bind(Service1.class).asEagerSingleton();
             bind(Service2.class).asEagerSingleton();
-            bind(Service2Interface.class).to(Service2.class);
+            bind(TestService2Interface.class).to(Service2.class);
         }
     }
 }
diff --git a/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestInvoiceItemJsonSimple.java b/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestInvoiceItemJsonSimple.java
index 16e5b03..5623af1 100644
--- a/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestInvoiceItemJsonSimple.java
+++ b/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestInvoiceItemJsonSimple.java
@@ -27,6 +27,7 @@ import org.testng.annotations.Test;
 
 import com.ning.billing.catalog.api.Currency;
 import com.ning.billing.invoice.api.InvoiceItem;
+import com.ning.billing.invoice.api.InvoiceItemType;
 import com.ning.billing.jaxrs.JaxrsTestSuiteNoDB;
 
 import static com.ning.billing.jaxrs.JaxrsTestUtils.createAuditLogsJson;
@@ -90,6 +91,7 @@ public class TestInvoiceItemJsonSimple extends JaxrsTestSuiteNoDB {
         Mockito.when(invoiceItem.getEndDate()).thenReturn(clock.getUTCToday());
         Mockito.when(invoiceItem.getAmount()).thenReturn(BigDecimal.TEN);
         Mockito.when(invoiceItem.getCurrency()).thenReturn(Currency.EUR);
+        Mockito.when(invoiceItem.getInvoiceItemType()).thenReturn(InvoiceItemType.FIXED);
 
         final InvoiceItemJson invoiceItemJson = new InvoiceItemJson(invoiceItem);
         Assert.assertEquals(invoiceItemJson.getInvoiceItemId(), invoiceItem.getId().toString());
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestChargeback.java b/server/src/test/java/com/ning/billing/jaxrs/TestChargeback.java
index 78d7564..c0502e1 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestChargeback.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestChargeback.java
@@ -206,7 +206,8 @@ public class TestChargeback extends TestJaxrsBase {
         crappyWaitForLackOfProperSynchonization();
 
         // Retrieve the invoice
-        final Response response = doGet(JaxrsResource.INVOICES_PATH, ImmutableMap.<String, String>of(JaxrsResource.QUERY_ACCOUNT_ID, accountJson.getAccountId()), DEFAULT_HTTP_TIMEOUT_SEC);
+
+        final Response response = doGet(JaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAccountId() + "/" + JaxrsResource.INVOICES, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
         Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
         final String baseJson = response.getResponseBody();
         final List<InvoiceJson> objFromJson = mapper.readValue(baseJson, new TypeReference<List<InvoiceJson>>() {});
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestInvoiceNotification.java b/server/src/test/java/com/ning/billing/jaxrs/TestInvoiceNotification.java
index feee290..7c587d9 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestInvoiceNotification.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestInvoiceNotification.java
@@ -41,7 +41,7 @@ public class TestInvoiceNotification extends TestJaxrsBase {
         final AccountJson accountJson = createScenarioWithOneInvoice();
 
         final String uri = JaxrsResource.INVOICES_PATH;
-        final Response response = doGet(uri, ImmutableMap.<String, String>of(JaxrsResource.QUERY_ACCOUNT_ID, accountJson.getAccountId()), DEFAULT_HTTP_TIMEOUT_SEC);
+        final Response response = doGet(JaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAccountId() + "/" + JaxrsResource.INVOICES, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
         Assert.assertEquals(response.getStatusCode(), javax.ws.rs.core.Response.Status.OK.getStatusCode());
         final String baseJson = response.getResponseBody();
         final List<InvoiceJson> objFromJson = mapper.readValue(baseJson, new TypeReference<List<InvoiceJson>>() {});