cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-8562) User Definable Roles
Date Thu, 14 Apr 2016 22:15:25 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-8562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15242031#comment-15242031
] 

ASF GitHub Bot commented on CLOUDSTACK-8562:
--------------------------------------------

Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1489#discussion_r59800993
  
    --- Diff: api/test/org/apache/cloudstack/acl/RuleTest.java ---
    @@ -0,0 +1,39 @@
    +package org.apache.cloudstack.acl;
    +
    +import com.cloud.exception.InvalidParameterValueException;
    +import org.junit.Assert;
    +import org.junit.Test;
    +
    +import java.util.Arrays;
    +
    +public class RuleTest {
    +
    +    @Test
    +    public void testToString() throws Exception {
    +        Rule rule = new Rule("someString");
    +        Assert.assertEquals(rule.toString(), "someString");
    +    }
    +
    +    @Test
    +    public void testValidateRuleWithValidData() throws Exception {
    +        for (String rule : Arrays.asList("a", "1", "someApi", "someApi321", "123SomeApi",
    +                "prefix*", "*middle*", "*Suffix",
    +                "*", "**", "f***", "m0nk3yMa**g1c*")) {
    +            Assert.assertTrue(Rule.validate(rule));
    +            Assert.assertEquals(new Rule(rule).toString(), rule);
    +        }
    +    }
    +
    +    @Test
    +    public void testValidateRuleWithInvalidData() throws Exception {
    +        for (String rule : Arrays.asList(null, "", " ", "  ", "\n", "\t", "\r", "\"",
"\'",
    +                "^someApi$", "^someApi", "some$", "some-Api;", "some,Api",
    +                "^", "$", "^$", ".*", "\\w+", "r**l3rd0@Kr3", "j@s1n|+|0ȷ",
    +                "[a-z0-9-]+", "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$"))
{
    +            try {
    +                new Rule(rule);
    +                Assert.fail("Invalid rule, exception was expected");
    +            } catch (InvalidParameterValueException ignored) {}
    +        }
    --- End diff --
    
    This method can be simplified by removing the try-catch and added ``expected=InvalidParameterValueException.class``
to the ``@Test`` annotation.


> User Definable Roles
> --------------------
>
>                 Key: CLOUDSTACK-8562
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8562
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Management Server
>            Reporter: Paul Angus
>            Assignee: Rohit Yadav
>
> Static command.properties moved to database and made user definable



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message