[GitHub] cloudstack pull request: Strongswan vpn feature

2015-12-06 Thread terbolous
Github user terbolous commented on the pull request:

https://github.com/apache/cloudstack/pull/872#issuecomment-162437862
  
@jayapalu that would be great, but due note that feature freeze is today.
@remibergsma @DaanHoogland: is this really a new feature, rather an 
improvement, no?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9094: Multiple threads are bei...

2015-12-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1140


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9094: Multiple threads are bei...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1140#issuecomment-162434058
  
@koushik-das thanks, in that case LGTM. 
Will merge now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Deploy VM failing frequently due to capac...

2015-12-06 Thread harikrishna-patnala
GitHub user harikrishna-patnala opened a pull request:

https://github.com/apache/cloudstack/pull/1180

Deploy VM failing frequently due to capacity calculation not synchron…



There are some VM deployment failures happening when multiple VMs are 
deployed at a time, failures mainly due to NetworkModel code that iterates over 
all the vlans in the pod. This causes each deployVM thread to hold the global 
lock on Network longer and cause delays. This delay in turn causes more threads 
to choose same host and fail since capacity is not available on that host.

Following are some changes required to be done to reduce delays during VM 
deployments which in turn causes some vm deployment failures when multiple VMs 
are launched at a time.

  -  In Planner, remove the clusters that do not contain a host with 
matching service offering tag. This will save some iterations over clusters 
that dont have matching tagged host
  -  In NetworkModel, do not query the vlans for the pod within the loop. 
Also optimized the logic to query the ip/ipv6
  -  In DeploymentPlanningManagerImpl, do not process the affinity group if 
the plan has hostId provided.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/harikrishna-patnala/cloudstack CLOUDSTACK-9112

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/1180.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1180


commit 8394e1940535b05525bebebdb8fcc73fcaefc709
Author: Harikrishna Patnala 
Date:   2015-12-04T09:57:53Z

Deploy VM failing frequently due to capacity calculation not synchronized

Changes:
- In Planner, remove the clusters that do not contain a host with matching 
service offering tag. This will save some iterations over clusters that dont 
have matching tagged host
- In NetworkModel, do not query the vlans for the pod within the loop. Also 
optimized the logic to query the ip/ipv6
- In DeploymentPlanningManagerImpl, do not process the affinity group if 
the plan has hostId provided.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Re: Feature freeze ACS 4.7 next Monday

2015-12-06 Thread Remi Bergsma
Agree!

Sent from my iPhone

On 07 Dec 2015, at 06:26, Rohit Yadav 
mailto:rohit.ya...@shapeblue.com>> wrote:

Hi Remi/Daan,

There are some fixes that might take time today for testing, review and merge 
today. While we’ll try our best, can we announce freezing of master branch at 
EOD/today (7th Dec 2015) so we’ll still have some time today and would allow us 
to include as many of the listed PRs as possible.

Cheers.

On 05-Dec-2015, at 4:28 AM, Remi Bergsma 
mailto:rberg...@schubergphilis.com>> wrote:

Hi all,

Next Monday we'll feature freeze for our upcoming 4.7 release. We looked 
through all open Pull Requests and below is our "whish list" to get in 4.7. 
Feel free to nominate any other changes that should go in 4.7. No guarantees, 
there is limited time so only PRs that we actively work on will make it.

The RC of 4.7.0 is scheduled for Monday Dec 14th so that we all will have a 
nice Christmas present ;-)

Please help us review these PRs. Most have already had some review and when we 
can reach 2xLGTM we can include them in 4.7 on time and make another great 
release.

Happy testing and reviewing!

Regards,
Daan & Remi


Features & Fixes PRs:

Quota
https://github.com/apache/cloudstack/pull/768

Logging enhancement
https://github.com/apache/cloudstack/pull/1167

VMware diskcontrollers
https://github.com/apache/cloudstack/pull/1132

ACS allows to create isolated networks with invalid gateway ip
https://github.com/apache/cloudstack/pull/1125

Update nic IP address of stopped vm
https://github.com/apache/cloudstack/pull/1086

Hypervisor changes to support UserData for Nuage VSP
https://github.com/apache/cloudstack/pull/1142

Support shared networking in NiciraNVP Plugin
https://github.com/apache/cloudstack/pull/1094

Strongswan vpn feature
https://github.com/apache/cloudstack/pull/872

VM Snapshotting implementation for KVM
https://github.com/apache/cloudstack/pull/977

Redundant VPC improvement
(PR will follow over the weekend)


UI PRs:

[UI] fix bug: Cannot delete SSH keypairs in projects
https://github.com/apache/cloudstack/pull/1154

UI icon over VM snapshot to deploy user instance
https://github.com/apache/cloudstack/pull/1150

Newly added project is not showing in the drop down until the browser is 
refreshed
https://github.com/apache/cloudstack/pull/1082

Rohit Yadav
Software Architect

[cid:image003.png@01D122E8.F6EFE910]



S: +44 20 3603 0540 | M: +91 88 262 30892

rohit.ya...@shapeblue.com | 
www.shapeblue.com | 
Twitter:@ShapeBlue

ShapeBlue Ltd, 53 Chandos Place, Covent Garden, London, WC2N 4HS




Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build
CSForge – rapid IaaS deployment framework
CloudStack Consulting
CloudStack Software 
Engineering
CloudStack Infrastructure 
Support
CloudStack Bootcamp Training Courses

This email and any attachments to it may be confidential and are intended 
solely for the use of the individual to whom it is addressed. Any views or 
opinions expressed are solely those of the author and do not necessarily 
represent those of Shape Blue Ltd or related companies. If you are not the 
intended recipient of this email, you must neither take any action based upon 
its contents, nor copy or show it to anyone. Please contact the sender if you 
believe you have received this email in error. Shape Blue Ltd is a company 
incorporated in England & Wales. ShapeBlue Services India LLP is a company 
incorporated in India and is operated under license from Shape Blue Ltd. Shape 
Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is 
operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company 
registered by The Republic of South Africa and is traded under license from 
Shape Blue Ltd. ShapeBlue is a registered trademark.


[GitHub] cloudstack pull request: CLOUDSTACK-9094: Multiple threads are bei...

2015-12-06 Thread koushik-das
Github user koushik-das commented on the pull request:

https://github.com/apache/cloudstack/pull/1140#issuecomment-162418800
  
LGTM based on code changes.

@bhaisaab Since VpcVirtualNetworkApplianceManager is derived from 
VirtualNetworkApplianceManager, start() call on both managers ended up calling 
VirtualNetworkApplianceManager.start(). This resulted in the same 
threads/executors to get initialised/started twice. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46788482
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

@abhinandanprateek we can just do: new Date(startDate.getTime());


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Re: Feature freeze ACS 4.7 next Monday

2015-12-06 Thread Rohit Yadav
Hi all,

List of pending PRs from Remi’s list (good to see we nailed down some of them 
during the weekend):

Strongswan vpn feature
https://github.com/apache/cloudstack/pull/872

Quota
https://github.com/apache/cloudstack/pull/768

VMware diskcontrollers
https://github.com/apache/cloudstack/pull/1132

ACS allows to create isolated networks with invalid gateway ip
https://github.com/apache/cloudstack/pull/1125

Hypervisor changes to support UserData for Nuage VSP
https://github.com/apache/cloudstack/pull/1142

Support shared networking in NiciraNVP Plugin
https://github.com/apache/cloudstack/pull/1094

VM Snapshotting implementation for KVM
https://github.com/apache/cloudstack/pull/977

Redundant VPC improvement
(PR will follow over the weekend)

UI PRs:

UI icon over VM snapshot to deploy user instance
https://github.com/apache/cloudstack/pull/1150

Newly added project is not showing in the drop down until the browser is 
refreshed
https://github.com/apache/cloudstack/pull/1082

On 05-Dec-2015, at 6:50 PM, Wilder Rodrigues 
mailto:wrodrig...@schubergphilis.com>> wrote:

I'm loving it!

Hopefully the rVPC Private Gateway will be fixed within the next hour! Few 
things were not anticipated on the Java side of the code. I have already 
refactored the NicProfileHelper and some other classes. Deploying a DC and will 
test it soon.

Cheers,
Wilder

Sent from my iPhone

On 04 Dec 2015, at 23:58, Remi Bergsma 
mailto:rberg...@schubergphilis.com>> wrote:

Hi all,

Next Monday we'll feature freeze for our upcoming 4.7 release. We looked 
through all open Pull Requests and below is our "whish list" to get in 4.7. 
Feel free to nominate any other changes that should go in 4.7. No guarantees, 
there is limited time so only PRs that we actively work on will make it.

The RC of 4.7.0 is scheduled for Monday Dec 14th so that we all will have a 
nice Christmas present ;-)

Please help us review these PRs. Most have already had some review and when we 
can reach 2xLGTM we can include them in 4.7 on time and make another great 
release.

Happy testing and reviewing!

Regards,
Daan & Remi


Features & Fixes PRs:

Quota
https://github.com/apache/cloudstack/pull/768

Logging enhancement
https://github.com/apache/cloudstack/pull/1167

VMware diskcontrollers
https://github.com/apache/cloudstack/pull/1132

ACS allows to create isolated networks with invalid gateway ip
https://github.com/apache/cloudstack/pull/1125

Update nic IP address of stopped vm
https://github.com/apache/cloudstack/pull/1086

Hypervisor changes to support UserData for Nuage VSP
https://github.com/apache/cloudstack/pull/1142

Support shared networking in NiciraNVP Plugin
https://github.com/apache/cloudstack/pull/1094

Strongswan vpn feature
https://github.com/apache/cloudstack/pull/872

VM Snapshotting implementation for KVM
https://github.com/apache/cloudstack/pull/977

Redundant VPC improvement
(PR will follow over the weekend)


UI PRs:

[UI] fix bug: Cannot delete SSH keypairs in projects
https://github.com/apache/cloudstack/pull/1154

UI icon over VM snapshot to deploy user instance
https://github.com/apache/cloudstack/pull/1150

Newly added project is not showing in the drop down until the browser is 
refreshed
https://github.com/apache/cloudstack/pull/1082

Rohit Yadav
Software Architect

[cid:image003.png@01D122E8.F6EFE910]



S: +44 20 3603 0540 | M: +91 88 262 30892

rohit.ya...@shapeblue.com | 
www.shapeblue.com | 
Twitter:@ShapeBlue

ShapeBlue Ltd, 53 Chandos Place, Covent Garden, London, WC2N 4HS




Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build
CSForge – rapid IaaS deployment framework
CloudStack Consulting
CloudStack Software 
Engineering
CloudStack Infrastructure 
Support
CloudStack Bootcamp Training Courses

This email and any attachments to it may be confidential and are intended 
solely for the use of the individual to whom it is addressed. Any views or 
opinions expressed are solely those of the author and do not necessarily 
represent those of Shape Blue Ltd or related companies. If you are not the 
intended recipient of this email, you must neither take any action based upon 
its contents, nor copy or show it to anyone. Please contact the sender if you 
believe you have received this email in error. Shape Blue Ltd is a company 
incorporated in England & Wales. ShapeBlue Services India LLP is a company 
incorporated in India and is operated under license from Shape Blue Ltd. Shape 
Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is 
operated under license from Shape Blue Ltd. ShapeBlue SA Pt

[GitHub] cloudstack pull request: CLOUDSTACK-9069: Newly added project is n...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1082#issuecomment-162416751
  
@remibergsma @DaanHoogland anyone wants to review this one?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: [UI] fix bug: Cannot delete SSH keypairs ...

2015-12-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1154


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-8968: UI icon over VM snapshot...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1150#issuecomment-162416679
  
@nitin-maharana if you can address what Daan has commented today, along 
with fix tabs with spaces (if any) I can help review this and merge this; 
before 4.7.0/master freeze is announced today.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: [UI] fix bug: Cannot delete SSH keypairs ...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1154#issuecomment-162416559
  
LGTM, merging now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9095 : Hypervisor changes to s...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1142#issuecomment-162416088
  
@nlivens Nick, while it LGTM if you can resolve some of the code issues 
John can mentioned today, I can help review and merge this today before 
4.7.0/master freeze. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9086: ACS allows to create iso...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1125#issuecomment-162415947
  
@kansal can you address some of the issues Daan has mentioned, if you can 
fix them today I help can review and merge this. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Build failed in Jenkins: build-4.5 #546

2015-12-06 Thread jenkins
See 

Changes:

[Rohit Yadav] rate-limit: increase JVM memory and enable fork mode for unit 
tests

