brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #690: External ip config for winrm byon locatio...
Date Thu, 25 May 2017 09:31:30 GMT
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/690#discussion_r118441832
  
    --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WinRmMachineLocationExternalConfigYamlTest.java
---
    @@ -89,9 +94,36 @@ public void testWindowsMachinesNoPasswordExternalProvider() throws
Exception {
     
             BasicApplication app = (BasicApplication) createAndStartApplication(yaml);
             waitForApplicationTasks(app);
    +        assertNull(RecordingWinRmTool.constructorProps.get(0).get(WinRmMachineLocation.USER.getName()));
             assertNull(RecordingWinRmTool.constructorProps.get(0).get(WinRmMachineLocation.PASSWORD.getName()));
         }
     
    +    @Test()
    +    public void testWindowsMachinesNoExternalIPProvider() throws Exception {
    +        RecordingWinRmTool.constructorProps.clear();
    +        final String yaml = Joiner.on("\n").join("location:",
    +                "  byon:",
    +                "    hosts:",
    +                "    - winrm: $brooklyn:external(\"inPlaceSupplier1\", \"ipEmpty\")",
    +                "      user: $brooklyn:external(\"inPlaceSupplier1\", \"byonUserEmpty\")",
    +                "      brooklyn.winrm.config.winrmToolClass: org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool",
    +                "      password: $brooklyn:external(\"inPlaceSupplier1\", \"byonPasswordddd\")",
    +                "      osFamily: windows",
    +                "services:",
    +                "- type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess",
    +                "  brooklyn.config:",
    +                "    launch.command: echo launch",
    +                "    checkRunning.command: echo running");
    +
    +        try {
    +            BasicApplication app = (BasicApplication) createAndStartApplication(yaml);
    +            waitForApplicationTasks(app);
    +            Asserts.shouldHaveFailedPreviously();
    +        } catch (Exception e) {
    +            Asserts.expectedFailureOfType(e, NullPointerException.class);
    --- End diff --
    
    It's bad if we are throwing null pointer exceptions - these should be caught lower in
the code and at least turned into something more useful with a useful error message that you
can then test in here.  For example use  `Preconditions.checkArgument` on whatever is throwing
the NPE.


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