You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/04/22 14:04:22 UTC

[2/7] git commit: updated refs/heads/4.9-bountycastle-daan to 2ac0837

framework/quota: fix checkstyle issue

Fixes enum name to supress checkstyle failure due to the latest checkstyle
version

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/770aa013
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/770aa013
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/770aa013

Branch: refs/heads/4.9-bountycastle-daan
Commit: 770aa0133ee3011239033e2dfe3f6ed41b76761a
Parents: bb29b1d
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Tue Feb 2 19:55:06 2016 +0100
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Apr 22 16:20:34 2016 +0530

----------------------------------------------------------------------
 .../cloudstack/quota/QuotaStatementImpl.java    |  8 +++----
 .../cloudstack/quota/QuotaStatementTest.java    | 22 ++++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770aa013/framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java
----------------------------------------------------------------------
diff --git a/framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java b/framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java
index 5c12ae6..30d2589 100644
--- a/framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java
+++ b/framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java
@@ -59,11 +59,11 @@ public class QuotaStatementImpl extends ManagerBase implements QuotaStatement {
 
     final public static int s_LAST_STATEMENT_SENT_DAYS = 6; //ideally should be less than 7 days
 
-    public enum STATEMENT_PERIODS {
+    public enum QuotaStatementPeriods {
         BIMONTHLY, MONTHLY, QUATERLY, HALFYEARLY, YEARLY
     };
 
-    private STATEMENT_PERIODS _period = STATEMENT_PERIODS.MONTHLY;
+    private QuotaStatementPeriods _period = QuotaStatementPeriods.MONTHLY;
 
     public QuotaStatementImpl() {
         super();
@@ -87,7 +87,7 @@ public class QuotaStatementImpl extends ManagerBase implements QuotaStatement {
         String period_str = configs.get(QuotaConfig.QuotaStatementPeriod.key());
         int period = period_str == null ? 1 : Integer.parseInt(period_str);
 
-        STATEMENT_PERIODS _period = STATEMENT_PERIODS.values()[period];
+        QuotaStatementPeriods _period = QuotaStatementPeriods.values()[period];
         return true;
     }
 
@@ -265,7 +265,7 @@ public class QuotaStatementImpl extends ManagerBase implements QuotaStatement {
         return null;
     }
 
-    public Calendar[] statementTime(final Calendar today, final STATEMENT_PERIODS period) {
+    public Calendar[] statementTime(final Calendar today, final QuotaStatementPeriods period) {
         //check if it is statement time
         int day_of_month = today.get(Calendar.DAY_OF_MONTH);
         int month_of_year = today.get(Calendar.MONTH);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770aa013/framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java
----------------------------------------------------------------------
diff --git a/framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java b/framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java
index d1cc7ac..e2b5a0a 100644
--- a/framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java
+++ b/framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java
@@ -21,7 +21,7 @@ import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.db.TransactionLegacy;
 import junit.framework.TestCase;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.cloudstack.quota.QuotaStatementImpl.STATEMENT_PERIODS;
+import org.apache.cloudstack.quota.QuotaStatementImpl.QuotaStatementPeriods;
 import org.apache.cloudstack.quota.dao.QuotaAccountDao;
 import org.apache.cloudstack.quota.dao.QuotaUsageDao;
 import org.apache.cloudstack.quota.vo.QuotaAccountVO;
@@ -85,12 +85,12 @@ public class QuotaStatementTest extends TestCase {
 
         //BIMONTHLY - first statement of month
         date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1);
-        Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY);
+        Calendar period[] = quotaStatement.statementTime(date, QuotaStatementPeriods.BIMONTHLY);
         assertTrue(period == null);
 
         //1 of this month
         date.set(Calendar.DATE, 1);
-        period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY);
+        period = quotaStatement.statementTime(date, QuotaStatementPeriods.BIMONTHLY);
         assertTrue(period != null);
         assertTrue(period.length == 2);
         assertTrue(period[0].toString(), period[0].before(period[1]));
@@ -100,12 +100,12 @@ public class QuotaStatementTest extends TestCase {
         //BIMONTHLY - second statement of month
         date = Calendar.getInstance();
         date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 16);
-        period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY);
+        period = quotaStatement.statementTime(date, QuotaStatementPeriods.BIMONTHLY);
         assertTrue(period == null);
 
         //17 of this month
         date.set(Calendar.DATE, 17);
-        period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY);
+        period = quotaStatement.statementTime(date, QuotaStatementPeriods.BIMONTHLY);
         assertTrue(period != null);
         assertTrue(period.length == 2);
         assertTrue(period[0].toString(), period[0].before(period[1]));
@@ -128,12 +128,12 @@ public class QuotaStatementTest extends TestCase {
         //MONTHLY
         date = Calendar.getInstance();
         date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1);
-        Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY);
+        Calendar period[] = quotaStatement.statementTime(date, QuotaStatementPeriods.MONTHLY);
         assertTrue(period == null);
 
         //1 of this month
         date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS - 1);
-        period = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY);
+        period = quotaStatement.statementTime(date, QuotaStatementPeriods.MONTHLY);
         assertTrue(period != null);
         assertTrue(period.length == 2);
         assertTrue(period[0].toString(), period[0].before(period[1]));
@@ -157,7 +157,7 @@ public class QuotaStatementTest extends TestCase {
         date = Calendar.getInstance();
         date.set(Calendar.MONTH, Calendar.JANUARY); // 1 Jan
         date.set(Calendar.DATE, 1);
-        Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.QUATERLY);
+        Calendar period[] = quotaStatement.statementTime(date, QuotaStatementPeriods.QUATERLY);
         assertTrue(period != null);
         assertTrue(period.length == 2);
         assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1]));
@@ -182,7 +182,7 @@ public class QuotaStatementTest extends TestCase {
         date = Calendar.getInstance();
         date.set(Calendar.MONTH, Calendar.JANUARY); // 1 Jan
         date.set(Calendar.DATE, 1);
-        Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.HALFYEARLY);
+        Calendar period[] = quotaStatement.statementTime(date, QuotaStatementPeriods.HALFYEARLY);
         assertTrue(period != null);
         assertTrue(period.length == 2);
         assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1]));
@@ -207,7 +207,7 @@ public class QuotaStatementTest extends TestCase {
         date = Calendar.getInstance();
         date.set(Calendar.MONTH, Calendar.JANUARY); // 1 Jan
         date.set(Calendar.DATE, 1);
-        Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.YEARLY);
+        Calendar period[] = quotaStatement.statementTime(date, QuotaStatementPeriods.YEARLY);
         assertTrue("period != null", period != null);
         assertTrue(period.length == 2);
         assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1]));
@@ -244,7 +244,7 @@ public class QuotaStatementTest extends TestCase {
 
         // call real method on send monthly statement
         quotaStatement.sendStatement();
-        Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY);
+        Calendar period[] = quotaStatement.statementTime(date, QuotaStatementPeriods.MONTHLY);
         if (period != null){
             Mockito.verify(alertManager, Mockito.times(1)).sendQuotaAlert(Mockito.any(QuotaAlertManagerImpl.DeferredQuotaEmail.class));
         }