brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Entitlements
Date Tue, 20 Jan 2015 12:25:44 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/414#discussion_r23218470
  
    --- Diff: core/src/test/java/brooklyn/management/entitlement/AcmeEntitlementManagerTest.java
---
    @@ -21,132 +21,38 @@
     import java.net.URI;
     
     import org.testng.Assert;
    -import org.testng.annotations.AfterMethod;
    -import org.testng.annotations.BeforeMethod;
     import org.testng.annotations.Test;
     
    -import com.google.common.collect.ImmutableList;
    -
    -import brooklyn.config.BrooklynProperties;
    -import brooklyn.entity.Application;
    -import brooklyn.entity.basic.ApplicationBuilder;
    -import brooklyn.entity.basic.BasicApplication;
    -import brooklyn.entity.basic.Entities;
    -import brooklyn.entity.proxying.EntitySpec;
    -import brooklyn.location.Location;
    -import brooklyn.management.ManagementContext;
     import brooklyn.management.entitlement.Entitlements.EntityAndItem;
    -import brooklyn.test.entity.LocalManagementContextForTests;
    -import brooklyn.util.config.ConfigBag;
    -import brooklyn.util.exceptions.Exceptions;
    -
    -public class AcmeEntitlementManagerTest {
     
    -    ManagementContext mgmt;
    -    Application app;
    -    ConfigBag configBag;
    -    
    -    public void setup(ConfigBag cfg) {
    -        mgmt = new LocalManagementContextForTests(BrooklynProperties.Factory.newEmpty().addFrom(cfg));
    -        app = ApplicationBuilder.newManagedApp(EntitySpec.create(BasicApplication.class),
mgmt);
    -    }
    +public class AcmeEntitlementManagerTest extends AcmeEntitlementManagerTestFixture {
     
    -    @BeforeMethod(alwaysRun=true)
    -    public void init() {
    -        Entitlements.clearEntitlementContext();
    -        configBag = ConfigBag.newInstance();
    +    protected void addGlobalConfig() {
             configBag.put(Entitlements.GLOBAL_ENTITLEMENT_MANAGER, AcmeEntitlementManager.class.getName());
         }
     
    -    @AfterMethod(alwaysRun=true)
    -    public void tearDown() {
    -        Entitlements.clearEntitlementContext();
    -        if (app != null) Entities.destroyAll(app.getManagementContext());
    -        if (mgmt != null) Entities.destroyAll(mgmt);
    -        app = null;
    -        mgmt = null;
    +    @Test
    +    public void testAnonUserHasAllPermissions() {
    +        checkUserHasAllPermissions("anon");
    --- End diff --
    
    `root` was the default. have changed `anon` to `otherAuthorizedUser` so it's less surprising


---
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.
---

Mime
View raw message