You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/11/11 18:21:46 UTC

[19/21] incubator-brooklyn git commit: Replaced UUID.randomUUID() with Identifiers.makeRandomId(8)

Replaced UUID.randomUUID() with Identifiers.makeRandomId(8)


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

Branch: refs/heads/master
Commit: 5f044578a6afc1589195f9fe6b0e226f4d9bc6cb
Parents: 840482f
Author: Mark McKenna <m4...@gmail.com>
Authored: Wed Nov 11 15:21:00 2015 +0000
Committer: Mark McKenna <m4...@gmail.com>
Committed: Wed Nov 11 15:21:00 2015 +0000

----------------------------------------------------------------------
 .../brooklyn/test/framework/TestEffectorTest.java   |  5 ++---
 .../brooklyn/test/framework/TestSensorTest.java     | 16 ++++++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5f044578/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestEffectorTest.java
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestEffectorTest.java b/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestEffectorTest.java
index 65c7aa0..c59ac03 100644
--- a/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestEffectorTest.java
+++ b/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestEffectorTest.java
@@ -9,12 +9,11 @@ import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.test.entity.TestApplication;
 import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
 import org.apache.brooklyn.test.framework.entity.TestEntity;
+import org.apache.brooklyn.util.text.Identifiers;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import java.util.UUID;
-
 import static org.assertj.core.api.Assertions.assertThat;
 
 /**
@@ -29,7 +28,7 @@ public class TestEffectorTest {
 
     @BeforeMethod
     public void setup() {
-        testId = UUID.randomUUID().toString();
+        testId = Identifiers.makeRandomId(8);
         app = TestApplication.Factory.newManagedInstanceForTests();
         managementContext = app.getManagementContext();
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5f044578/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java b/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java
index 0b653eb..810768c 100644
--- a/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java
+++ b/usage/test-framework/src/test/java/org/apache/brooklyn/test/framework/TestSensorTest.java
@@ -12,12 +12,12 @@ import org.apache.brooklyn.core.test.entity.TestApplication;
 import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.exceptions.PropagatedRuntimeException;
+import org.apache.brooklyn.util.text.Identifiers;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import java.util.UUID;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -37,7 +37,7 @@ public class TestSensorTest {
 
     @BeforeMethod
     public void setup() {
-        testId = UUID.randomUUID().toString();
+        testId = Identifiers.makeRandomId(8);
         app = TestApplication.Factory.newManagedInstanceForTests();
         managementContext = app.getManagementContext();
         loc = managementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
@@ -166,7 +166,7 @@ public class TestSensorTest {
     @Test
     public void testAssertRegex() {
         final long time = System.currentTimeMillis();
-        final String sensorValue = String.format("%s%s%s", UUID.randomUUID().toString(), time, UUID.randomUUID().toString());
+        final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), time, Identifiers.makeRandomId(8));
 
         //Add Sensor Test for STRING sensor
         app.createAndManageChild(EntitySpec.create(TestSensor.class)
@@ -189,13 +189,13 @@ public class TestSensorTest {
     @Test
     public void testAssertRegexFail() {
         boolean sensorTestFail = false;
-        final String sensorValue = String.format("%s%s%s", UUID.randomUUID().toString(), System.currentTimeMillis(), UUID.randomUUID().toString());
+        final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), System.currentTimeMillis(), Identifiers.makeRandomId(8));
 
         //Add Sensor Test for STRING sensor
         app.createAndManageChild(EntitySpec.create(TestSensor.class)
                 .configure(TestSensor.TARGET_ENTITY, app)
                 .configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName())
-                .configure(TestSensor.ASSERTIONS, ImmutableMap.of("regex", String.format(".*%s.*", UUID.randomUUID().toString()))));
+                .configure(TestSensor.ASSERTIONS, ImmutableMap.of("regex", String.format(".*%s.*", Identifiers.makeRandomId(8)))));
 
         //Set STRING sensor
         app.sensors().set(STRING_SENSOR, sensorValue);
@@ -215,13 +215,13 @@ public class TestSensorTest {
     @Test
     public void testAssertRegexOnNullSensor() {
         boolean sensorTestFail = false;
-        final String sensorValue = String.format("%s%s%s", UUID.randomUUID().toString(), System.currentTimeMillis(), UUID.randomUUID().toString());
+        final String sensorValue = String.format("%s%s%s", Identifiers.makeRandomId(8), System.currentTimeMillis(), Identifiers.makeRandomId(8));
 
         //Add Sensor Test for STRING sensor
         app.createAndManageChild(EntitySpec.create(TestSensor.class)
                 .configure(TestSensor.TARGET_ENTITY, app)
                 .configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName())
-                .configure(TestSensor.ASSERTIONS, ImmutableMap.of("regex", String.format(".*%s.*", UUID.randomUUID().toString()))));
+                .configure(TestSensor.ASSERTIONS, ImmutableMap.of("regex", String.format(".*%s.*", Identifiers.makeRandomId(8)))));
 
         try {
             app.start(ImmutableList.of(loc));
@@ -254,7 +254,7 @@ public class TestSensorTest {
         private final String id;
 
         public TestObject() {
-            id = UUID.randomUUID().toString();
+            id = Identifiers.makeRandomId(8);
         }
 
         public String getId() {