2424import org .apache .brooklyn .core .test .entity .LocalManagementContextForTests ;
2525import org .apache .brooklyn .entity .stock .BasicApplication ;
2626import org .apache .brooklyn .location .winrm .WinRmMachineLocation ;
27+ import org .apache .brooklyn .test .Asserts ;
2728import org .apache .brooklyn .util .core .internal .winrm .RecordingWinRmTool ;
2829import org .slf4j .Logger ;
2930import org .slf4j .LoggerFactory ;
@@ -69,7 +70,7 @@ public void testWindowsMachinesExternalProvider() throws Exception {
6970
7071 BasicApplication app = (BasicApplication ) createAndStartApplication (yaml );
7172 waitForApplicationTasks (app );
72- assertEquals (RecordingWinRmTool .constructorProps .get (0 ).get (WinRmMachineLocation . ADDRESS . getName () ), "127.0.0.1" );
73+ assertEquals (RecordingWinRmTool .constructorProps .get (0 ).get ("host" ), "127.0.0.1" );
7374 assertEquals (RecordingWinRmTool .constructorProps .get (0 ).get (WinRmMachineLocation .USER .getName ()), "admin" );
7475 assertEquals (RecordingWinRmTool .constructorProps .get (0 ).get (WinRmMachineLocation .PASSWORD .getName ()), "passw0rd" );
7576 }
@@ -80,7 +81,7 @@ public void testWindowsMachinesNoExternalProvider() throws Exception {
8081 final String yaml = Joiner .on ("\n " ).join ("location:" ,
8182 " byon:" ,
8283 " hosts:" ,
83- " - winrm: $brooklyn:external( \" inPlaceSupplier1 \" , \" ipEmpty \" ) " ,
84+ " - winrm: 127.0.0.1 " ,
8485 " user: $brooklyn:external(\" inPlaceSupplier1\" , \" byonUserEmpty\" )" ,
8586 " brooklyn.winrm.config.winrmToolClass: org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool" ,
8687 " password: $brooklyn:external(\" inPlaceSupplier1\" , \" byonPasswordddd\" )" ,
@@ -93,11 +94,36 @@ public void testWindowsMachinesNoExternalProvider() throws Exception {
9394
9495 BasicApplication app = (BasicApplication ) createAndStartApplication (yaml );
9596 waitForApplicationTasks (app );
96- assertNull (RecordingWinRmTool .constructorProps .get (0 ).get (WinRmMachineLocation .ADDRESS .getName ()));
9797 assertNull (RecordingWinRmTool .constructorProps .get (0 ).get (WinRmMachineLocation .USER .getName ()));
9898 assertNull (RecordingWinRmTool .constructorProps .get (0 ).get (WinRmMachineLocation .PASSWORD .getName ()));
9999 }
100100
101+ @ Test ()
102+ public void testWindowsMachinesNoExternalIPProvider () throws Exception {
103+ RecordingWinRmTool .constructorProps .clear ();
104+ final String yaml = Joiner .on ("\n " ).join ("location:" ,
105+ " byon:" ,
106+ " hosts:" ,
107+ " - winrm: $brooklyn:external(\" inPlaceSupplier1\" , \" ipEmpty\" )" ,
108+ " user: $brooklyn:external(\" inPlaceSupplier1\" , \" byonUserEmpty\" )" ,
109+ " brooklyn.winrm.config.winrmToolClass: org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool" ,
110+ " password: $brooklyn:external(\" inPlaceSupplier1\" , \" byonPasswordddd\" )" ,
111+ " osFamily: windows" ,
112+ "services:" ,
113+ "- type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess" ,
114+ " brooklyn.config:" ,
115+ " launch.command: echo launch" ,
116+ " checkRunning.command: echo running" );
117+
118+ try {
119+ BasicApplication app = (BasicApplication ) createAndStartApplication (yaml );
120+ waitForApplicationTasks (app );
121+ Asserts .shouldHaveFailedPreviously ();
122+ } catch (Exception e ) {
123+ Asserts .expectedFailureOfType (e , NullPointerException .class );
124+ }
125+ }
126+
101127 @ Override
102128 protected Logger getLogger () {
103129 return log ;
0 commit comments