Adjusting the test to take into account the new length

Name max length is set to 9, because the constructed name will look
  like "br-ntsb50"
  br - 2 chars
  dash (-) - 1 char
  timeStamp - 6 chars

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/7923aa7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/7923aa7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/7923aa7c

Branch: refs/heads/master
Commit: 7923aa7c061c74e3615895314a2cea2ebc911ff3
Parents: dee6481
Author: Yavor Yanchev <[email protected]>
Authored: Fri Aug 28 12:07:24 2015 +0300
Committer: Yavor Yanchev <[email protected]>
Committed: Fri Aug 28 12:07:24 2015 +0300

----------------------------------------------------------------------
 .../brooklyn/core/location/cloud/CloudMachineNamerTest.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7923aa7c/core/src/test/java/org/apache/brooklyn/core/location/cloud/CloudMachineNamerTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/brooklyn/core/location/cloud/CloudMachineNamerTest.java
 
b/core/src/test/java/org/apache/brooklyn/core/location/cloud/CloudMachineNamerTest.java
index 4ebaaec..0759114 100644
--- 
a/core/src/test/java/org/apache/brooklyn/core/location/cloud/CloudMachineNamerTest.java
+++ 
b/core/src/test/java/org/apache/brooklyn/core/location/cloud/CloudMachineNamerTest.java
@@ -113,9 +113,13 @@ public class CloudMachineNamerTest {
         ConfigBag cfg = new ConfigBag()
             .configure(CloudLocationConfig.CALLER_CONTEXT, child);
         BasicCloudMachineNamer namer = new BasicCloudMachineNamer();
-        namer.setDefaultMachineNameMaxLength(10);
+        // name max length is set to 9, because the constructed name will look 
like "br-ntsb50"
+        // br - 2 chars
+        // dash (-) - 1 char
+        // timeStamp - 6 chars
+        namer.setDefaultMachineNameMaxLength(2 + 1 + 6);
         String result = namer.generateNewMachineUniqueName(cfg);
-        Assert.assertEquals(result.length(), 10);
+        Assert.assertEquals(result.length(), 2 + 1 + 6);
     }
     
     @Test

Reply via email to