You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2013/07/02 11:37:52 UTC
[10/23] Refactoring org.wso2.carbon to org.apache.stratos
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/java/org/wso2/carbon/billing/test/TriggerTest.java
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/java/org/wso2/carbon/billing/test/TriggerTest.java b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/java/org/wso2/carbon/billing/test/TriggerTest.java
deleted file mode 100644
index 9b4f609..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/java/org/wso2/carbon/billing/test/TriggerTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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 org.wso2.carbon.billing.test;
-
-import junit.framework.TestCase;
-import org.wso2.carbon.billing.core.BillingEngine;
-import org.wso2.carbon.billing.core.BillingException;
-import org.wso2.carbon.billing.core.BillingManager;
-import org.wso2.carbon.billing.core.conf.BillingConfiguration;
-import org.wso2.carbon.billing.core.dataobjects.*;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import javax.sql.DataSource;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-public class TriggerTest extends TestCase {
- private static final String BILLING_CONFIG = "billing-config.xml";
- private static final String SELLER_ID = "carbonHome2TestShop";
- private BillingEngine billingEngine;
-
- public void setUp() throws Exception {
- /*RuleServerManager ruleServerManager = new RuleServerManager();
- RuleServerConfiguration configuration = new RuleServerConfiguration(new JSR94BackendRuntimeFactory());
- ruleServerManager.init(configuration);
- Util.setRuleEngineConfigService(ruleServerManager);
-
- String carbonHome = "src/test/resources/carbonhome2";
- System.setProperty("carbon.home", carbonHome);
- System.setProperty("carbon.config.dir.path", carbonHome + "/repository/conf");
-
- SessionDescription sessionDescription = new SessionDescription();
- sessionDescription.setSessionType(SessionDescription.STATEFUL_SESSION);
- ruleServerManager = new RuleServerManager();// TODO to get from a OSGI service
- configuration = new RuleServerConfiguration(new JSR94BackendRuntimeFactory());
- ruleServerManager.init(configuration);
-
- Util.setRuleEngineConfigService(ruleServerManager);
- */
-
- String configFile = CarbonUtils.getCarbonConfigDirPath() + "/" + BILLING_CONFIG;
- BillingConfiguration billingConfiguration = new BillingConfiguration(configFile);
-
- DataSource dataSource = billingConfiguration.getDataSource();
- assertNotNull("data should be not null", dataSource);
- try {
- if (BillingManager.getInstance() != null) {
- BillingManager.destroyInstance();
- }
- } catch (Exception e) {
-
- }
- BillingManager billingManager = new BillingManager(billingConfiguration);
- //billingManager.scheduleBilling();
- billingEngine = billingManager.getBillingEngine(SELLER_ID);
- }
-
- public void testEngine() throws BillingException {
- TestUtils.deleteAllTables();
- // first enter some items
- String[] itemNames = {"item-1", "item-2", "item-3", "item-4", "item-5", "item-6", "item-7", "item-8"};
- Cash[] itemCosts = {new Cash("$1.2"), new Cash("$2.12"), new Cash("$3.24"), new Cash("$4.34"),
- new Cash("$5.82"), new Cash("$6.92"), new Cash("$7.11"), new Cash("$8.01")};
- List<Item> items = new ArrayList<Item>();
- boolean succeeded = false;
- try {
- billingEngine.beginTransaction();
- for (int i = 0; i < Math.min(itemNames.length, itemCosts.length); i++) {
- String itemName = itemNames[i];
- Cash itemCost = itemCosts[i];
- Item item = new Item();
- item.setName(itemName);
- item.setCost(itemCost);
- List<Item> existingItems = billingEngine.getItemsWithName(itemName);
- for (Item existingItem : existingItems) {
- //billingEngine.deleteItem(existingItem.getId());
- }
- billingEngine.addItem(item);
- items.add(item);
- }
- succeeded = true;
- } finally {
- if (succeeded) {
- billingEngine.commitTransaction();
- } else {
- billingEngine.rollbackTransaction();
- }
- }
-
- String[] customerNames = {"customer-1", "customer-2", "customer-3", "customer-4", "customer-5", "customer-6"};
- List<Customer> customers = new ArrayList<Customer>();
- succeeded = false;
- try {
- billingEngine.beginTransaction();
- for (String customerName : customerNames) {
- Customer customer = new Customer();
- customer.setName(customerName);
-
- List<Customer> existingCustomers = billingEngine.getCustomersWithName(customerName);
- for (Customer existingCustomer : existingCustomers) {
- //billingEngine.deleteCustomer(existingCustomer.getId());
- }
-
- //billingEngine.addCustomer(customer);
- customers.add(customer);
- }
- succeeded = true;
- } finally {
- if (succeeded) {
- billingEngine.commitTransaction();
- } else {
- billingEngine.rollbackTransaction();
- }
- }
-
- // adding the subscriptions
- List<Subscription> subscriptions = new ArrayList<Subscription>();
- succeeded = false;
- try {
- billingEngine.beginTransaction();
- // first we clean the subscription table
-
- int[] subIdToItemId = {0, 3, 2, 1, 4, 7, 6, 5, 2, 3, 1, 1, 4, 6, 5, 0};
- int[] subIdToCustomerId = {0, 3, 2, 1, 4, 1, 0, 5, 2, 3, 1, 1, 4, 0, 5, 0};
- String[] payment1 = {"$0.5", "$3.2", "$2", "$1.8", "$4", "1", "0.8",
- "$5", "$2", "$3.2", "$1", "$1.2", "$4", "0.2", "$5", "$0.2"};
- String[] payment2 = {"$5", "$2", "$3.2", "$1", "$1.2", "$4", "0.2",
- "$5", "$0.2", "$0.5", "$3.2", "$2", "$1.8", "$4", "1", "0.8"};
-
- // then get some customers subscribed to items
- Calendar calendarToStart = Calendar.getInstance();
- calendarToStart.set(Calendar.YEAR, 2010);
- calendarToStart.set(Calendar.MONTH, Calendar.JANUARY);
- calendarToStart.set(Calendar.DAY_OF_MONTH, 20);
- calendarToStart.set(Calendar.HOUR_OF_DAY, 12);
- calendarToStart.set(Calendar.MINUTE, 10);
- calendarToStart.set(Calendar.SECOND, 20);
- long timestampToStart = calendarToStart.getTimeInMillis();
- for (int i = 0; i < 15; i++) {
- long startTime = (10000 * i) % 60000 + timestampToStart;
- long duration = (5000 * i) % 40000;
- long endTime = startTime + duration;
- Customer customer = customers.get(subIdToCustomerId[i]);
- Item item = items.get(subIdToItemId[i]);
- Subscription subscription = new Subscription();
- subscription.setCustomer(customer);
- subscription.setItem(item);
- subscription.setActive(true);
-
- subscription.setActiveSince(new Date(startTime));
- subscription.setActiveUntil(new Date(endTime));
-
- billingEngine.addSubscription(subscription);
- subscriptions.add(subscription);
-
- // adding purchase order - purchase order1
- Payment purchaseOrder1 = new Payment();
- purchaseOrder1.addSubscription(subscription);
- purchaseOrder1.setAmount(new Cash(payment1[i]));
- billingEngine.addPayment(purchaseOrder1);
-
- // adding purchase order - purchase order1
- Payment purchaseOrder2 = new Payment();
- purchaseOrder2.addSubscription(subscription);
- purchaseOrder2.setAmount(new Cash(payment2[i]));
- billingEngine.addPayment(purchaseOrder2);
- }
-
- succeeded = true;
-
- } finally {
- if (succeeded) {
- billingEngine.commitTransaction();
- } else {
- billingEngine.rollbackTransaction();
- }
- }
-
- //billingEngine.generateBill();
- // instead of calling the billing engine we are triggering the scheduler
- billingEngine.scheduleBilling();
-
- // now get the invoice of each customers
- Cash[] totalCosts = {new Cash("$0.20"), new Cash("$2.12"), new Cash("$3.24"),
- new Cash("$4.34"), new Cash("$5.82"), new Cash("$6.92")};
- Cash[] totalPayments = {new Cash("$5.50"), new Cash("$2.80"), new Cash("$5.20"),
- new Cash("$5.20"), new Cash("$5.20"), new Cash("$10.00")};
- Cash[] carriedForward = {new Cash("$-4.30"), new Cash("$-0.68"), new Cash("$-1.96"),
- new Cash("$-0.86"), new Cash("$0.62"), new Cash("$-3.08")};
-
- assertEquals(6, customers.size());
- try {
- Thread.currentThread().sleep(14000);
- } catch (InterruptedException e) {
- assertTrue(false);
- }
- assertEquals(2, FiveSecondTriggerTester.getCount());
-
- for (int i = 0; i < customers.size(); i++) {
-
- Customer customer = customers.get(i);
- List<Invoice> invoices = billingEngine.getAllInvoices(customer);
- assertEquals(1, invoices.size());
- Invoice invoice = invoices.get(0);
- //Invoice invoice = billingEngine.getLastInvoice(customer);
- assertEquals(totalCosts[i], invoice.getTotalCost());
- assertEquals(totalPayments[i], invoice.getTotalPayment());
- assertEquals(carriedForward[i], invoice.getCarriedForward());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-config.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-config.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-config.xml
deleted file mode 100644
index af722bd..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-config.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<billingConfig xmlns="http://wso2.com/carbon/multitenancy/billing/config">
- <dbConfig>
- <url>jdbc:mysql://localhost:3306/billing_test1</url>
- <userName>billing</userName>
- <password>billing</password>
- <driverName>com.mysql.jdbc.Driver</driverName>
- <maxActive>80</maxActive>
- <maxWait>60000</maxWait>
- <minIdle>5</minIdle>
- </dbConfig>
- <tasks>
- <task id="carbonHome1TestShop">
- <subscriptionFilter>multitenancy</subscriptionFilter>
- <schedule
- scheduleHelperClass="org.wso2.carbon.billing.core.scheduler.scheduleHelpers.OneTimeScheduleHelper">
- <parameter name="dayToTriggerOn">1</parameter>
- <parameter name="hourToTriggerOn">0</parameter>
- <parameter name="timeZone">GMT-8:00</parameter>
- </schedule>
- <handlers>
- <handler
- class="org.wso2.carbon.billing.core.handlers.DefaultSubscriptionFeedingHandler">
- </handler>
- <handler
- class="org.wso2.carbon.billing.core.handlers.SubscriptionTreeBuildingHandler">
- </handler>
- <!--<handler class="org.wso2.carbon.billing.core.handlers.RuleHandler">
- <parameter name="file">multitenancy-billing-rule.xml</parameter>
- </handler> -->
- <handler class="org.wso2.carbon.billing.core.handlers.InvoiceCalculationHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.DefaultFinalizingHandler">
- </handler>
- </handlers>
- <!--
- <billDelivery>
- <email config="multitenancy-bill-email-config.xml"/>
- </billDelivery>
- -->
- </task>
-
- <task id="ruleTestShop">
- <subscriptionFilter>multitenancy</subscriptionFilter>
- <handlers>
- <handler
- class="org.wso2.carbon.billing.core.handlers.DefaultSubscriptionFeedingHandler">
- </handler>
- <handler
- class="org.wso2.carbon.billing.core.handlers.SubscriptionTreeBuildingHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.InvoiceCalculationHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.RuleHandler">
- <parameter name="file">billing-rules1.drl</parameter>
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.DefaultFinalizingHandler">
- </handler>
- </handlers>
- <!--
- <billDelivery>
- <email config="multitenancy-bill-email-config.xml"/>
- </billDelivery>
- -->
- </task>
- </tasks>
-</billingConfig>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-rules1.drl
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-rules1.drl b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-rules1.drl
deleted file mode 100644
index 1905308..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/billing-rules1.drl
+++ /dev/null
@@ -1,15 +0,0 @@
-import org.wso2.carbon.billing.core.dataobjects.Customer;
-import org.wso2.carbon.billing.core.dataobjects.Invoice;
-import org.wso2.carbon.billing.core.dataobjects.Cash;
-
-rule customerOneSpecial
-when
-$customer : Customer(name == "customer-1" )
-
-then
-
-Invoice invoice = $customer.getActiveInvoice();
-Cash total = invoice.getTotalCost();
-invoice.setTotalCost(Cash.subtract(total, new Cash("$1")));
-
-end
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration-complete.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration-complete.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration-complete.xml
deleted file mode 100644
index c2fcd09..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration-complete.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration>
- <subject>WSO2 Governance as a Service - Registration completed</subject>
- <body>
- Hi {admin-name},
- Congratulations!. You have successfully crated an account in WSO2 Governance as a Service.
- Now you can access your account by visiting the following URL. Please bookmark this URL for
- the later visits.
-
- Your account url: https://governance.stratoslive.wso2.com/t/{domain-name}
-
- Thanks,
- WSO2 Governance as a Service Team
- </body>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration.xml
deleted file mode 100644
index 3a3f22d..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-registration.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration>
- <targetEpr>https://localhost:9443/carbon/email-verification/validator_ajaxprocessor.jsp
- </targetEpr>
- <subject>WSO2 Governance as a Service - Registration confirmation</subject>
- <body>
- Hi,
- Thank you for registering for an account in WSO2 Governance as a Service. In order to
- activate your account, Please click the following link and verfiy your email.
- </body>
- <footer>
- Thanks,
- WSO2 Governance Team
- http://governance.stratoslive.wso2.com
- </footer>
- <redirectPath>../tenant-register/tenant_add_ajaxprocessor.jsp</redirectPath>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-update.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-update.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-update.xml
deleted file mode 100644
index 3f3b8ea..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/email-update.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration>
- <targetEpr>https://localhost:9443/carbon/email-verification/validator_ajaxprocessor.jsp
- </targetEpr>
- <subject>WSO2 Governance as a Service - Updating the contact email address</subject>
- <body>
- Hi,
- We got a request to change the contact email address of WSO2 Governance as a Service
- account. In order to update the contact details, Please click the following link and verfiy
- your email address.
- </body>
- <footer>
- Thanks,
- WSO2 Governance Team
- http://governance.stratoslive.wso2.com
- </footer>
- <redirectPath>../account-mgt/update_verifier.jsp</redirectPath>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-billing-rule.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-billing-rule.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-billing-rule.xml
deleted file mode 100644
index 3bde368..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-billing-rule.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration xmlns="http://www.wso2.org/products/rule/drools">
- <executionSet uri="simpleItemRuleXML">
- <source key="file:{conf-dir}/billing-rules1.drl"/>
-
- <!-- <source>
-
- <x><![CDATA[
- rule InvokeABC
- // rules inbuilt to the rule conf
- end
-
- ]]>
- </x>
- </source> -->
- <creation>
- <property name="source" value="drl"/>
-
- </creation>
- </executionSet>
- <session type="stateless"/>
- <input name="facts" type="billing" key="dataContext"></input>
-
- <output name="results" type="billing" key="dataContext"></output>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-packages.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-packages.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-packages.xml
deleted file mode 100644
index 7dc9d8b..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/multitenancy-packages.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<packages xmlns="http://wso2.com/carbon/multitenancy/billing/pacakges">
- <package name="Demo">
- <users>
- <limit>5</limit>
- <charge>0</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>10</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>1000</limit>
- <!-- mb per user -->
- <overuseCharge>0</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- </package>
- <package name="SMB">
- <users>
- <limit>10</limit>
- <charge>10</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>25</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>2000</limit>
- <!-- mb per user -->
- <overuseCharge>.1</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- <userLimit>10</userLimit>
- </package>
- <package name="Professional">
- <users>
- <limit>50</limit>
- <charge>50</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>100</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>2000</limit>
- <!-- mb per user -->
- <overuseCharge>.1</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- </package>
- <package name="Enterprise">
- <users>
- <limit>unlimited</limit>
- <charge>5000</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>100</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>4000</limit>
- <!-- mb per user -->
- <overuseCharge>.1</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- </package>
-</packages>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/notification.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/notification.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/notification.xml
deleted file mode 100644
index 25e09e8..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome1/repository/conf/notification.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<!-- configure the notifications -->
-<Notifications>
- <enabled>true</enabled>
- <host>http://localhost/feed.xml?product={product}&build={build}&instance={instance.id}&tenant={tenant}</host>
-</Notifications>
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-config.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-config.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-config.xml
deleted file mode 100644
index abd2f55..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-config.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<billingConfig xmlns="http://wso2.com/carbon/multitenancy/billing/config">
- <dbConfig>
- <url>jdbc:mysql://localhost:3306/billing_test1</url>
- <userName>billing</userName>
- <password>billing</password>
- <driverName>com.mysql.jdbc.Driver</driverName>
- <maxActive>80</maxActive>
- <maxWait>60000</maxWait>
- <minIdle>5</minIdle>
- </dbConfig>
- <tasks>
- <task id="carbonHome2TestShop">
- <subscriptionFilter>multitenancy</subscriptionFilter>
- <schedule
- scheduleHelperClass="org.wso2.carbon.billing.test.FiveSecondTriggerCalculator">
- <parameter name="countUpToLimit">2</parameter>
- </schedule>
- <handlers>
- <handler
- class="org.wso2.carbon.billing.core.handlers.DefaultSubscriptionFeedingHandler">
- </handler>
- <handler
- class="org.wso2.carbon.billing.core.handlers.SubscriptionTreeBuildingHandler">
- </handler>
- <!--<handler class="org.wso2.carbon.billing.core.handlers.RuleHandler">
- <parameter name="file">multitenancy-billing-rule.xml</parameter>
- </handler> -->
- <handler class="org.wso2.carbon.billing.core.handlers.InvoiceCalculationHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.RuleHandler">
- <parameter name="file">billing-rules1.drl</parameter>
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.DefaultFinalizingHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.test.FiveSecondTriggerTester">
- </handler>
- </handlers>
- <!--
- <billDelivery>
- <email config="multitenancy-bill-email-config.xml"/>
- </billDelivery>
- -->
- </task>
-
- <task id="ruleTestShop">
- <subscriptionFilter>multitenancy</subscriptionFilter>
- <handlers>
- <handler
- class="org.wso2.carbon.billing.core.handlers.DefaultSubscriptionFeedingHandler">
- </handler>
- <handler
- class="org.wso2.carbon.billing.core.handlers.SubscriptionTreeBuildingHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.InvoiceCalculationHandler">
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.RuleHandler">
- <parameter name="file">billing-rules1.drl</parameter>
- </handler>
- <handler class="org.wso2.carbon.billing.core.handlers.DefaultFinalizingHandler">
- </handler>
- </handlers>
- <!--
- <billDelivery>
- <email config="multitenancy-bill-email-config.xml"/>
- </billDelivery>
- -->
- </task>
- </tasks>
-</billingConfig>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-rules1.drl
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-rules1.drl b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-rules1.drl
deleted file mode 100644
index 1905308..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/billing-rules1.drl
+++ /dev/null
@@ -1,15 +0,0 @@
-import org.wso2.carbon.billing.core.dataobjects.Customer;
-import org.wso2.carbon.billing.core.dataobjects.Invoice;
-import org.wso2.carbon.billing.core.dataobjects.Cash;
-
-rule customerOneSpecial
-when
-$customer : Customer(name == "customer-1" )
-
-then
-
-Invoice invoice = $customer.getActiveInvoice();
-Cash total = invoice.getTotalCost();
-invoice.setTotalCost(Cash.subtract(total, new Cash("$1")));
-
-end
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration-complete.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration-complete.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration-complete.xml
deleted file mode 100644
index c2fcd09..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration-complete.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration>
- <subject>WSO2 Governance as a Service - Registration completed</subject>
- <body>
- Hi {admin-name},
- Congratulations!. You have successfully crated an account in WSO2 Governance as a Service.
- Now you can access your account by visiting the following URL. Please bookmark this URL for
- the later visits.
-
- Your account url: https://governance.stratoslive.wso2.com/t/{domain-name}
-
- Thanks,
- WSO2 Governance as a Service Team
- </body>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration.xml
deleted file mode 100644
index 3a3f22d..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-registration.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration>
- <targetEpr>https://localhost:9443/carbon/email-verification/validator_ajaxprocessor.jsp
- </targetEpr>
- <subject>WSO2 Governance as a Service - Registration confirmation</subject>
- <body>
- Hi,
- Thank you for registering for an account in WSO2 Governance as a Service. In order to
- activate your account, Please click the following link and verfiy your email.
- </body>
- <footer>
- Thanks,
- WSO2 Governance Team
- http://governance.stratoslive.wso2.com
- </footer>
- <redirectPath>../tenant-register/tenant_add_ajaxprocessor.jsp</redirectPath>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-update.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-update.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-update.xml
deleted file mode 100644
index 3f3b8ea..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/email-update.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration>
- <targetEpr>https://localhost:9443/carbon/email-verification/validator_ajaxprocessor.jsp
- </targetEpr>
- <subject>WSO2 Governance as a Service - Updating the contact email address</subject>
- <body>
- Hi,
- We got a request to change the contact email address of WSO2 Governance as a Service
- account. In order to update the contact details, Please click the following link and verfiy
- your email address.
- </body>
- <footer>
- Thanks,
- WSO2 Governance Team
- http://governance.stratoslive.wso2.com
- </footer>
- <redirectPath>../account-mgt/update_verifier.jsp</redirectPath>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-billing-rule.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-billing-rule.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-billing-rule.xml
deleted file mode 100644
index 3bde368..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-billing-rule.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<configuration xmlns="http://www.wso2.org/products/rule/drools">
- <executionSet uri="simpleItemRuleXML">
- <source key="file:{conf-dir}/billing-rules1.drl"/>
-
- <!-- <source>
-
- <x><![CDATA[
- rule InvokeABC
- // rules inbuilt to the rule conf
- end
-
- ]]>
- </x>
- </source> -->
- <creation>
- <property name="source" value="drl"/>
-
- </creation>
- </executionSet>
- <session type="stateless"/>
- <input name="facts" type="billing" key="dataContext"></input>
-
- <output name="results" type="billing" key="dataContext"></output>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-packages.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-packages.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-packages.xml
deleted file mode 100644
index 0239204..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/multitenancy-packages.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<packages xmlns="http://wso2.com/carbon/multitenancy/billing/pacakges">
- <package name="multitenancy-free">
- <users>
- <limit>5</limit>
- <charge>0</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>10</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>1000</limit>
- <!-- mb per user -->
- <overuseCharge>0</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- </package>
- <package name="multitenancy-small">
- <users>
- <limit>10</limit>
- <charge>10</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>25</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>2000</limit>
- <!-- mb per user -->
- <overuseCharge>.1</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- <userLimit>10</userLimit>
- </package>
- <package name="multitenancy-medium">
- <users>
- <limit>50</limit>
- <charge>50</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>100</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>2000</limit>
- <!-- mb per user -->
- <overuseCharge>.1</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- </package>
- <package name="multitenancy-large">
- <users>
- <limit>unlimited</limit>
- <charge>5000</charge>
- <!-- $ per user per month -->
- </users>
- <resourceVolume>
- <limit>100</limit>
- <!--mb per user -->
- </resourceVolum>
- <bandwidth>
- <limit>4000</limit>
- <!-- mb per user -->
- <overuseCharge>.1</overuseCharse>
- <!-- $ per user per month -->
- </bandwidth>
- </package>
-</packages>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/notification.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/notification.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/notification.xml
deleted file mode 100644
index 25e09e8..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.0/src/test/resources/carbonhome2/repository/conf/notification.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- ~
- ~ WSO2 Inc. 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.
- -->
-<!-- configure the notifications -->
-<Notifications>
- <enabled>true</enabled>
- <host>http://localhost/feed.xml?product={product}&build={build}&instance={instance.id}&tenant={tenant}</host>
-</Notifications>
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/pom.xml b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/pom.xml
deleted file mode 100644
index e7837b0..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/pom.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<!--
-# Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-#
-# Licensed 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>billing-parent</artifactId>
- <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.billing.core</artifactId>
- <version>2.1.3</version>
- <packaging>bundle</packaging>
- <name>WSO2 Carbon - Billing Core</name>
-
- <build>
-
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Export-Package>
- org.wso2.carbon.billing.core.*,
- </Export-Package>
- <!--<Require-Bundle>
- drools;visibility:=reexport
- </Require-Bundle>-->
- <Import-Package>
- org.wso2.carbon.rule.*,
- org.wso2.carbon.email.sender.api,
- org.quartz.*; version=2.1.1,
- org.apache.synapse.task.*,
- org.wso2.carbon.registry.core.*;version=1.0.1,
- org.wso2.carbon.registry.resource.*,
- !javax.xml.namespace,
- javax.xml.namespace; version=0.0.0,
- javax.servlet;version="${imp.pkg.version.javax.servlet}",
- javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
- org.apache.axiom.*; version="${axiom.osgi.version.range}",
- *;resolution:=optional
- </Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <forkMode>pertest</forkMode>
- <argLine>-enableassertions</argLine>
- <testFailureIgnore>false</testFailureIgnore>
- <excludes>
- <exclude>**/CashTest.java</exclude>
- <exclude>**/MonthlyTriggerCalculatorTest.java</exclude>
- <exclude>**/RuleTest.java</exclude>
- <exclude>**/CarbonHome1Test.java</exclude>
- <exclude>**/InvoiceMsgTest.java</exclude>
- <exclude>**/TestUtils.java</exclude>
- <exclude>**/TriggerTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.email.sender</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.registry.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.user.core</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.synapse</groupId>
- <artifactId>synapse-tasks</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.rule.kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.rule.common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.rule.backend</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.stratos.common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.ndatasource.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.ndatasource.rdbms</artifactId>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingConstants.java
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingConstants.java b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingConstants.java
deleted file mode 100644
index 6979f65..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingConstants.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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 org.wso2.carbon.billing.core;
-
-public class BillingConstants {
- public static final String GROUP_ID = "BillingTasks";
- public static final String TASK_NAME_KEY = "taskName";
- public static final String SCHEDULER_KEY = "scheduler";
- public static final String SCHEDULER_CONTEXT = "schedulerContext";
- public static final String BILLING_ENGINE_KEY = "billingEngine";
- public static final String BILLING_CONFIG = "billing-config.xml";
- public static final String CONFIG_NS = "http://wso2.com/carbon/multitenancy/billing/config";
- public static final String TRIGGER_CALCULATOR_CLASS_ATTR = "scheduleHelperClass";
- public static final String TRIGGER_CALCULATOR_SERVICE_ATTR = "scheduleHelperService";
- public static final String SCHEDULE_CONF_KEY = "schedule";
- public static final String SCHEDULE_CONF_PARAM_KEY = "parameter";
- public static final String SCHEDULE_CONF_PARAM_NAME_KEY = "name";
- public static final String HANDLER = "handler";
- public static final String HANDLERS = "handlers";
- public static final String HANDLER_CLASS_ATTR = "class";
- public static final String HANDLER_SERVICE_ATTR = "service";
- public static final String SUBSCRIPTION_FILTER_KEY = "subscriptionFilter";
- public static final String DB_CONFIG = "dbConfig";
- public static final String TASKS = "tasks";
- public static final String ATTR_ID = "id";
- public static final String NS_PREFIX = "";
- public static final String DBCONFIG_VALIDATION_QUERY = "validationQuery";
- public static final String DBCONFIG_MAX_WAIT = "maxWait";
- public static final String DBCONFIG_MIN_IDLE = "minIdle";
- public static final String DBCONFIG_MAX_ACTIVE = "maxActive";
- public static final String DBCONFIG_DRIVER_NAME = "driverName";
- public static final String DBCONFIG_PASSWORD = "password";
- public static final String DBCONFIG_USER_NAME = "userName";
- public static final String DBCONFIG_URL = "url";
- public static final String SUBSCRIPTION_SUBITEM = "subscription";
- public static final String BANDWIDTH_SUBITEM = "bwOveruse";
- public static final String STORAGE_SUBITEM = "storageOveruse";
- public static final String CARTRIDGE_SUBITEM = "cartridgeOveruse";
- public static final String PAYMENT_RECEIVED_EMAIL_CUSTOMER_FILE = "email-payment-received-customer.xml";
- public static final String REGISTRATION_PAYMENT_RECEIVED_EMAIL_CUSTOMER_FILE = "email-registration-payment-received-customer.xml";
- public static final String PAYMENT_RECEIVED_EMAIL_WSO2_FILE = "email-payment-received-wso2.xml";
- public static final String WSO2_BILLING_DS = "WSO2BillingDS";
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngine.java
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngine.java b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngine.java
deleted file mode 100644
index b6f8265..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngine.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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 org.wso2.carbon.billing.core;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.billing.core.beans.OutstandingBalanceInfoBean;
-import org.wso2.carbon.billing.core.conf.BillingTaskConfiguration;
-import org.wso2.carbon.billing.core.dataobjects.*;
-import org.wso2.carbon.billing.core.internal.Util;
-import org.wso2.carbon.billing.core.jdbc.DataAccessObject;
-import org.wso2.carbon.billing.core.scheduler.BillingScheduler;
-import org.wso2.carbon.billing.core.scheduler.SchedulerContext;
-import org.wso2.carbon.billing.core.utilities.CustomerUtils;
-import org.wso2.carbon.email.sender.api.EmailSender;
-import org.wso2.carbon.email.sender.api.EmailSenderConfiguration;
-import org.wso2.carbon.stratos.common.constants.StratosConstants;
-import org.wso2.carbon.user.api.Tenant;
-import org.wso2.carbon.user.api.TenantManager;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Billing engine work on billing per a seller
- */
-public class BillingEngine {
-
- private static Log log = LogFactory.getLog(BillingEngine.class);
- private BillingTaskConfiguration billingTaskConfig;
- BillingScheduler billingScheduler;
- DataAccessObject dataAccessObject;
-
- public BillingEngine(BillingTaskConfiguration billingTaskConfig,
- DataAccessObject dataAccessObject) {
- this.billingTaskConfig = billingTaskConfig;
- billingScheduler = new BillingScheduler(this, billingTaskConfig);
- this.dataAccessObject = dataAccessObject;
- }
-
- public void scheduleBilling() throws BillingException {
- // the logic to schedule the billing
- SchedulerContext schedulerContext = billingScheduler.createScheduleContext();
- if(schedulerContext.getCronString() != null || !schedulerContext.getCronString().equals("")) {
- billingScheduler.scheduleNextCycle(schedulerContext);
- } else {
- log.debug("Billing is not scheduled : due to undefined cron expression");
- }
- }
-
- public void generateBill() throws BillingException {
- BillingEngineContext billingEngineContext = new BillingEngineContext();
- generateBill(billingEngineContext);
- }
-
- public void generateBill(SchedulerContext schedulerContext) throws BillingException {
- BillingEngineContext billingEngineContext = new BillingEngineContext();
- billingEngineContext.setSchedulerContext(schedulerContext);
- generateBill(billingEngineContext);
- }
-
- public void generateBill(BillingEngineContext billingEngineContext) throws BillingException {
-
- try {
- beginTransaction();
- if (billingEngineContext.getSchedulerContext() == null) {
- SchedulerContext schedulerContext = billingScheduler.createScheduleContext();
- billingEngineContext.setSchedulerContext(schedulerContext);
- }
-
- billingEngineContext.setTaskConfiguration(billingTaskConfig);
-
- // now iterator through all the handlers
- List<BillingHandler> handlers = billingTaskConfig.getBillingHandlers();
- for (BillingHandler handler : handlers) {
- handler.execute(billingEngineContext);
- }
- //commit transaction
- commitTransaction();
- }catch (Exception e){
- String msg = "Error occurred while generating the bill:" + e.getMessage();
- log.error(msg, e);
- //rollback transaction
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
-
- }
-
- public void beginTransaction() throws BillingException {
- dataAccessObject.beginTransaction();
- }
-
- public void commitTransaction() throws BillingException {
- dataAccessObject.commitTransaction();
- }
-
- public void rollbackTransaction() throws BillingException {
- dataAccessObject.rollbackTransaction();
- }
-
- public List<Item> getItemsWithName(String itemName) throws BillingException {
- List<Item> items;
- try {
- beginTransaction();
- items = dataAccessObject.getItemsWithName(itemName);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting item with name: " + itemName +
- " " + e.getMessage();
- log.error(msg);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return items;
- }
-
- public int addItem(Item item) throws BillingException {
- int itemId = 0;
- try {
- beginTransaction();
- itemId = dataAccessObject.addItem(item);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while adding item: " + item.getName() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return itemId;
- }
-
- public Item getItem(int itemId) throws BillingException {
- Item item;
- try {
- beginTransaction();
- item = dataAccessObject.getItem(itemId);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting item with id: " + itemId +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return item;
- }
-
- public List<Customer> getCustomersWithName(String customerName) throws BillingException {
- TenantManager tenantManager = Util.getRealmService().getTenantManager();
- List<Customer> customers = new ArrayList<Customer>();
- try{
- int tenantId = tenantManager.getTenantId(customerName);
- Tenant tenant = tenantManager.getTenant(tenantId);
- if(tenant!=null){
- Customer customer = new Customer();
- customer.setId(tenant.getId());
- customer.setName(tenant.getDomain());
- customer.setStartedDate(tenant.getCreatedDate());
- customer.setEmail(tenant.getEmail());
- //customer.setAddress();
- customers.add(customer);
- }
- }catch(Exception e){
- String msg = "Failed to get customers for customers: " + customerName + ".";
- log.error(msg, e);
- throw new BillingException(msg, e);
- }
-
- return customers;
- }
-
- public int addSubscription(Subscription subscription) throws BillingException {
- int subscriptionId = 0;
- try {
- beginTransaction();
- subscriptionId =
- dataAccessObject.addSubscription(subscription,
- subscription.getSubscriptionPlan());
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while adding subscription: " + subscription.getSubscriptionPlan()+
- " for the customer " + subscription.getCustomer().getName() + " " + e.getMessage() ;
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return subscriptionId;
- }
-
- public int addPayment(Payment payment) throws BillingException {
- int paymentId = 0;
- try {
- beginTransaction();
- paymentId = dataAccessObject.addPayment(payment);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while adding payment record (transaction id): " + payment.getDescription() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return paymentId;
- }
-
- public int addRegistrationPayment(Payment payment, String usagePlan) throws BillingException {
- int paymentId = 0;
- try {
- beginTransaction();
- paymentId = dataAccessObject.addRegistrationPayment(payment, usagePlan);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while adding registration payment record (transaction id): " + payment.getDescription() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return paymentId;
- }
-
- public Invoice getLastInvoice(Customer customer) throws BillingException {
- Invoice invoice = null;
- try {
- beginTransaction();
- invoice = dataAccessObject.getLastInvoice(customer);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting last invoice for customer: " + customer.getId() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return invoice;
- }
-
- public List<Invoice> getAllInvoices(Customer customer) throws BillingException {
- List<Invoice> invoices = null;
- try {
- beginTransaction();
- invoices = dataAccessObject.getAllInvoices(customer);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting all invoices for customer: " + customer.getId() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return invoices;
- }
-
- public List<Subscription> getActiveSubscriptions(Customer customer) throws BillingException {
- List<Subscription> subscriptions;
- try {
- beginTransaction();
- subscriptions =
- dataAccessObject.getFilteredActiveSubscriptionsForCustomer(
- null, customer);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting active subscriptions for customer: " + customer.getId() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return subscriptions;
- }
-
- public Subscription getActiveSubscriptionOfCustomer(int customerId) throws BillingException {
- Subscription subscription;
- try {
- beginTransaction();
- subscription =
- dataAccessObject.getActiveSubscriptionOfCustomer(customerId);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting active subscription for customer: " + customerId +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return subscription;
- }
-
- public List<Invoice> getInvoices(Customer customer) throws BillingException {
- List<Invoice> invoices;
- try {
- beginTransaction();
- invoices = dataAccessObject.getInvoices(customer);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting invoices for customer: " + customer.getId() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return invoices;
- }
-
- public Invoice getInvoice(int invoiceId) throws BillingException {
- Invoice invoice = null;
- try {
- beginTransaction();
- invoice = dataAccessObject.getInvoice(invoiceId);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting invoice with id: " + invoiceId +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return invoice;
- }
-
- public List<Item> getBilledItems(Subscription subscription) throws BillingException {
- List<Item> billedItems;
- try {
- beginTransaction();
- billedItems = dataAccessObject.getBilledItems(subscription);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting billed items for subscription: " + subscription.getId() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return billedItems;
- }
-
- public List<Subscription> getInvoiceSubscriptions(int invoiceId) throws BillingException {
- List<Subscription> subscriptions;
- try {
- beginTransaction();
- subscriptions = dataAccessObject.getInvoiceSubscriptions(invoiceId);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting invoice subscriptions for invoice id: " + invoiceId +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return subscriptions;
- }
-
- public Payment getLastPayment(Customer customer) throws BillingException {
- Payment payment;
- try {
- beginTransaction();
- payment = dataAccessObject.getLastPayment(customer);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while getting the last payment for customer: " + customer.getId() +
- " " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
- return payment;
- }
-
- public List<Customer> getAllCustomers() throws BillingException {
- return CustomerUtils.getAllCustomers();
- }
-
- public List<OutstandingBalanceInfoBean> getAllOutstandingBalanceInfoBeans(String tenantDomain)
- throws BillingException {
- if(tenantDomain==null || "".equals(tenantDomain)){
- return getAllOutstandingBalances(null);
- }else{
- List<Customer> customers = getCustomersWithName(tenantDomain);
- if(customers!=null && customers.size()>0){
- return getAllOutstandingBalances(customers.get(0));
- }else{
- return new ArrayList<OutstandingBalanceInfoBean>();
- }
- }
- }
-
- public List<OutstandingBalanceInfoBean> getAllOutstandingBalances(Customer preferredCustomer) throws BillingException{
- List<Customer> customers;// = getAllCustomers();
- List<OutstandingBalanceInfoBean> outstandingBalances = new ArrayList<OutstandingBalanceInfoBean>();
- if(preferredCustomer!=null){
- customers = new ArrayList<Customer>();
- customers.add(preferredCustomer);
- }else{
- customers = getAllCustomers();
- }
- for(Customer customer : customers){
- OutstandingBalanceInfoBean balanceBean = new OutstandingBalanceInfoBean();
- balanceBean.setCustomerName(customer.getName());
- Invoice invoice = getLastInvoice(customer);
- if(invoice!=null){
- balanceBean.setCarriedForward(invoice.getCarriedForward().toString());
- balanceBean.setLastInvoiceDate(invoice.getDate());
- }
- //setting the active usage plan
- Subscription subscription = getActiveSubscriptionOfCustomer(customer.getId());
- if(subscription!=null){
- balanceBean.setSubscription(subscription.getSubscriptionPlan());
- }else{
- balanceBean.setSubscription("Not Available");
- }
-
- Payment payment = getLastPayment(customer);
- if(payment!=null){
- balanceBean.setLastPaidAmount(payment.getAmount().toString());
- balanceBean.setLastPaymentDate(payment.getDate());
- }
- outstandingBalances.add(balanceBean);
- }
- return outstandingBalances;
- }
-
- public void sendPaymentReceivedEmail(String toAddress, String emailFile,
- Map<String,String> mailParameters) throws Exception {
- String emailTemplateFile = CarbonUtils.getCarbonConfigDirPath()+ File.separator
- + StratosConstants.EMAIL_CONFIG + File.separator + emailFile;
- EmailSenderConfiguration senderConfiguration =
- EmailSenderConfiguration.loadEmailSenderConfiguration(emailTemplateFile);
- EmailSender sender = new EmailSender(senderConfiguration);
- sender.sendEmail(toAddress, mailParameters);
- }
-
- public boolean addDiscount(Discount discount) throws Exception {
- boolean added = false;
- try {
- beginTransaction();
- added = dataAccessObject.addDiscount(discount);
- commitTransaction();
- } catch(Exception e){
- String msg = "Error occurred while adding the discount for tenant: " + discount.getTenantId()+
- ". " + e.getMessage();
- log.error(msg, e);
- rollbackTransaction();
- throw new BillingException(msg, e);
- }
-
- return added;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngineContext.java
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngineContext.java b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngineContext.java
deleted file mode 100644
index 8d97dc1..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingEngineContext.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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 org.wso2.carbon.billing.core;
-
-import org.wso2.carbon.billing.core.conf.BillingTaskConfiguration;
-import org.wso2.carbon.billing.core.dataobjects.Customer;
-import org.wso2.carbon.billing.core.dataobjects.Subscription;
-import org.wso2.carbon.billing.core.scheduler.SchedulerContext;
-
-import java.util.List;
-
-public class BillingEngineContext {
- List<Subscription> subscriptions;
- SchedulerContext schedulerContext;
- Customer customer;
- BillingTaskConfiguration taskConfiguration;
-
- public List<Subscription> getSubscriptions() {
- return subscriptions;
- }
-
- public void setSubscriptions(List<Subscription> subscriptions) {
- this.subscriptions = subscriptions;
- }
-
- public SchedulerContext getSchedulerContext() {
- return schedulerContext;
- }
-
- public void setSchedulerContext(SchedulerContext schedulerContext) {
- this.schedulerContext = schedulerContext;
- }
-
- public Customer getCustomer() {
- return customer;
- }
-
- public void setCustomer(Customer customer) {
- this.customer = customer;
- }
-
- public BillingTaskConfiguration getTaskConfiguration() {
- return taskConfiguration;
- }
-
- public void setTaskConfiguration(BillingTaskConfiguration taskConfiguration) {
- this.taskConfiguration = taskConfiguration;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingException.java
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingException.java b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingException.java
deleted file mode 100644
index 2aae5a4..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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 org.wso2.carbon.billing.core;
-
-@SuppressWarnings("serial")
-public class BillingException extends Exception {
- public BillingException(String msg, Exception e) {
- super(msg, e);
- }
-
- public BillingException(String msg) {
- super(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ee2ab783/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingHandler.java
----------------------------------------------------------------------
diff --git a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingHandler.java b/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingHandler.java
deleted file mode 100644
index 2e7e0fc..0000000
--- a/components/stratos/billing/org.wso2.carbon.billing.core/2.1.3/src/main/java/org/wso2/carbon/billing/core/BillingHandler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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 org.wso2.carbon.billing.core;
-
-import java.util.Map;
-
-public interface BillingHandler {
- public void init(Map<String, String> handlerConfig) throws BillingException;
-
- /**
- * Performs the tasks needed to generate bill, sending bills, etc.
- *
- * @param handlerContext
- * @throws BillingException
- */
- public void execute(BillingEngineContext handlerContext) throws BillingException;
-}