--
[...truncated 2934 lines...]
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ 
cloud-plugin-hypervisor-hyperv ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 

[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ 
cloud-plugin-hypervisor-hyperv ---
[INFO] Compiling 1 source file to 

Build timed out (after 11 minutes). Marking the build as failed.
Build was aborted
Recording test results
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ 
cloud-plugin-network-elb ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 

[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ 
cloud-plugin-network-elb ---
[INFO] Compiling 2 source files to 

[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - Network Netscaler
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - Network Nicira NVP
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - BigSwitch Virtual Network Segment
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - Network Brocade VCS
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - Stratosphere SSP
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - Network Opendaylight
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - User Authenticator LDAP
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - User Authenticator MD5
[INFO] This project has been banned from the build due to previous failures.
[INFO] 
[INFO] 
[INFO] 
[INFO] Skipping Apache CloudStack Plugin - User Authenticator PBKDF2-SHA-256
[INFO] This project has been banned from the build due to previous failures.
[INFO] ---

Re: Feature freeze ACS 4.7 next Monday

2015-12-06 Thread Rohit Yadav
Hi Remi/Daan,

There are some fixes that might take time today for testing, review and merge 
today. While we’ll try our best, can we announce freezing of master branch at 
EOD/today (7th Dec 2015) so we’ll still have some time today and would allow us 
to include as many of the listed PRs as possible.

Cheers.

On 05-Dec-2015, at 4:28 AM, Remi Bergsma 
mailto:rberg...@schubergphilis.com>> wrote:

Hi all,

Next Monday we'll feature freeze for our upcoming 4.7 release. We looked 
through all open Pull Requests and below is our "whish list" to get in 4.7. 
Feel free to nominate any other changes that should go in 4.7. No guarantees, 
there is limited time so only PRs that we actively work on will make it.

The RC of 4.7.0 is scheduled for Monday Dec 14th so that we all will have a 
nice Christmas present ;-)

Please help us review these PRs. Most have already had some review and when we 
can reach 2xLGTM we can include them in 4.7 on time and make another great 
release.

Happy testing and reviewing!

Regards,
Daan & Remi


Features & Fixes PRs:

Quota
https://github.com/apache/cloudstack/pull/768

Logging enhancement
https://github.com/apache/cloudstack/pull/1167

VMware diskcontrollers
https://github.com/apache/cloudstack/pull/1132

ACS allows to create isolated networks with invalid gateway ip
https://github.com/apache/cloudstack/pull/1125

Update nic IP address of stopped vm
https://github.com/apache/cloudstack/pull/1086

Hypervisor changes to support UserData for Nuage VSP
https://github.com/apache/cloudstack/pull/1142

Support shared networking in NiciraNVP Plugin
https://github.com/apache/cloudstack/pull/1094

Strongswan vpn feature
https://github.com/apache/cloudstack/pull/872

VM Snapshotting implementation for KVM
https://github.com/apache/cloudstack/pull/977

Redundant VPC improvement
(PR will follow over the weekend)


UI PRs:

[UI] fix bug: Cannot delete SSH keypairs in projects
https://github.com/apache/cloudstack/pull/1154

UI icon over VM snapshot to deploy user instance
https://github.com/apache/cloudstack/pull/1150

Newly added project is not showing in the drop down until the browser is 
refreshed
https://github.com/apache/cloudstack/pull/1082

Rohit Yadav
Software Architect

[cid:image003.png@01D122E8.F6EFE910]



S: +44 20 3603 0540 | M: +91 88 262 30892

rohit.ya...@shapeblue.com | 
www.shapeblue.com | 
Twitter:@ShapeBlue

ShapeBlue Ltd, 53 Chandos Place, Covent Garden, London, WC2N 4HS




Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build
CSForge – rapid IaaS deployment framework
CloudStack Consulting
CloudStack Software 
Engineering
CloudStack Infrastructure 
Support
CloudStack Bootcamp Training Courses

This email and any attachments to it may be confidential and are intended 
solely for the use of the individual to whom it is addressed. Any views or 
opinions expressed are solely those of the author and do not necessarily 
represent those of Shape Blue Ltd or related companies. If you are not the 
intended recipient of this email, you must neither take any action based upon 
its contents, nor copy or show it to anyone. Please contact the sender if you 
believe you have received this email in error. Shape Blue Ltd is a company 
incorporated in England & Wales. ShapeBlue Services India LLP is a company 
incorporated in India and is operated under license from Shape Blue Ltd. Shape 
Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is 
operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company 
registered by The Republic of South Africa and is traded under license from 
Shape Blue Ltd. ShapeBlue is a registered trademark.


[GitHub] cloudstack pull request: [4.5] rate-limit: increase JVM memory and...

2015-12-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1170


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9104: VM naming convention in ...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on the pull request:

https://github.com/apache/cloudstack/pull/1165#issuecomment-162413895
  
@DaanHoogland yes I can do that, I'm personally dealt with a lot of 
vmware/cloudstack naming issues. The syntax/pattern has changes several times 
in the past between 4.0, 4.2, 4.3 causing VM sync issues when users upgrade.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9104: VM naming convention in ...

2015-12-06 Thread bhaisaab
Github user bhaisaab commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1165#discussion_r46787171
  
--- Diff: 
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 ---
@@ -1889,11 +1889,20 @@ int getReservedCpuMHZ(VirtualMachineTO vmSpec) {
 
 // Pair
 private Pair composeVmNames(VirtualMachineTO vmSpec) {
-String vmInternalCSName = vmSpec.getName();
-String vmNameOnVcenter = vmSpec.getName();
-if (_instanceNameFlag && vmSpec.getHostName() != null) {
-vmNameOnVcenter = vmSpec.getHostName();
+
+String vmInternalCSName = null;
+String vmNameOnVcenter  = null;
+if(vmSpec != null)
+{
+vmInternalCSName = vmNameOnVcenter = vmSpec.getName();
+if (_instanceNameFlag == true) {
+String[] tokens = vmInternalCSName.split("-");
+assert (tokens.length >= 3); // vmInternalCSName has 
format i-x-y-
+vmNameOnVcenter = String.format("%s-%s-%s-%s", tokens[0], 
tokens[1], tokens[2], vmSpec.getHostName());
--- End diff --

@priyankparihar can you comment on the issues and motivation around this? 
Do you think we have users who would want to keep hostname as VM names on 
vCenter side if the global setting is enabled (the _instanceNameFlag is true).

If this is not true, by default the name (as returned by the vmSpec) is 
like: i-[0-9]*-[0-9]*-VM. (The suffix "VM", is taken from another global 
setting where the default value is "VM").


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Strongswan vpn feature

2015-12-06 Thread jayapalu
Github user jayapalu commented on the pull request:

https://github.com/apache/cloudstack/pull/872#issuecomment-162411259
  
@terbolous I will take care of this issue in strongswan implementation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on the pull request:

https://github.com/apache/cloudstack/pull/768#issuecomment-162403577
  
@remibergsma I have reviewed the code.  I found a couple of minor issues.  
Namely, that dates are not being defensively copied in a variety of places.  
These fixes are very simple to implement.  The only other items I noticed were 
a number of unit test methods with no asserts.  Hopefully, it will be 
relatively simple to add some asserts to verify correctness of the methods 
being tested.

/cc @abhinandanprateek @bhaisaab 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46785050
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaStatementResponse.java
 ---
@@ -0,0 +1,130 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.BaseResponse;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Date;
+import java.util.List;
+
+public class QuotaStatementResponse  extends BaseResponse {
+
+@SerializedName("accountid")
+@Param(description = "account id")
+private Long accountId;
+
+@SerializedName("account")
+@Param(description = "account name")
+private String accountName;
+
+@SerializedName("domain")
+@Param(description = "domain id")
+private Long domainId;
+
+@SerializedName("quotausage")
+@Param(description = "list of quota usage under various types", 
responseObject = QuotaStatementItemResponse.class)
+private List lineItem;
+
+@SerializedName("totalquota")
+@Param(description = "total quota used during this period")
+private BigDecimal totalQuota;
+
+@SerializedName("startdate")
+@Param(description = "start date")
+private Date startDate = null;
+
+@SerializedName("enddate")
+@Param(description = "end date")
+private Date endDate = null;
+
+@SerializedName("currency")
+@Param(description = "currency")
+private String currency;
+
+public QuotaStatementResponse() {
--- End diff --

@abhinandanprateek see comment above auto generation of default, no arg 
constructors.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784966
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
 ---
@@ -0,0 +1,516 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.User;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+
+import org.apache.cloudstack.api.command.QuotaBalanceCmd;
+import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
+import org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd;
+import org.apache.cloudstack.api.command.QuotaStatementCmd;
+import org.apache.cloudstack.api.command.QuotaTariffListCmd;
+import org.apache.cloudstack.api.command.QuotaTariffUpdateCmd;
+import org.apache.cloudstack.quota.QuotaService;
+import org.apache.cloudstack.quota.QuotaStatement;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.constant.QuotaTypes;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
+import org.apache.cloudstack.quota.dao.QuotaCreditsDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaTariffDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+import org.apache.cloudstack.quota.vo.QuotaCreditsVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.region.RegionManager;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+@Component
+@Local(value = QuotaResponseBuilderImpl.class)
+public class QuotaResponseBuilderImpl implements QuotaResponseBuilder {
+private static final Logger s_logger = 
Logger.getLogger(QuotaResponseBuilderImpl.class);
+
+@Inject
+private QuotaTariffDao _quotaTariffDao;
+@Inject
+private QuotaBalanceDao _quotaBalanceDao;
+@Inject
+private QuotaCreditsDao _quotaCreditsDao;
+@Inject
+private QuotaUsageDao _quotaUsageDao;
+@Inject
+private QuotaEmailTemplatesDao _quotaEmailTemplateDao;
+
+@Inject
+private UserDao _userDao;
+@Inject
+private QuotaService _quotaService;
+@Inject
+private AccountDao _accountDao;
+@Inject
+private QuotaAccountDao _quotaAccountDao;
+@Inject
+private DomainDao _domainDao;
+@Inject
+private RegionManager _regionMgr;
+@Inject
+private QuotaStatement _statement;
+
+@Override
+public QuotaTariffResponse createQuotaTariffResponse(QuotaTariffVO 
tariff) {
+final QuotaTariffResponse response = new QuotaTariffResponse();
+response.setUsageType(tariff.getUsageType());
+response.setUsageName(tariff.getUsageName());
+response.setUsageUnit(tariff.getUsageUnit());
+response.setUsageDis

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784960
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
 ---
@@ -0,0 +1,516 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.User;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+
+import org.apache.cloudstack.api.command.QuotaBalanceCmd;
+import org.apache.cloudstack.api.command.QuotaEmailTemplateListCmd;
+import org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd;
+import org.apache.cloudstack.api.command.QuotaStatementCmd;
+import org.apache.cloudstack.api.command.QuotaTariffListCmd;
+import org.apache.cloudstack.api.command.QuotaTariffUpdateCmd;
+import org.apache.cloudstack.quota.QuotaService;
+import org.apache.cloudstack.quota.QuotaStatement;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.constant.QuotaTypes;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
+import org.apache.cloudstack.quota.dao.QuotaCreditsDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaTariffDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+import org.apache.cloudstack.quota.vo.QuotaCreditsVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.region.RegionManager;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+@Component
+@Local(value = QuotaResponseBuilderImpl.class)
+public class QuotaResponseBuilderImpl implements QuotaResponseBuilder {
+private static final Logger s_logger = 
Logger.getLogger(QuotaResponseBuilderImpl.class);
+
+@Inject
+private QuotaTariffDao _quotaTariffDao;
+@Inject
+private QuotaBalanceDao _quotaBalanceDao;
+@Inject
+private QuotaCreditsDao _quotaCreditsDao;
+@Inject
+private QuotaUsageDao _quotaUsageDao;
+@Inject
+private QuotaEmailTemplatesDao _quotaEmailTemplateDao;
+
+@Inject
+private UserDao _userDao;
+@Inject
+private QuotaService _quotaService;
+@Inject
+private AccountDao _accountDao;
+@Inject
+private QuotaAccountDao _quotaAccountDao;
+@Inject
+private DomainDao _domainDao;
+@Inject
+private RegionManager _regionMgr;
+@Inject
+private QuotaStatement _statement;
+
+@Override
+public QuotaTariffResponse createQuotaTariffResponse(QuotaTariffVO 
tariff) {
+final QuotaTariffResponse response = new QuotaTariffResponse();
+response.setUsageType(tariff.getUsageType());
+response.setUsageName(tariff.getUsageName());
+response.setUsageUnit(tariff.getUsageUnit());
+response.setUsageDis

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784930
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

@abhinandanprateek it's not a matter of it being modified in that time 
period.  Since the value being passed is simply a pointer, any modification to 
that value after calling this method will change the value.  All dates should 
be defensively copied for this reason.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784880
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaBalanceResponse.java
 ---
@@ -0,0 +1,153 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+
+import com.cloud.serializer.Param;
+
+public class QuotaBalanceResponse extends BaseResponse {
+
+@SerializedName("accountid")
+@Param(description = "account id")
+private Long accountId;
+
+@SerializedName("account")
+@Param(description = "account name")
+private String accountName;
+
+@SerializedName("domain")
+@Param(description = "domain id")
+private Long domainId;
+
+@SerializedName("startquota")
+@Param(description = "quota started with")
+private BigDecimal startQuota;
+
+@SerializedName("endquota")
+@Param(description = "quota by end of this period")
+private BigDecimal endQuota;
+
+@SerializedName("credits")
+@Param(description = "list of credits made during this period")
+private List credits = null;
+
+@SerializedName("startdate")
+@Param(description = "start date")
+private Date startDate = null;
+
+@SerializedName("enddate")
+@Param(description = "end date")
+private Date endDate = null;
+
+@SerializedName("currency")
+@Param(description = "currency")
+private String currency;
+
+public QuotaBalanceResponse() {
+super();
+credits = new ArrayList();
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public BigDecimal getStartQuota() {
+return startQuota;
+}
+
+public void setStartQuota(BigDecimal startQuota) {
+this.startQuota = startQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public BigDecimal getEndQuota() {
+return endQuota;
+}
+
+public void setEndQuota(BigDecimal endQuota) {
+this.endQuota = endQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public List getCredits() {
+return credits;
+}
+
+public void setCredits(List credits) {
+this.credits = credits;
+}
+
+public void addCredits(QuotaBalanceVO credit) {
+QuotaCreditsResponse cr = new QuotaCreditsResponse();
+cr.setCredits(credit.getCreditBalance());
+cr.setUpdatedOn(credit.getUpdatedOn());
+credits.add(0, cr);
+}
+
+public Date getStartDate() {
+return startDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
+}
+
+public Date getEndDate() {
+return endDate;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff --

Since ``Date``s are mutable, a copy of ``endDate`` should be set to 
``this.endDate``.


---
If your project is set up for it, 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784858
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

The date is being internally created and passed from url, no issue of 
someone modifying in between, while setting.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784850
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaBalanceResponse.java
 ---
@@ -0,0 +1,153 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+
+import com.cloud.serializer.Param;
+
+public class QuotaBalanceResponse extends BaseResponse {
+
+@SerializedName("accountid")
+@Param(description = "account id")
+private Long accountId;
+
+@SerializedName("account")
+@Param(description = "account name")
+private String accountName;
+
+@SerializedName("domain")
+@Param(description = "domain id")
+private Long domainId;
+
+@SerializedName("startquota")
+@Param(description = "quota started with")
+private BigDecimal startQuota;
+
+@SerializedName("endquota")
+@Param(description = "quota by end of this period")
+private BigDecimal endQuota;
+
+@SerializedName("credits")
+@Param(description = "list of credits made during this period")
+private List credits = null;
+
+@SerializedName("startdate")
+@Param(description = "start date")
+private Date startDate = null;
+
+@SerializedName("enddate")
+@Param(description = "end date")
+private Date endDate = null;
+
+@SerializedName("currency")
+@Param(description = "currency")
+private String currency;
+
+public QuotaBalanceResponse() {
+super();
+credits = new ArrayList();
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public BigDecimal getStartQuota() {
+return startQuota;
+}
+
+public void setStartQuota(BigDecimal startQuota) {
+this.startQuota = startQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public BigDecimal getEndQuota() {
+return endQuota;
+}
+
+public void setEndQuota(BigDecimal endQuota) {
+this.endQuota = endQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public List getCredits() {
+return credits;
+}
+
+public void setCredits(List credits) {
+this.credits = credits;
+}
+
+public void addCredits(QuotaBalanceVO credit) {
+QuotaCreditsResponse cr = new QuotaCreditsResponse();
+cr.setCredits(credit.getCreditBalance());
+cr.setUpdatedOn(credit.getUpdatedOn());
+credits.add(0, cr);
+}
+
+public Date getStartDate() {
+return startDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Since ``Date``s are mutable, ``startDate`` should be copied before setting 
``this.startDate``.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but no

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784820
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaBalanceResponse.java
 ---
@@ -0,0 +1,153 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+
+import com.cloud.serializer.Param;
+
+public class QuotaBalanceResponse extends BaseResponse {
+
+@SerializedName("accountid")
+@Param(description = "account id")
+private Long accountId;
+
+@SerializedName("account")
+@Param(description = "account name")
+private String accountName;
+
+@SerializedName("domain")
+@Param(description = "domain id")
+private Long domainId;
+
+@SerializedName("startquota")
+@Param(description = "quota started with")
+private BigDecimal startQuota;
+
+@SerializedName("endquota")
+@Param(description = "quota by end of this period")
+private BigDecimal endQuota;
+
+@SerializedName("credits")
+@Param(description = "list of credits made during this period")
+private List credits = null;
+
+@SerializedName("startdate")
+@Param(description = "start date")
+private Date startDate = null;
+
+@SerializedName("enddate")
+@Param(description = "end date")
+private Date endDate = null;
+
+@SerializedName("currency")
+@Param(description = "currency")
+private String currency;
+
+public QuotaBalanceResponse() {
+super();
+credits = new ArrayList();
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public BigDecimal getStartQuota() {
+return startQuota;
+}
+
+public void setStartQuota(BigDecimal startQuota) {
+this.startQuota = startQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public BigDecimal getEndQuota() {
+return endQuota;
+}
+
+public void setEndQuota(BigDecimal endQuota) {
+this.endQuota = endQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public List getCredits() {
+return credits;
+}
+
+public void setCredits(List credits) {
+this.credits = credits;
+}
+
+public void addCredits(QuotaBalanceVO credit) {
+QuotaCreditsResponse cr = new QuotaCreditsResponse();
+cr.setCredits(credit.getCreditBalance());
+cr.setUpdatedOn(credit.getUpdatedOn());
+credits.add(0, cr);
+}
+
+public Date getStartDate() {
+return startDate;
--- End diff --

Since ``Date``s are mutable, a copy of ``startDate`` should be returned to 
avoid downstream side effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with IN

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784827
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/response/QuotaBalanceResponse.java
 ---
@@ -0,0 +1,153 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.response;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+
+import com.cloud.serializer.Param;
+
+public class QuotaBalanceResponse extends BaseResponse {
+
+@SerializedName("accountid")
+@Param(description = "account id")
+private Long accountId;
+
+@SerializedName("account")
+@Param(description = "account name")
+private String accountName;
+
+@SerializedName("domain")
+@Param(description = "domain id")
+private Long domainId;
+
+@SerializedName("startquota")
+@Param(description = "quota started with")
+private BigDecimal startQuota;
+
+@SerializedName("endquota")
+@Param(description = "quota by end of this period")
+private BigDecimal endQuota;
+
+@SerializedName("credits")
+@Param(description = "list of credits made during this period")
+private List credits = null;
+
+@SerializedName("startdate")
+@Param(description = "start date")
+private Date startDate = null;
+
+@SerializedName("enddate")
+@Param(description = "end date")
+private Date endDate = null;
+
+@SerializedName("currency")
+@Param(description = "currency")
+private String currency;
+
+public QuotaBalanceResponse() {
+super();
+credits = new ArrayList();
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public BigDecimal getStartQuota() {
+return startQuota;
+}
+
+public void setStartQuota(BigDecimal startQuota) {
+this.startQuota = startQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public BigDecimal getEndQuota() {
+return endQuota;
+}
+
+public void setEndQuota(BigDecimal endQuota) {
+this.endQuota = endQuota.setScale(2, RoundingMode.HALF_EVEN);
+}
+
+public List getCredits() {
+return credits;
+}
+
+public void setCredits(List credits) {
+this.credits = credits;
+}
+
+public void addCredits(QuotaBalanceVO credit) {
+QuotaCreditsResponse cr = new QuotaCreditsResponse();
+cr.setCredits(credit.getCreditBalance());
+cr.setUpdatedOn(credit.getUpdatedOn());
+credits.add(0, cr);
+}
+
+public Date getStartDate() {
+return startDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
+}
+
+public Date getEndDate() {
+return endDate;
--- End diff --

Since ``Date``s are mutable, a copy of ``endDate`` should be returned to 
avoid downstream side effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your pr

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784798
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaTariffUpdateCmd.java
 ---
@@ -0,0 +1,102 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import com.cloud.user.Account;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaTariffResponse;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+import java.util.Date;
+
+@APICommand(name = "quotaTariffUpdate", responseObject = 
QuotaTariffResponse.class, description = "Update the tariff plan for a 
resource", since = "4.6.0", requestHasSensitiveInfo = false, 
responseHasSensitiveInfo = false)
+public class QuotaTariffUpdateCmd extends BaseCmd {
+public static final Logger s_logger = 
Logger.getLogger(QuotaTariffUpdateCmd.class);
+private static final String s_name = "quotatariffupdateresponse";
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+@Parameter(name = ApiConstants.USAGE_TYPE, type = CommandType.INTEGER, 
required = true, description = "Integer value for the usage type of the 
resource")
+private Integer usageType;
+
+@Parameter(name = "value", type = CommandType.DOUBLE, required = true, 
 description = "The quota tariff value of the resource as per the default unit")
+private Double value;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "The effective start date on/after which the 
quota tariff is effective and older tariffs are no longer used for the usage 
type. Use -MM-dd as the date format, e.g. startDate=2009-06-03.")
+private Date startDate;
+
+public int getUsageType() {
+return usageType;
+}
+
+public void setUsageType(int usageType) {
+this.usageType = usageType;
+}
+
+public Double getValue() {
+return value;
+}
+
+public void setValue(Double value) {
+this.value = value;
+}
+
+public Date getStartDate() {
+return startDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Since ``Date``s are mutable, ``startDate`` should be copied before being 
set to ``this.startDate``.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784764
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaTariffUpdateCmd.java
 ---
@@ -0,0 +1,102 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import com.cloud.user.Account;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaTariffResponse;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+import java.util.Date;
+
+@APICommand(name = "quotaTariffUpdate", responseObject = 
QuotaTariffResponse.class, description = "Update the tariff plan for a 
resource", since = "4.6.0", requestHasSensitiveInfo = false, 
responseHasSensitiveInfo = false)
+public class QuotaTariffUpdateCmd extends BaseCmd {
+public static final Logger s_logger = 
Logger.getLogger(QuotaTariffUpdateCmd.class);
+private static final String s_name = "quotatariffupdateresponse";
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+@Parameter(name = ApiConstants.USAGE_TYPE, type = CommandType.INTEGER, 
required = true, description = "Integer value for the usage type of the 
resource")
+private Integer usageType;
+
+@Parameter(name = "value", type = CommandType.DOUBLE, required = true, 
 description = "The quota tariff value of the resource as per the default unit")
+private Double value;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "The effective start date on/after which the 
quota tariff is effective and older tariffs are no longer used for the usage 
type. Use -MM-dd as the date format, e.g. startDate=2009-06-03.")
+private Date startDate;
+
+public int getUsageType() {
+return usageType;
+}
+
+public void setUsageType(int usageType) {
+this.usageType = usageType;
+}
+
+public Double getValue() {
+return value;
+}
+
+public void setValue(Double value) {
+this.value = value;
+}
+
+public Date getStartDate() {
+return startDate;
--- End diff --

Since ``Date``s are mutable, a copy of ``startDate`` should be returned to 
avoid downstream side effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784756
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaTariffListCmd.java
 ---
@@ -0,0 +1,95 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import com.cloud.user.Account;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaTariffResponse;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@APICommand(name = "quotaTariffList", responseObject = 
QuotaTariffResponse.class, description = "Lists all quota tariff plans", since 
= "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+public class QuotaTariffListCmd extends BaseListCmd {
+public static final Logger s_logger = 
Logger.getLogger(QuotaTariffListCmd.class);
+private static final String s_name = "quotatarifflistresponse";
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+@Parameter(name = ApiConstants.USAGE_TYPE, type = CommandType.INTEGER, 
required = false, description = "Usage type of the resource")
+private Integer usageType;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = false, description = "The effective start date on/after which the 
quota tariff is effective and older tariffs are no longer used for the usage 
type. Use -MM-dd as the date format, e.g. startDate=2009-06-03.")
+private Date effectiveDate;
+
+public QuotaTariffListCmd() {
--- End diff --

In absence of any declared constructors, the compiler will generate a 
public, no arg constructor which will satisfy Spring.  This code is simply 
crufty boilerplate.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784709
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaStatementCmd.java
 ---
@@ -0,0 +1,141 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaStatementResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "quotaStatement", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota statement", 
since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = 
false)
+public class QuotaStatementCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaStatementCmd.class);
+
+private static final String s_name = "quotastatementresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Optional, Account Id for which statement needs 
to be generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "Optional, If 
domain Id is given and the caller is domain admin then the statement is 
generated for domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
required = true, description = "End date range for quota query. Use -MM-dd 
as the date format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "Start date range quota query. Use -MM-dd as 
the date format, e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, 
description = "List quota usage records for the specified usage type")
+private Integer usageType;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Integer getUsageType() {
+return usageType;
+}
+
+public void setUsageType(Integer usageType) {
+this.usageType = usageType;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return _responseBuilder.startOfNextDay(endDate == null ? new 
Date() : endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784663
  
--- Diff: engine/schema/src/com/cloud/usage/UsageVO.java ---
@@ -328,4 +339,48 @@ public Date getStartDate() {
 public Date getEndDate() {
 return endDate;
 }
+
+public void setId(Long id) {
+this.id = id;
+}
+
+public void setType(String type) {
+this.type = type;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff --

Not part of quota changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784674
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaStatementCmd.java
 ---
@@ -0,0 +1,141 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaStatementResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "quotaStatement", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota statement", 
since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = 
false)
+public class QuotaStatementCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaStatementCmd.class);
+
+private static final String s_name = "quotastatementresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Optional, Account Id for which statement needs 
to be generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "Optional, If 
domain Id is given and the caller is domain admin then the statement is 
generated for domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
required = true, description = "End date range for quota query. Use -MM-dd 
as the date format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "Start date range quota query. Use -MM-dd as 
the date format, e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, 
description = "List quota usage records for the specified usage type")
+private Integer usageType;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Integer getUsageType() {
+return usageType;
+}
+
+public void setUsageType(Integer usageType) {
+this.usageType = usageType;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return _responseBuilder.startOfNextDay(endDate == null ? new 
Date() : endDate);
--- End diff --

Since ``Date``s are mutable, a copy of ``endDate`` should be passed into 
``_responseBuilde

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784658
  
--- Diff: engine/schema/src/com/cloud/usage/UsageVO.java ---
@@ -328,4 +339,48 @@ public Date getStartDate() {
 public Date getEndDate() {
 return endDate;
 }
+
+public void setId(Long id) {
+this.id = id;
+}
+
+public void setType(String type) {
+this.type = type;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Not part of quota changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784639
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaStatementCmd.java
 ---
@@ -0,0 +1,141 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaStatementResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "quotaStatement", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota statement", 
since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = 
false)
+public class QuotaStatementCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaStatementCmd.class);
+
+private static final String s_name = "quotastatementresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Optional, Account Id for which statement needs 
to be generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "Optional, If 
domain Id is given and the caller is domain admin then the statement is 
generated for domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
required = true, description = "End date range for quota query. Use -MM-dd 
as the date format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "Start date range quota query. Use -MM-dd as 
the date format, e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, 
description = "List quota usage records for the specified usage type")
+private Integer usageType;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Integer getUsageType() {
+return usageType;
+}
+
+public void setUsageType(Integer usageType) {
+this.usageType = usageType;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return _responseBuilder.startOfNextDay(endDate == null ? new 
Date() : endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784622
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaStatementCmd.java
 ---
@@ -0,0 +1,141 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaStatementResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "quotaStatement", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota statement", 
since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = 
false)
+public class QuotaStatementCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaStatementCmd.class);
+
+private static final String s_name = "quotastatementresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Optional, Account Id for which statement needs 
to be generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "Optional, If 
domain Id is given and the caller is domain admin then the statement is 
generated for domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
required = true, description = "End date range for quota query. Use -MM-dd 
as the date format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "Start date range quota query. Use -MM-dd as 
the date format, e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, 
description = "List quota usage records for the specified usage type")
+private Integer usageType;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Integer getUsageType() {
+return usageType;
+}
+
+public void setUsageType(Integer usageType) {
+this.usageType = usageType;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return _responseBuilder.startOfNextDay(endDate == null ? new 
Date() : endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784665
  
--- Diff: framework/db/src/com/cloud/utils/db/Transaction.java ---
@@ -35,18 +35,15 @@
 if (currentTxn != null) {
 databaseId = currentTxn.getDatabaseId();
 }
-TransactionLegacy txn = TransactionLegacy.open(name, databaseId, 
false);
-try {
-//if (txn.dbTxnStarted()){
-//String warnMsg = "Potential Wrong Usage: 
TRANSACTION.EXECUTE IS WRAPPED INSIDE ANOTHER DB TRANSACTION!";
-//s_logger.warn(warnMsg, new 
CloudRuntimeException(warnMsg));
-//}
+try (final TransactionLegacy txn = TransactionLegacy.open(name, 
databaseId, false)) {
+// if (txn.dbTxnStarted()){
+// String warnMsg = "Potential Wrong Usage: 
TRANSACTION.EXECUTE IS WRAPPED INSIDE ANOTHER DB TRANSACTION!";
+// s_logger.warn(warnMsg, new CloudRuntimeException(warnMsg));
+// }
--- End diff --

Not part of quota changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784647
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Not part of quota changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784609
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaStatementCmd.java
 ---
@@ -0,0 +1,141 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.api.response.QuotaStatementResponse;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "quotaStatement", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota statement", 
since = "4.6.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = 
false)
+public class QuotaStatementCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaStatementCmd.class);
+
+private static final String s_name = "quotastatementresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Optional, Account Id for which statement needs 
to be generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "Optional, If 
domain Id is given and the caller is domain admin then the statement is 
generated for domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
required = true, description = "End date range for quota query. Use -MM-dd 
as the date format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
required = true, description = "Start date range quota query. Use -MM-dd as 
the date format, e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, 
description = "List quota usage records for the specified usage type")
+private Integer usageType;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Integer getUsageType() {
+return usageType;
+}
+
+public void setUsageType(Integer usageType) {
+this.usageType = usageType;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return _responseBuilder.startOfNextDay(endDate == null ? new 
Date() : endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff -

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784636
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff --

Not part of quota changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784560
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
 ---
@@ -0,0 +1,125 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaBalanceResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+@APICommand(name = "quotaBalance", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota balance 
statement", since = "4.6.0", requestHasSensitiveInfo = false, 
responseHasSensitiveInfo = false)
+public class QuotaBalanceCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaBalanceCmd.class);
+
+private static final String s_name = "quotabalanceresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Account Id for which statement needs to be 
generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "If domain Id 
is given and the caller is domain admin then the statement is generated for 
domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
description = "End date range for quota query. Use -MM-dd as the date 
format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
description = "Start date range quota query. Use -MM-dd as the date format, 
e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return endDate == null ? null : 
_responseBuilder.startOfNextDay(endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public Date getStartDate() {
+return startDate;
--- End diff --

Since ``Date``s are mutable, a copy of ``startDate`` should be returned to 
avoid downstream side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784552
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
 ---
@@ -0,0 +1,125 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaBalanceResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+@APICommand(name = "quotaBalance", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota balance 
statement", since = "4.6.0", requestHasSensitiveInfo = false, 
responseHasSensitiveInfo = false)
+public class QuotaBalanceCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaBalanceCmd.class);
+
+private static final String s_name = "quotabalanceresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Account Id for which statement needs to be 
generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "If domain Id 
is given and the caller is domain admin then the statement is generated for 
domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
description = "End date range for quota query. Use -MM-dd as the date 
format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
description = "Start date range quota query. Use -MM-dd as the date format, 
e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return endDate == null ? null : 
_responseBuilder.startOfNextDay(endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public Date getStartDate() {
+return startDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Since ``Date``s are mutable, ``startDate`` should be copied before being 
set to ``this.startDate`` to avoid downstream side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784547
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
 ---
@@ -0,0 +1,125 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaBalanceResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+@APICommand(name = "quotaBalance", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota balance 
statement", since = "4.6.0", requestHasSensitiveInfo = false, 
responseHasSensitiveInfo = false)
+public class QuotaBalanceCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaBalanceCmd.class);
+
+private static final String s_name = "quotabalanceresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Account Id for which statement needs to be 
generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "If domain Id 
is given and the caller is domain admin then the statement is generated for 
domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
description = "End date range for quota query. Use -MM-dd as the date 
format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
description = "Start date range quota query. Use -MM-dd as the date format, 
e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return endDate == null ? null : 
_responseBuilder.startOfNextDay(endDate);
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff --

Since ``Date``s are mutable, ``endDate`` should be copied before being set 
to ``this.endDate`` to avoid downstream side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784536
  
--- Diff: 
plugins/database/quota/src/org/apache/cloudstack/api/command/QuotaBalanceCmd.java
 ---
@@ -0,0 +1,125 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.api.command;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.QuotaBalanceResponse;
+import org.apache.cloudstack.api.response.QuotaResponseBuilder;
+import org.apache.cloudstack.quota.vo.QuotaBalanceVO;
+import org.apache.cloudstack.api.response.QuotaStatementItemResponse;
+
+@APICommand(name = "quotaBalance", responseObject = 
QuotaStatementItemResponse.class, description = "Create a quota balance 
statement", since = "4.6.0", requestHasSensitiveInfo = false, 
responseHasSensitiveInfo = false)
+public class QuotaBalanceCmd extends BaseCmd {
+
+public static final Logger s_logger = 
Logger.getLogger(QuotaBalanceCmd.class);
+
+private static final String s_name = "quotabalanceresponse";
+
+@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, 
required = true, description = "Account Id for which statement needs to be 
generated")
+private String accountName;
+
+@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
required = true, entityType = DomainResponse.class, description = "If domain Id 
is given and the caller is domain admin then the statement is generated for 
domain.")
+private Long domainId;
+
+@Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
description = "End date range for quota query. Use -MM-dd as the date 
format, e.g. startDate=2009-06-03.")
+private Date endDate;
+
+@Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
description = "Start date range quota query. Use -MM-dd as the date format, 
e.g. startDate=2009-06-01.")
+private Date startDate;
+
+@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "List usage records for the 
specified account")
+private Long accountId;
+
+@Inject
+QuotaResponseBuilder _responseBuilder;
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public String getAccountName() {
+return accountName;
+}
+
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public Date getEndDate() {
+return endDate == null ? null : 
_responseBuilder.startOfNextDay(endDate);
--- End diff --

Since ``Date``s are mutable, ``endDate`` should be copied before being 
passed into ``_responseBuilder.startOfNextDay`` to avoid downstream 
side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784435
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaManagerImplTest.java ---
@@ -0,0 +1,203 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.usage.UsageVO;
+import com.cloud.usage.dao.UsageDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
+import org.apache.cloudstack.quota.dao.QuotaTariffDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.dao.ServiceOfferingDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.usage.UsageTypes;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaManagerImplTest extends TestCase {
+
+@Mock
+private AccountDao accountDao;
+@Mock
+private QuotaAccountDao quotaAcc;
+@Mock
+private UsageDao usageDao;
+@Mock
+private QuotaTariffDao quotaTariffDao;
+@Mock
+private QuotaUsageDao quotaUsageDao;
+@Mock
+private ServiceOfferingDao serviceOfferingDao;
+@Mock
+private QuotaBalanceDao quotaBalanceDao;
+@Mock
+private ConfigurationDao configDao;
+
+@Spy
+QuotaManagerImpl quotaManager = new QuotaManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(usageDao, "_usageDao");
+injectMockToField(quotaTariffDao, "_quotaTariffDao");
+injectMockToField(quotaUsageDao, "_quotaUsageDao");
+injectMockToField(serviceOfferingDao, "_serviceOfferingDao");
+injectMockToField(quotaBalanceDao, "_quotaBalanceDao");
+injectMockToField(configDao, "_configDao");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaManager.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaManager.stop());
+}
+
+@Test
+public void testConfig() throws ConfigurationException {
+
Mockito.when(configDao.getConfiguration(Mockito.anyMapOf(String.class, 
Object.class))).thenReturn(new HashMap());
+Map map = new HashMap<>();
+map.put("usage.stats.job.aggregation.range", "0");
+assertTrue(quotaManager.confi

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784408
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java 
---
@@ -0,0 +1,205 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.joda.time.DateTime;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.mail.MessagingException;
+import javax.naming.ConfigurationException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaAlertManagerImplTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+UserDao userDao;
+@Mock
+DomainDao domainDao;
+@Mock
+QuotaEmailTemplatesDao quotaEmailTemplateDao;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManagerImpl.EmailQuotaAlert emailQuotaAlert;
+
+@Spy
+QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaAlertManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaAlertManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaAlertManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(userDao, "_userDao");
+injectMockToField(domainDao, "_domainDao");
+injectMockToField(quotaEmailTemplateDao, "_quotaEmailTemplateDao");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_emailQuotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaAlertManager.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaAlertManager.stop());
--- End diff --

Why are we testing the ``stop`` operation when the test method expects the 
``start`` operation to fail?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or fi

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784395
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java 
---
@@ -0,0 +1,205 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.joda.time.DateTime;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.mail.MessagingException;
+import javax.naming.ConfigurationException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaAlertManagerImplTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+UserDao userDao;
+@Mock
+DomainDao domainDao;
+@Mock
+QuotaEmailTemplatesDao quotaEmailTemplateDao;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManagerImpl.EmailQuotaAlert emailQuotaAlert;
+
+@Spy
+QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaAlertManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaAlertManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaAlertManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(userDao, "_userDao");
+injectMockToField(domainDao, "_domainDao");
+injectMockToField(quotaEmailTemplateDao, "_quotaEmailTemplateDao");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_emailQuotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaAlertManager.start(); // expected to fail as pid is not 
available
--- End diff --

If this is expected to fail the line 101 should call ``fail`` since it is 
expected that this operation will throw an exception.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784388
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java 
---
@@ -0,0 +1,205 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.joda.time.DateTime;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.mail.MessagingException;
+import javax.naming.ConfigurationException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaAlertManagerImplTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+UserDao userDao;
+@Mock
+DomainDao domainDao;
+@Mock
+QuotaEmailTemplatesDao quotaEmailTemplateDao;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManagerImpl.EmailQuotaAlert emailQuotaAlert;
+
+@Spy
+QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaAlertManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaAlertManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaAlertManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(userDao, "_userDao");
+injectMockToField(domainDao, "_domainDao");
+injectMockToField(quotaEmailTemplateDao, "_quotaEmailTemplateDao");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_emailQuotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaAlertManager.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaAlertManager.stop());
+}
+
+@Test
+public void testCheckAndSendQuotaAlertEmails() {
+AccountVO accountVO = new AccountVO();
+accountVO.setId(2L);
+accountVO.setDomainId(1L);
+accountVO.setType(Account.ACCOUNT_TYPE_NORMAL);
+
Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(accountVO);
+
+QuotaAccountVO acc = new QuotaAccountV

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784327
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java 
---
@@ -0,0 +1,205 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.joda.time.DateTime;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.mail.MessagingException;
+import javax.naming.ConfigurationException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaAlertManagerImplTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+UserDao userDao;
+@Mock
+DomainDao domainDao;
+@Mock
+QuotaEmailTemplatesDao quotaEmailTemplateDao;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManagerImpl.EmailQuotaAlert emailQuotaAlert;
+
+@Spy
+QuotaAlertManagerImpl quotaAlertManager = new QuotaAlertManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaAlertManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaAlertManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaAlertManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(userDao, "_userDao");
+injectMockToField(domainDao, "_domainDao");
+injectMockToField(quotaEmailTemplateDao, "_quotaEmailTemplateDao");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_emailQuotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaAlertManager.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaAlertManager.stop());
+}
+
+@Test
+public void testCheckAndSendQuotaAlertEmails() {
+AccountVO accountVO = new AccountVO();
+accountVO.setId(2L);
+accountVO.setDomainId(1L);
+accountVO.setType(Account.ACCOUNT_TYPE_NORMAL);
+
Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(accountVO);
+
+QuotaAccountVO acc = new QuotaAccountV

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784283
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaManagerImplTest.java ---
@@ -0,0 +1,203 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.usage.UsageVO;
+import com.cloud.usage.dao.UsageDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
+import org.apache.cloudstack.quota.dao.QuotaTariffDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.dao.ServiceOfferingDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.usage.UsageTypes;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaManagerImplTest extends TestCase {
+
+@Mock
+private AccountDao accountDao;
+@Mock
+private QuotaAccountDao quotaAcc;
+@Mock
+private UsageDao usageDao;
+@Mock
+private QuotaTariffDao quotaTariffDao;
+@Mock
+private QuotaUsageDao quotaUsageDao;
+@Mock
+private ServiceOfferingDao serviceOfferingDao;
+@Mock
+private QuotaBalanceDao quotaBalanceDao;
+@Mock
+private ConfigurationDao configDao;
+
+@Spy
+QuotaManagerImpl quotaManager = new QuotaManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(usageDao, "_usageDao");
+injectMockToField(quotaTariffDao, "_quotaTariffDao");
+injectMockToField(quotaUsageDao, "_quotaUsageDao");
+injectMockToField(serviceOfferingDao, "_serviceOfferingDao");
+injectMockToField(quotaBalanceDao, "_quotaBalanceDao");
+injectMockToField(configDao, "_configDao");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaManager.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaManager.stop());
--- End diff --

Why is the ``stop`` operation being tested when the ``start`` operation was 
expected to fail?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastr

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784268
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaManagerImplTest.java ---
@@ -0,0 +1,203 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.usage.UsageVO;
+import com.cloud.usage.dao.UsageDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
+import org.apache.cloudstack.quota.dao.QuotaTariffDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.dao.ServiceOfferingDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.usage.UsageTypes;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaManagerImplTest extends TestCase {
+
+@Mock
+private AccountDao accountDao;
+@Mock
+private QuotaAccountDao quotaAcc;
+@Mock
+private UsageDao usageDao;
+@Mock
+private QuotaTariffDao quotaTariffDao;
+@Mock
+private QuotaUsageDao quotaUsageDao;
+@Mock
+private ServiceOfferingDao serviceOfferingDao;
+@Mock
+private QuotaBalanceDao quotaBalanceDao;
+@Mock
+private ConfigurationDao configDao;
+
+@Spy
+QuotaManagerImpl quotaManager = new QuotaManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(usageDao, "_usageDao");
+injectMockToField(quotaTariffDao, "_quotaTariffDao");
+injectMockToField(quotaUsageDao, "_quotaUsageDao");
+injectMockToField(serviceOfferingDao, "_serviceOfferingDao");
+injectMockToField(quotaBalanceDao, "_quotaBalanceDao");
+injectMockToField(configDao, "_configDao");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaManager.start(); // expected to fail as pid is not 
available
--- End diff --

If this is expected to fail the line 102 should call ``fail`` since it is 
expected that this operation will throw an exception.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784229
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaManagerImplTest.java ---
@@ -0,0 +1,203 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.usage.UsageVO;
+import com.cloud.usage.dao.UsageDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.TransactionLegacy;
+import junit.framework.TestCase;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaBalanceDao;
+import org.apache.cloudstack.quota.dao.QuotaTariffDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.dao.ServiceOfferingDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.cloudstack.quota.vo.QuotaUsageVO;
+import org.apache.cloudstack.usage.UsageTypes;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaManagerImplTest extends TestCase {
+
+@Mock
+private AccountDao accountDao;
+@Mock
+private QuotaAccountDao quotaAcc;
+@Mock
+private UsageDao usageDao;
+@Mock
+private QuotaTariffDao quotaTariffDao;
+@Mock
+private QuotaUsageDao quotaUsageDao;
+@Mock
+private ServiceOfferingDao serviceOfferingDao;
+@Mock
+private QuotaBalanceDao quotaBalanceDao;
+@Mock
+private ConfigurationDao configDao;
+
+@Spy
+QuotaManagerImpl quotaManager = new QuotaManagerImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaManagerImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaManager, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaManagerImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(usageDao, "_usageDao");
+injectMockToField(quotaTariffDao, "_quotaTariffDao");
+injectMockToField(quotaUsageDao, "_quotaUsageDao");
+injectMockToField(serviceOfferingDao, "_serviceOfferingDao");
+injectMockToField(quotaBalanceDao, "_quotaBalanceDao");
+injectMockToField(configDao, "_configDao");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaManager.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaManager.stop());
+}
+
+@Test
+public void testConfig() throws ConfigurationException {
+
Mockito.when(configDao.getConfiguration(Mockito.anyMapOf(String.class, 
Object.class))).thenReturn(new HashMap());
+Map map = new HashMap<>();
+map.put("usage.stats.job.aggregation.range", "0");
+assertTrue(quotaManager.confi

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784185
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java ---
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.user.AccountVO;
+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.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaStatementTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManager emailQuotaAlert;
+
+@Spy
+QuotaStatementImpl quotaStatement = new QuotaStatementImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaStatementImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaStatement, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaStatementImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_quotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaStatement.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaStatement.stop());
+}
+
+@Test
+public void testStatementPeriodBIMONTHLY() {
+Calendar date = Calendar.getInstance();
+
+//BIMONTHLY - first statement of month
+date.set(Calendar.DATE, 
QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1);
+Calendar period[] = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period == null);
+
+//1 of this month
+date.set(Calendar.DATE, 1);
+period = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period != null);
+assertTrue(period[0].toString(), period[0].before(period[1]));
+assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 
1);
+assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == 
15);
+
+//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);
+assertTrue(period == null);
+
+//17 of this month

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784176
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java ---
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.user.AccountVO;
+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.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaStatementTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManager emailQuotaAlert;
+
+@Spy
+QuotaStatementImpl quotaStatement = new QuotaStatementImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaStatementImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaStatement, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaStatementImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_quotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaStatement.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaStatement.stop());
--- End diff --

Why would we test the ``stop`` operation in a test where we expect the 
``start`` operation to fail?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784145
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java ---
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.user.AccountVO;
+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.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaStatementTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManager emailQuotaAlert;
+
+@Spy
+QuotaStatementImpl quotaStatement = new QuotaStatementImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaStatementImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaStatement, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaStatementImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_quotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaStatement.start(); // expected to fail as pid is not 
available
--- End diff --

If this is expected to fail the line 84 should a ``fail`` call since it is 
expected that this operation will throw an exception.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784126
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java ---
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.user.AccountVO;
+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.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaStatementTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManager emailQuotaAlert;
+
+@Spy
+QuotaStatementImpl quotaStatement = new QuotaStatementImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaStatementImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaStatement, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaStatementImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_quotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaStatement.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaStatement.stop());
+}
+
+@Test
+public void testStatementPeriodBIMONTHLY() {
+Calendar date = Calendar.getInstance();
+
+//BIMONTHLY - first statement of month
+date.set(Calendar.DATE, 
QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1);
+Calendar period[] = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period == null);
+
+//1 of this month
+date.set(Calendar.DATE, 1);
+period = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period != null);
+assertTrue(period[0].toString(), period[0].before(period[1]));
+assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 
1);
+assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == 
15);
+
+//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);
+assertTrue(period == null);
+
+//17 of this month

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784117
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java ---
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.user.AccountVO;
+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.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaStatementTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManager emailQuotaAlert;
+
+@Spy
+QuotaStatementImpl quotaStatement = new QuotaStatementImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaStatementImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaStatement, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaStatementImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_quotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaStatement.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaStatement.stop());
+}
+
+@Test
+public void testStatementPeriodBIMONTHLY() {
+Calendar date = Calendar.getInstance();
+
+//BIMONTHLY - first statement of month
+date.set(Calendar.DATE, 
QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1);
+Calendar period[] = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period == null);
+
+//1 of this month
+date.set(Calendar.DATE, 1);
+period = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period != null);
+assertTrue(period[0].toString(), period[0].before(period[1]));
+assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 
1);
+assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == 
15);
+
+//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);
+assertTrue(period == null);
+
+//17 of this month

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46784092
  
--- Diff: 
framework/quota/test/org/apache/cloudstack/quota/QuotaStatementTest.java ---
@@ -0,0 +1,248 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.user.AccountVO;
+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.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.naming.ConfigurationException;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RunWith(MockitoJUnitRunner.class)
+public class QuotaStatementTest extends TestCase {
+
+@Mock
+AccountDao accountDao;
+@Mock
+QuotaAccountDao quotaAcc;
+@Mock
+ConfigurationDao configDao;
+@Mock
+QuotaUsageDao quotaUsage;
+@Mock
+QuotaAlertManager emailQuotaAlert;
+
+@Spy
+QuotaStatementImpl quotaStatement = new QuotaStatementImpl();
+
+private void injectMockToField(Object mock, String fieldName) throws 
NoSuchFieldException, IllegalAccessException {
+Field f = QuotaStatementImpl.class.getDeclaredField(fieldName);
+f.setAccessible(true);
+f.set(quotaStatement, mock);
+}
+
+@Before
+public void setup() throws IllegalAccessException, 
NoSuchFieldException, ConfigurationException {
+// Dummy transaction stack setup
+TransactionLegacy.open("QuotaStatementImplTest");
+
+injectMockToField(accountDao, "_accountDao");
+injectMockToField(quotaAcc, "_quotaAcc");
+injectMockToField(configDao, "_configDao");
+injectMockToField(quotaUsage, "_quotaUsage");
+injectMockToField(emailQuotaAlert, "_quotaAlert");
+}
+
+@Test
+public void testStartStop() {
+try {
+quotaStatement.start(); // expected to fail as pid is not 
available
+} catch (NumberFormatException ignored) {
+}
+assertTrue(quotaStatement.stop());
+}
+
+@Test
+public void testStatementPeriodBIMONTHLY() {
+Calendar date = Calendar.getInstance();
+
+//BIMONTHLY - first statement of month
+date.set(Calendar.DATE, 
QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1);
+Calendar period[] = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period == null);
+
+//1 of this month
+date.set(Calendar.DATE, 1);
+period = quotaStatement.statementTime(date, 
STATEMENT_PERIODS.BIMONTHLY);
+assertTrue(period != null);
+assertTrue(period[0].toString(), period[0].before(period[1]));
+assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 
1);
+assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == 
15);
+
+//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);
+assertTrue(period == null);
+
+//17 of this month

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46783406
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/vo/QuotaUsageVO.java ---
@@ -0,0 +1,177 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota.vo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "quota_usage")
+public class QuotaUsageVO implements InternalIdentity {
+
+private static final long serialVersionUID = -7117933845287204781L;
+
+@Id
+@Column(name = "id")
+private Long id;
+
+@Column(name = "zone_id")
+private Long zoneId = null;
+
+@Column(name = "account_id")
+private Long accountId = null;
+
+@Column(name = "domain_id")
+private Long domainId = null;
+
+@Column(name = "usage_item_id")
+private Long usageItemId;
+
+@Column(name = "usage_type")
+private int usageType;
+
+@Column(name = "quota_used")
+private BigDecimal quotaUsed;
+
+@Column(name = "start_date")
+@Temporal(value = TemporalType.TIMESTAMP)
+private Date startDate = null;
+
+@Column(name = "end_date")
+@Temporal(value = TemporalType.TIMESTAMP)
+private Date endDate = null;
+
+public QuotaUsageVO() {
+usageType = -1;
+quotaUsed = new BigDecimal(0);
+endDate = new Date();
+startDate = new Date();
+}
+
+public QuotaUsageVO(Long usageItemId, Long zoneId, Long accountId, 
Long domainId, int usageType, BigDecimal quotaUsed, Date startDate, Date 
endDate) {
+super();
+this.usageItemId = usageItemId;
+this.zoneId = zoneId;
+this.accountId = accountId;
+this.domainId = domainId;
+this.usageType = usageType;
+this.quotaUsed = quotaUsed;
+this.startDate = startDate;
+this.endDate = endDate;
+}
+
+public QuotaUsageVO(QuotaUsageVO toclone) {
+super();
+this.usageItemId = toclone.usageItemId;
+this.zoneId = toclone.zoneId;
+this.accountId = toclone.accountId;
+this.domainId = toclone.domainId;
+this.usageType = toclone.usageType;
+this.quotaUsed = toclone.quotaUsed;
+this.startDate = toclone.startDate;
+this.endDate = toclone.endDate;
+}
+
+public Long getZoneId() {
+return zoneId;
+}
+
+public void setZoneId(Long zoneId) {
+this.zoneId = zoneId;
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+@Override
+public long getId() {
+return id;
+}
+
+public Long getUsageItemId() {
+return usageItemId;
+}
+
+public void setUsageItemId(Long usageItemId) {
+this.usageItemId = usageItemId;
+}
+
+public int getUsageType() {
+return usageType;
+}
+
+public void setUsageType(int usageType) {
+this.usageType = usageType;
+}
+
+public BigDecimal getQuotaUsed() {
+return quotaUsed;
+}
+
+public void setQuotaUsed(BigDecimal quotaUsed) {
+this.quotaUsed = quotaUsed;
+ 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46783388
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/vo/QuotaUsageVO.java ---
@@ -0,0 +1,177 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota.vo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "quota_usage")
+public class QuotaUsageVO implements InternalIdentity {
+
+private static final long serialVersionUID = -7117933845287204781L;
+
+@Id
+@Column(name = "id")
+private Long id;
+
+@Column(name = "zone_id")
+private Long zoneId = null;
+
+@Column(name = "account_id")
+private Long accountId = null;
+
+@Column(name = "domain_id")
+private Long domainId = null;
+
+@Column(name = "usage_item_id")
+private Long usageItemId;
+
+@Column(name = "usage_type")
+private int usageType;
+
+@Column(name = "quota_used")
+private BigDecimal quotaUsed;
+
+@Column(name = "start_date")
+@Temporal(value = TemporalType.TIMESTAMP)
+private Date startDate = null;
+
+@Column(name = "end_date")
+@Temporal(value = TemporalType.TIMESTAMP)
+private Date endDate = null;
+
+public QuotaUsageVO() {
+usageType = -1;
+quotaUsed = new BigDecimal(0);
+endDate = new Date();
+startDate = new Date();
+}
+
+public QuotaUsageVO(Long usageItemId, Long zoneId, Long accountId, 
Long domainId, int usageType, BigDecimal quotaUsed, Date startDate, Date 
endDate) {
+super();
+this.usageItemId = usageItemId;
+this.zoneId = zoneId;
+this.accountId = accountId;
+this.domainId = domainId;
+this.usageType = usageType;
+this.quotaUsed = quotaUsed;
+this.startDate = startDate;
+this.endDate = endDate;
+}
+
+public QuotaUsageVO(QuotaUsageVO toclone) {
+super();
+this.usageItemId = toclone.usageItemId;
+this.zoneId = toclone.zoneId;
+this.accountId = toclone.accountId;
+this.domainId = toclone.domainId;
+this.usageType = toclone.usageType;
+this.quotaUsed = toclone.quotaUsed;
+this.startDate = toclone.startDate;
+this.endDate = toclone.endDate;
+}
+
+public Long getZoneId() {
+return zoneId;
+}
+
+public void setZoneId(Long zoneId) {
+this.zoneId = zoneId;
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+@Override
+public long getId() {
+return id;
+}
+
+public Long getUsageItemId() {
+return usageItemId;
+}
+
+public void setUsageItemId(Long usageItemId) {
+this.usageItemId = usageItemId;
+}
+
+public int getUsageType() {
+return usageType;
+}
+
+public void setUsageType(int usageType) {
+this.usageType = usageType;
+}
+
+public BigDecimal getQuotaUsed() {
+return quotaUsed;
+}
+
+public void setQuotaUsed(BigDecimal quotaUsed) {
+this.quotaUsed = quotaUsed;
+ 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46783384
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/vo/QuotaUsageVO.java ---
@@ -0,0 +1,177 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota.vo;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "quota_usage")
+public class QuotaUsageVO implements InternalIdentity {
+
+private static final long serialVersionUID = -7117933845287204781L;
+
+@Id
+@Column(name = "id")
+private Long id;
+
+@Column(name = "zone_id")
+private Long zoneId = null;
+
+@Column(name = "account_id")
+private Long accountId = null;
+
+@Column(name = "domain_id")
+private Long domainId = null;
+
+@Column(name = "usage_item_id")
+private Long usageItemId;
+
+@Column(name = "usage_type")
+private int usageType;
+
+@Column(name = "quota_used")
+private BigDecimal quotaUsed;
+
+@Column(name = "start_date")
+@Temporal(value = TemporalType.TIMESTAMP)
+private Date startDate = null;
+
+@Column(name = "end_date")
+@Temporal(value = TemporalType.TIMESTAMP)
+private Date endDate = null;
+
+public QuotaUsageVO() {
+usageType = -1;
+quotaUsed = new BigDecimal(0);
+endDate = new Date();
+startDate = new Date();
+}
+
+public QuotaUsageVO(Long usageItemId, Long zoneId, Long accountId, 
Long domainId, int usageType, BigDecimal quotaUsed, Date startDate, Date 
endDate) {
+super();
+this.usageItemId = usageItemId;
+this.zoneId = zoneId;
+this.accountId = accountId;
+this.domainId = domainId;
+this.usageType = usageType;
+this.quotaUsed = quotaUsed;
+this.startDate = startDate;
+this.endDate = endDate;
+}
+
+public QuotaUsageVO(QuotaUsageVO toclone) {
+super();
+this.usageItemId = toclone.usageItemId;
+this.zoneId = toclone.zoneId;
+this.accountId = toclone.accountId;
+this.domainId = toclone.domainId;
+this.usageType = toclone.usageType;
+this.quotaUsed = toclone.quotaUsed;
+this.startDate = toclone.startDate;
+this.endDate = toclone.endDate;
+}
+
+public Long getZoneId() {
+return zoneId;
+}
+
+public void setZoneId(Long zoneId) {
+this.zoneId = zoneId;
+}
+
+public Long getAccountId() {
+return accountId;
+}
+
+public void setAccountId(Long accountId) {
+this.accountId = accountId;
+}
+
+public Long getDomainId() {
+return domainId;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+@Override
+public long getId() {
+return id;
+}
+
+public Long getUsageItemId() {
+return usageItemId;
+}
+
+public void setUsageItemId(Long usageItemId) {
+this.usageItemId = usageItemId;
+}
+
+public int getUsageType() {
+return usageType;
+}
+
+public void setUsageType(int usageType) {
+this.usageType = usageType;
+}
+
+public BigDecimal getQuotaUsed() {
+return quotaUsed;
+}
+
+public void setQuotaUsed(BigDecimal quotaUsed) {
+this.quotaUsed = quotaUsed;
+ 

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46783314
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/dao/QuotaTariffDaoImpl.java ---
@@ -0,0 +1,131 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota.dao;
+
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionLegacy;
+import com.cloud.utils.db.TransactionStatus;
+import org.apache.cloudstack.quota.constant.QuotaTypes;
+import org.apache.cloudstack.quota.vo.QuotaTariffVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Component
+@Local(value = {QuotaTariffDao.class})
+public class QuotaTariffDaoImpl extends GenericDaoBase implements QuotaTariffDao {
+private static final Logger s_logger = 
Logger.getLogger(QuotaTariffDaoImpl.class.getName());
+
+private final SearchBuilder searchUsageType;
+private final SearchBuilder listAllIncludedUsageType;
+
+public QuotaTariffDaoImpl() {
+super();
+searchUsageType = createSearchBuilder();
+searchUsageType.and("usage_type", 
searchUsageType.entity().getUsageType(), SearchCriteria.Op.EQ);
+searchUsageType.done();
+
+listAllIncludedUsageType = createSearchBuilder();
+listAllIncludedUsageType.and("onorbefore", 
listAllIncludedUsageType.entity().getEffectiveOn(), SearchCriteria.Op.LTEQ);
+listAllIncludedUsageType.and("quotatype", 
listAllIncludedUsageType.entity().getUsageType(), SearchCriteria.Op.EQ);
+listAllIncludedUsageType.done();
+}
+
+public QuotaTariffVO findTariffPlanByUsageType(final int quotaType, 
final Date effectiveDate) {
+return Transaction.execute(TransactionLegacy.USAGE_DB, new 
TransactionCallback() {
+@Override
+public QuotaTariffVO doInTransaction(final TransactionStatus 
status) {
+List result = new ArrayList<>();
+final Filter filter = new Filter(QuotaTariffVO.class, 
"updatedOn", false, 0L, 1L);
+final SearchCriteria sc = 
listAllIncludedUsageType.create();
+sc.setParameters("onorbefore", effectiveDate);
+sc.setParameters("quotatype", quotaType);
+result = search(sc, filter);
+if (result != null && !result.isEmpty()) {
+return result.get(0);
+} else {
+if (s_logger.isDebugEnabled()) {
+
s_logger.debug("QuotaTariffDaoImpl::findTariffPlanByUsageType: Missing quota 
type " + quotaType);
+}
+return null;
+}
+}
+});
+}
+
+public List listAllTariffPlans() {
+return Transaction.execute(TransactionLegacy.USAGE_DB, new 
TransactionCallback>() {
+@Override
+public List doInTransaction(final 
TransactionStatus status) {
+return listAll();
+}
+});
+}
+
+public List listAllTariffPlans(final Date 
effectiveDate) {
+return Transaction.execute(TransactionLegacy.USAGE_DB, new 
TransactionCallback>() {
+@Override
+public List doInTransaction(final 
TransactionStatus status) {
+List tariffs = new 
ArrayList();
+final Filter filter = new Filter(QuotaTariffVO.class, 
"updatedOn", false, 0L, 1L);
+final SearchCriteria sc = 
listAllIncludedUsageType.create();

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46783125
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/constant/QuotaConfig.java ---
@@ -0,0 +1,53 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+package org.apache.cloudstack.quota.constant;
+
+import org.apache.cloudstack.framework.config.ConfigKey;
+
+public interface QuotaConfig {
+
+public static final ConfigKey QuotaPluginEnabled = new 
ConfigKey("Advanced", Boolean.class, "quota.enable.service", "false", 
"Indicates whether Quota plugin is enabled or not",
+true);
+
+public static final ConfigKey QuotaEnableEnforcement = new 
ConfigKey("Advanced", String.class, "quota.enable.enforcement", "false",
+"Enable the usage quota enforcement, i.e. on true when 
exceeding quota the respective account will be locked.", true);
+
+public static final ConfigKey QuotaCurrencySymbol = new 
ConfigKey("Advanced", String.class, "quota.currency.symbol", "R", "The 
symbol for the currency in use to measure usage.",
+true);
+
+public static final ConfigKey QuotaSmtpHost = new 
ConfigKey("Advanced", String.class, "quota.usage.smtp.host", "", "Quota 
SMTP host for quota related emails", true);
+
+public static final ConfigKey QuotaSmtpTimeout = new 
ConfigKey("Advanced", String.class, 
"quota.usage.smtp.connection.timeout", "60",
+"Quota SMTP server connection timeout duration", true);
+
+public static final ConfigKey QuotaSmtpUser = new 
ConfigKey("Advanced", String.class, "quota.usage.smtp.user", "", "Quota 
SMTP server username", true);
+
+public static final ConfigKey QuotaSmtpPassword = new 
ConfigKey("Advanced", String.class, "quota.usage.smtp.password", "", 
"Quota SMTP server password", true);
+
+public static final ConfigKey QuotaSmtpPort = new 
ConfigKey("Advanced", String.class, "quota.usage.smtp.port", "", "Quota 
SMTP port", true);
+
+public static final ConfigKey QuotaSmtpAuthType = new 
ConfigKey("Advanced", String.class, "quota.usage.smtp.useAuth", "",
+"If true, use secure SMTP authentication when sending 
emails.", true);
+
+public static final ConfigKey QuotaSmtpSender = new 
ConfigKey("Advanced", String.class, "quota.usage.smtp.sender", "",
+"Sender of quota alert email (will be in the From header of 
the email)", true);
+
--- End diff --

@abhinandanprateek why are they necessary?  Under what circumstances would 
a user have a separate mail server for quota alerts and all other CloudStack 
alerts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46783089
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/constant/QuotaConfig.java ---
@@ -0,0 +1,53 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+
+package org.apache.cloudstack.quota.constant;
+
+import org.apache.cloudstack.framework.config.ConfigKey;
+
+public interface QuotaConfig {
--- End diff --

@abhinandanprateek it is idiomatic to exclude the unnecessary access 
modifiers for maintainability reasons.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46782968
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java ---
@@ -0,0 +1,376 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import 
org.apache.cloudstack.quota.QuotaAlertManagerImpl.DeferredQuotaEmail;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.component.ManagerBase;
+
+@Component
+@Local(value = QuotaStatement.class)
+public class QuotaStatementImpl extends ManagerBase implements 
QuotaStatement {
+private static final Logger s_logger = 
Logger.getLogger(QuotaStatementImpl.class);
+
+@Inject
+private AccountDao _accountDao;
+@Inject
+private QuotaAccountDao _quotaAcc;
+@Inject
+private QuotaUsageDao _quotaUsage;
+@Inject
+private QuotaAlertManager _quotaAlert;
+@Inject
+private ConfigurationDao _configDao;
+
+final public static int s_LAST_STATEMENT_SENT_DAYS = 6; //ideally 
should be less than 7 days
+
+public enum STATEMENT_PERIODS {
+BIMONTHLY, MONTHLY, QUATERLY, HALFYEARLY, YEARLY
+};
+
+private STATEMENT_PERIODS _period = STATEMENT_PERIODS.MONTHLY;
+
+public QuotaStatementImpl() {
+super();
+}
+
+private void mergeConfigs(Map dbParams, Map xmlParams) {
+for (Map.Entry param : xmlParams.entrySet()) {
+dbParams.put(param.getKey(), (String)param.getValue());
+}
+}
+
+@Override
+public boolean configure(String name, Map params) 
throws ConfigurationException {
+super.configure(name, params);
+
+Map configs = _configDao.getConfiguration(params);
+
+if (params != null) {
+mergeConfigs(configs, params);
+}
+String period_str = 
configs.get(QuotaConfig.QuotaStatementPeriod.key());
+int period = period_str == null ? 1 : Integer.valueOf(period_str);
+
+STATEMENT_PERIODS _period = STATEMENT_PERIODS.values()[period];
+return true;
+}
+
+@Override
+public boolean start() {
+if (s_logger.isInfoEnabled()) {
+s_logger.info("Starting Alert Manager");
+}
+return true;
+}
+
+@Override
+public boolean stop() {
+if (s_logger.isInfoEnabled()) {
+s_logger.info("Stopping Alert Manager");
--- End diff --

This log message seems deceptive.  This class is about quota statements not 
alerts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46782964
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/QuotaStatementImpl.java ---
@@ -0,0 +1,376 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import 
org.apache.cloudstack.quota.QuotaAlertManagerImpl.DeferredQuotaEmail;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.user.AccountVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.component.ManagerBase;
+
+@Component
+@Local(value = QuotaStatement.class)
+public class QuotaStatementImpl extends ManagerBase implements 
QuotaStatement {
+private static final Logger s_logger = 
Logger.getLogger(QuotaStatementImpl.class);
+
+@Inject
+private AccountDao _accountDao;
+@Inject
+private QuotaAccountDao _quotaAcc;
+@Inject
+private QuotaUsageDao _quotaUsage;
+@Inject
+private QuotaAlertManager _quotaAlert;
+@Inject
+private ConfigurationDao _configDao;
+
+final public static int s_LAST_STATEMENT_SENT_DAYS = 6; //ideally 
should be less than 7 days
+
+public enum STATEMENT_PERIODS {
+BIMONTHLY, MONTHLY, QUATERLY, HALFYEARLY, YEARLY
+};
+
+private STATEMENT_PERIODS _period = STATEMENT_PERIODS.MONTHLY;
+
+public QuotaStatementImpl() {
+super();
+}
+
+private void mergeConfigs(Map dbParams, Map xmlParams) {
+for (Map.Entry param : xmlParams.entrySet()) {
+dbParams.put(param.getKey(), (String)param.getValue());
+}
+}
+
+@Override
+public boolean configure(String name, Map params) 
throws ConfigurationException {
+super.configure(name, params);
+
+Map configs = _configDao.getConfiguration(params);
+
+if (params != null) {
+mergeConfigs(configs, params);
+}
+String period_str = 
configs.get(QuotaConfig.QuotaStatementPeriod.key());
+int period = period_str == null ? 1 : Integer.valueOf(period_str);
+
+STATEMENT_PERIODS _period = STATEMENT_PERIODS.values()[period];
+return true;
+}
+
+@Override
+public boolean start() {
+if (s_logger.isInfoEnabled()) {
+s_logger.info("Starting Alert Manager");
--- End diff --

This log message seems deceptive.  This class is about quota statements not 
alerts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46782245
  
--- Diff: 
framework/quota/src/org/apache/cloudstack/quota/QuotaAlertManagerImpl.java ---
@@ -0,0 +1,408 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.quota;
+
+import com.cloud.domain.DomainVO;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.user.Account;
+import com.cloud.user.Account.State;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.user.dao.UserDao;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.db.TransactionLegacy;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.google.common.base.Strings;
+import com.sun.mail.smtp.SMTPMessage;
+import com.sun.mail.smtp.SMTPSSLTransport;
+import com.sun.mail.smtp.SMTPTransport;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.quota.constant.QuotaConfig;
+import 
org.apache.cloudstack.quota.constant.QuotaConfig.QuotaEmailTemplateTypes;
+import org.apache.cloudstack.quota.dao.QuotaAccountDao;
+import org.apache.cloudstack.quota.dao.QuotaEmailTemplatesDao;
+import org.apache.cloudstack.quota.dao.QuotaUsageDao;
+import org.apache.cloudstack.quota.vo.QuotaAccountVO;
+import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
+import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.URLName;
+import javax.mail.internet.InternetAddress;
+import javax.naming.ConfigurationException;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+@Component
+@Local(value = QuotaAlertManager.class)
+public class QuotaAlertManagerImpl extends ManagerBase implements 
QuotaAlertManager {
+private static final Logger s_logger = 
Logger.getLogger(QuotaAlertManagerImpl.class);
+
+@Inject
+private AccountDao _accountDao;
+@Inject
+private QuotaAccountDao _quotaAcc;
+@Inject
+private UserDao _userDao;
+@Inject
+private DomainDao _domainDao;
+@Inject
+private QuotaEmailTemplatesDao _quotaEmailTemplateDao;
+@Inject
+private ConfigurationDao _configDao;
+@Inject
+private QuotaUsageDao _quotaUsage;
+
+private EmailQuotaAlert _emailQuotaAlert;
+private boolean _lockAccountEnforcement = false;
+
+boolean _smtpDebug = false;
+
+public QuotaAlertManagerImpl() {
+super();
+}
+
+private void mergeConfigs(Map dbParams, Map xmlParams) {
+for (Map.Entry param : xmlParams.entrySet()) {
+dbParams.put(param.getKey(), (String)param.getValue());
+}
+}
+
+@Override
+public boolean configure(String name, Map params) 
throws ConfigurationException {
+super.configure(name, params);
+
+Map configs = _configDao.getConfiguration(params);
+
+if (params != null) {
+mergeConfigs(configs, params);
+}
+
+final String smtpHost = 
configs.get(QuotaConfig.QuotaSmtpHost.key());
+int smtpPort = 
NumbersUtil.parseInt(configs.get(QuotaConfig.QuotaSmtpPort.key()), 25);
+String useAuthStr = 
configs.get(QuotaConfig.Quot

[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46777893
  
--- Diff: framework/db/src/com/cloud/utils/db/Transaction.java ---
@@ -35,18 +35,15 @@
 if (currentTxn != null) {
 databaseId = currentTxn.getDatabaseId();
 }
-TransactionLegacy txn = TransactionLegacy.open(name, databaseId, 
false);
-try {
-//if (txn.dbTxnStarted()){
-//String warnMsg = "Potential Wrong Usage: 
TRANSACTION.EXECUTE IS WRAPPED INSIDE ANOTHER DB TRANSACTION!";
-//s_logger.warn(warnMsg, new 
CloudRuntimeException(warnMsg));
-//}
+try (final TransactionLegacy txn = TransactionLegacy.open(name, 
databaseId, false)) {
+// if (txn.dbTxnStarted()){
+// String warnMsg = "Potential Wrong Usage: 
TRANSACTION.EXECUTE IS WRAPPED INSIDE ANOTHER DB TRANSACTION!";
+// s_logger.warn(warnMsg, new CloudRuntimeException(warnMsg));
+// }
--- End diff --

Please remove crufty commented code.  git history/bisect is a far better 
tool to understand the evolution of code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r4633
  
--- Diff: engine/schema/src/com/cloud/usage/UsageVO.java ---
@@ -328,4 +339,48 @@ public Date getStartDate() {
 public Date getEndDate() {
 return endDate;
 }
+
+public void setId(Long id) {
+this.id = id;
+}
+
+public void setType(String type) {
+this.type = type;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Since Date instances are mutable, the ``this.startDate`` should be a copy 
of ``startDate`` to avoid side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r4638
  
--- Diff: engine/schema/src/com/cloud/usage/UsageVO.java ---
@@ -328,4 +339,48 @@ public Date getStartDate() {
 public Date getEndDate() {
 return endDate;
 }
+
+public void setId(Long id) {
+this.id = id;
+}
+
+public void setType(String type) {
+this.type = type;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff --

Since Date instances are mutable, the ``this.endDate`` should be a copy of 
``endDate`` to avoid side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r4624
  
--- Diff: engine/schema/src/com/cloud/upgrade/dao/Upgrade461to470.java ---
@@ -51,8 +53,23 @@ public boolean supportsRollingUpgrade() {
 return new File[] {new File(script)};
 }
 
+public void alterAddColumnToCloudUsage(final Connection conn) {
+final String alterTableSql = "ALTER TABLE 
`cloud_usage`.`cloud_usage` ADD COLUMN `quota_calculated` tinyint(1) DEFAULT 0 
NOT NULL COMMENT 'quota calculation status'";
+try (PreparedStatement pstmt = 
conn.prepareStatement(alterTableSql)) {
+pstmt.executeUpdate();
+s_logger.info("Altered usage table and added column 
quota_calculated");
+} catch (SQLException e) {
+if (e.getMessage().contains("quota_calculated")) {
+s_logger.warn("Usage table already has a column called 
quota_calculated");
--- End diff --

The log statement to should reflect the actual name of table, cloud_usage, 
altered in order to avoid ambiguity.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r4622
  
--- Diff: engine/schema/src/com/cloud/upgrade/dao/Upgrade461to470.java ---
@@ -51,8 +53,23 @@ public boolean supportsRollingUpgrade() {
 return new File[] {new File(script)};
 }
 
+public void alterAddColumnToCloudUsage(final Connection conn) {
+final String alterTableSql = "ALTER TABLE 
`cloud_usage`.`cloud_usage` ADD COLUMN `quota_calculated` tinyint(1) DEFAULT 0 
NOT NULL COMMENT 'quota calculation status'";
+try (PreparedStatement pstmt = 
conn.prepareStatement(alterTableSql)) {
+pstmt.executeUpdate();
+s_logger.info("Altered usage table and added column 
quota_calculated");
--- End diff --

The log statement to should reflect the actual name of table, 
``cloud_usage``, altered in order to avoid ambiguity.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46777696
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
--- End diff --

Since ``Date`` instances are mutable, the ``this.endDate`` should be a copy 
of ``endDate`` to avoid side-effects.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Quota

2015-12-06 Thread jburwell
Github user jburwell commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/768#discussion_r46777687
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java 
---
@@ -111,6 +111,30 @@ public Long getProjectId() {
 public String getUsageId() {
 return usageId;
 }
+public void setAccountName(String accountName) {
+this.accountName = accountName;
+}
+
+public void setDomainId(Long domainId) {
+this.domainId = domainId;
+}
+
+public void setEndDate(Date endDate) {
+this.endDate = endDate;
+}
+
+public void setStartDate(Date startDate) {
+this.startDate = startDate;
--- End diff --

Since ``Date`` instances are mutable, the ``this.startDate`` should be a 
copy of ``startDate``.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CID-1338387: remove logicless execution c...

2015-12-06 Thread rafaelweingartner
Github user rafaelweingartner commented on the pull request:

https://github.com/apache/cloudstack/pull/1056#issuecomment-162353745
  
@DaanHoogland PR #1124 rebased on top of master.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-8841: Storage XenMotion from X...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/815#issuecomment-162346266
  
Pinging @DaanHoogland to review. Will run some tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-8847: ListServiceOfferings is ...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/823#issuecomment-162346076
  
Pinging @DaanHoogland to review.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-8858: listVolumes API fails fo...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/830#issuecomment-162345934
  
PIng @DaanHoogland can you review this please? I'll run some tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CID-1338387: remove logicless execution c...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1056#issuecomment-162345306
  
@rafaelweingartner you better read #1177, part of #1124 will no longer 
merge cleanly because of the ovm3 changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Update JuniperSrxResource.java

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1148#issuecomment-162344831
  
@wenwenxiong can you add tests and or test data to this? any combination of
- unit tests
- marvin tests
- test procedure

thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-8968: UI icon over VM snapshot...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1150#discussion_r46775285
  
--- Diff: ui/scripts/instanceWizard.js ---
@@ -731,25 +746,33 @@
 
 //step 1 : select zone
 $.extend(deployVmData, {
-zoneid : args.data.zoneid
+zoneid : selectedZoneObj.id
 });
 
 //step 2: select template
-$.extend(deployVmData, {
-templateid : args.data.templateid
-});
+if (snapshotObjs) {
+$.extend(deployVmData, {
+vmsnapshotid : selectedSnapshotObj.id
+});
+}
+else {
+$.extend(deployVmData, {
+templateid : args.data.templateid
+});
+}
 
 $.extend(deployVmData, {
 hypervisor : selectedHypervisor
 });
 
-if 
(args.$wizard.find('input[name=rootDiskSize]').parent().css('display') != 
'none')  {
-if 
(args.$wizard.find('input[name=rootDiskSize]').val().length > 0) {
-$.extend(deployVmData, {
-rootdisksize : 
args.$wizard.find('input[name=rootDiskSize]').val()
-});
-}
-}
+//Currently it is not supporting in backend
+//if 
(args.$wizard.find('input[name=rootDiskSize]').parent().css('display') != 
'none')  {
--- End diff --

please do not leave code commented in. this block should be deleted.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Add support for not (re)starting server a...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/1162#issuecomment-162342893
  
@DaanHoogland That makes no sense. We should build RPMs and install mgt 
server from it and test both the new and existing features. The integration 
tests do not hit this code as far as I know.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Fixed issues with test_vpc_vpn script

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/1156#issuecomment-162342696
  
@sanju1010 Thanks for the PR. Can you make it PEP8 compliant again please?

Most tests seem to create the offering the test needs. Isn't that a better 
idea?

I will run your version of the test. The previous one always succeeds for 
me, but I agree with the hypervisor specific part. That should be generic.

Will run it and report back.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9099: SecretKey is returned fr...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1152#issuecomment-162342597
  
@kansal looking forward to your update. your intended change makes sense


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9099: SecretKey is returned fr...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1152#discussion_r46775072
  
--- Diff: api/src/com/cloud/user/AccountService.java ---
@@ -136,4 +140,6 @@ void checkAccess(Account account, AccessType 
accessType, boolean sameOwner, Stri
  */
 UserAccount getUserAccountById(Long userId);
 
+public String[] getKeys(ListKeysCmd cmd);
--- End diff --

I agree with @jburwell 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9106 - As a Developer I want t...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/1179#issuecomment-162342338
  
Run this test: `nosetests --with-marvin --marvin-config=${marvinCfg} -s -a 
tags=advanced,required_hardware=true smoke/test_privategw_acl.py`

Result:

```
test_01_vpc_privategw_acl 
(integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: 
test_01_vpc_privategw_acl | Status : SUCCESS ===
ok
test_02_vpc_privategw_static_routes 
(integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: 
test_02_vpc_privategw_static_routes | Status : SUCCESS ===
ok
test_03_rvpc_privategw_static_routes 
(integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: 
test_03_rvpc_privategw_static_routes | Status : SUCCESS ===
ok

--
Ran 3 tests in 2057.520s

OK
```

Nice work @wilderrodrigues !


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9074: Support shared networkin...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/1094#issuecomment-162342223
  
Guys, I cannot build a cloud from this branch any more. The build itself 
works, but the database deployment gives an SQL error: `Can't DROP 
'logicalrouter_uuid'; check that column/key exists`

Details:

```
[INFO] --- exec-maven-plugin:1.2.1:java (create-schema) @ cloud-developer 
---
log4j:WARN No appenders could be found for logger 
(org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
more info.
> WARNING: Provided file does not exist: 
/data/git/cs1/cloudstack/developer/../utils/conf/db.properties.override
> WARNING: Provided file does not exist: 
/data/git/cs1/cloudstack/developer/developer-prefill.sql.override
> Initializing database=cloud with host=localhost port=3306 
username=cloud password=cloud
> Running query: drop database if exists `cloud`
> Running query: create database `cloud`
> Running query: GRANT ALL ON cloud.* to 'cloud'@`localhost` 
identified by 'cloud'
> Running query: GRANT ALL ON cloud.* to 'cloud'@`%` identified 
by 'cloud'
> Initializing database=cloud_usage with host=localhost port=3306 
username=cloud password=cloud
> Running query: drop database if exists `cloud_usage`
> Running query: create database `cloud_usage`
> Running query: GRANT ALL ON cloud_usage.* to 
'cloud'@`localhost` identified by 'cloud'
> Running query: GRANT ALL ON cloud_usage.* to 'cloud'@`%` 
identified by 'cloud'
> Processing SQL file at 
/data/git/cs1/cloudstack/developer/target/db/create-schema.sql
> Processing SQL file at 
/data/git/cs1/cloudstack/developer/target/db/create-schema-premium.sql
> Processing SQL file at 
/data/git/cs1/cloudstack/developer/target/db/templates.sql
> Processing SQL file at 
/data/git/cs1/cloudstack/developer/developer-prefill.sql
> Processing upgrade: com.cloud.upgrade.DatabaseUpgradeChecker
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to 
execute upgrade script: 
/data/git/cs1/cloudstack/developer/target/db/db/schema-410to420-cleanup.sql
at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:290)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:425)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:474)
at com.cloud.upgrade.DatabaseCreator.main(DatabaseCreator.java:217)
... 6 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Can't 
DROP 'logicalrouter_uuid'; check that column/key exists
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:281)
... 9 more
[INFO] 

[INFO] BUILD FAILURE
[INFO] 

[INFO] Total time: 19.639s (Wall Clock)
[INFO] Finished at: Sun Dec 06 09:07:53 GMT 2015
[INFO] Final Memory: 43M/259M
[INFO] 

[ERROR] Failed to execute goal 
org.codehaus.mojo:exec-maven-plugin:1.2.1:java (create-schema) on project 
cloud-developer: An exception occured while executing the Java class. null: 
InvocationTargetException: Unable to execute upgrade script: 
/data/git/cs1/cloudstack/developer/target/db/db/schema-410to420-cleanup.sql: 
Can't DROP 'logicalrouter_uuid'; check that column/key exists -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, 
please read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoEx

[GitHub] cloudstack pull request: CLOUDSTACK-9025: Fixed can't create usabl...

2015-12-06 Thread ustcweizhou
Github user ustcweizhou commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1176#discussion_r46774983
  
--- Diff: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java ---
@@ -185,7 +185,8 @@ public boolean trackVmHostChange() {
 DataTO srcData = cpyCommand.getSrcTO();
 DataTO destData = cpyCommand.getDestTO();
 
-if (srcData.getObjectType() == DataObjectType.SNAPSHOT && 
destData.getObjectType() == DataObjectType.TEMPLATE) {
+if (srcData.getHypervisorType() == HypervisorType.XenServer && 
srcData.getObjectType() == DataObjectType.SNAPSHOT &&
--- End diff --

ok, cool


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: Add support for not (re)starting server a...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1162#issuecomment-162341391
  
lgtm
@remibergsma can you schedule a regression?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9106 - As a Developer I want t...

2015-12-06 Thread remibergsma
Github user remibergsma commented on the pull request:

https://github.com/apache/cloudstack/pull/1179#issuecomment-162341294
  
@DaanHoogland Yes, sir! See linked PR above.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9104: VM naming convention in ...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1165#issuecomment-162341273
  
@priyankparihar I do not know any vmware users
@bhaisaab Do you have any insight on this change? or do you know any 
candidate reviewer for this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9105: Logging enhancement: Han...

2015-12-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1167


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: [4.6/master] rate-limit: increase JVM mem...

2015-12-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1175


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: [4.6/master] rate-limit: increase JVM mem...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1175#issuecomment-162340165
  
lgtm merging


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9025: Fixed can't create usabl...

2015-12-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1176


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CID-1338387: remove logicless execution c...

2015-12-06 Thread rafaelweingartner
Github user rafaelweingartner commented on the pull request:

https://github.com/apache/cloudstack/pull/1056#issuecomment-162339992
  
Actually, the one that obsoleted this is #1124


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request: CLOUDSTACK-9054 use of google-optional as...

2015-12-06 Thread DaanHoogland
Github user DaanHoogland commented on the pull request:

https://github.com/apache/cloudstack/pull/1060#issuecomment-162339782
  
@rafaelweingartner we still allow for 1.7 so no 1.8 only features for now


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


  1   2   >