You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by nnesic <gi...@git.apache.org> on 2015/12/08 16:55:08 UTC

[GitHub] cloudstack pull request: Changed UsageEventUtils to UsageEventEmit...

GitHub user nnesic opened a pull request:

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

    Changed UsageEventUtils to UsageEventEmitter and made it injectable

    Refactored code to make the UsageEventEmitter injectable. Fixed unit tests where required, but otherwise no changes in the logic of event emitting. 

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

    $ git pull https://github.com/greenqloud/cloudstack pr/destatic-usage-event-utils

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

    https://github.com/apache/cloudstack/pull/1191.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 #1191
    
----
commit dafaa9441d2e3a56fbb18ba781c050f91c916fc8
Author: nnesic <ne...@greenqloud.com>
Date:   2015-11-26T16:02:44Z

    Changed UsageEventUtils to UsageEventEmitter and made it injectable

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: Changed UsageEventUtils to UsageEventEmit...

Posted by ProjectMoon <gi...@git.apache.org>.
Github user ProjectMoon commented on the pull request:

    https://github.com/apache/cloudstack/pull/1191#issuecomment-209360865
  
    We need to re-submit this on 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: Changed UsageEventUtils to UsageEventEmit...

Posted by nnesic <gi...@git.apache.org>.
Github user nnesic closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: Changed UsageEventUtils to UsageEventEmit...

Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1191#discussion_r47435856
  
    --- Diff: server/test/org/apache/cloudstack/networkoffering/MockUsageEventEmitter.java ---
    @@ -0,0 +1,134 @@
    +package org.apache.cloudstack.networkoffering;
    +
    +import java.util.Map;
    +
    +import com.cloud.event.UsageEventEmitter;
    +
    +public class MockUsageEventEmitter implements UsageEventEmitter {
    +
    +    @Override
    +    public void publishUsageEvent(String paramString1, long paramLong1,
    +            long paramLong2, long paramLong3, String paramString2,
    +            Long paramLong4, Long paramLong5, Long paramLong6,
    +            String paramString3, String paramString4) {
    +        // TODO Auto-generated method stub
    --- End diff --
    
    this (type of) comment can be removed


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: Changed UsageEventUtils to UsageEventEmit...

Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1191#discussion_r47435785
  
    --- Diff: engine/components-api/src/com/cloud/event/UsageEventEmitterImpl.java ---
    @@ -38,44 +34,37 @@
     import com.cloud.event.dao.UsageEventDao;
     import com.cloud.user.Account;
     import com.cloud.user.dao.AccountDao;
    -import com.cloud.utils.component.ComponentContext;
     
    -public class UsageEventUtils {
     
    -    private static UsageEventDao s_usageEventDao;
    -    private static AccountDao s_accountDao;
    -    private static DataCenterDao s_dcDao;
    -    private static final Logger s_logger = Logger.getLogger(UsageEventUtils.class);
    -    protected static EventBus s_eventBus = null;
    -    protected static ConfigurationDao s_configDao;
    +public class UsageEventEmitterImpl implements UsageEventEmitter {
     
    +    private static final Logger s_logger = Logger.getLogger(UsageEventEmitterImpl.class);
    +
    +    @Inject
    +    UsageEventDao _usageEventDao;
    --- End diff --
    
    please do not prefix members with '_'


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: Changed UsageEventUtils to UsageEventEmit...

Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1191#discussion_r47435795
  
    --- Diff: engine/components-api/src/com/cloud/event/UsageEventEmitterImpl.java ---
    @@ -131,54 +127,55 @@ public static void publishUsageEvent(String usageType, long accountId, long zone
     
         }
     
    -    private static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId,
    +    private void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId,
             String resourceType, Map<String, String> details) {
             UsageEventVO usageEvent = new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType);
    -        s_usageEventDao.persist(usageEvent);
    -        s_usageEventDao.saveDetails(usageEvent.getId(), details);
    +        _usageEventDao.persist(usageEvent);
    --- End diff --
    
    please change to usageEventDao. no reason in morden days to use these prefixes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---