brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [2/7] brooklyn-server git commit: AbstractPerformanceTest to extends BrooklynAppUnitTestSupport
Date Mon, 19 Jun 2017 12:31:10 GMT
AbstractPerformanceTest to extends BrooklynAppUnitTestSupport

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

Branch: refs/heads/master
Commit: ffd799eba6f5768383f1fe651515d39450a2f942
Parents: bfc66f7
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Jun 6 11:21:25 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Fri Jun 16 13:31:23 2017 +0100

----------------------------------------------------------------------
 .../qa/performance/AbstractPerformanceTest.java | 34 ++++++++++++--------
 .../BlobStorePersistencePerformanceTest.java    |  4 +++
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ffd799eb/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
index d6b77d3..ab6978d 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
@@ -23,18 +23,15 @@ import static org.testng.Assert.assertTrue;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
+import org.apache.brooklyn.core.internal.BrooklynProperties;
 import org.apache.brooklyn.core.location.SimulatedLocation;
-import org.apache.brooklyn.core.test.entity.TestApplication;
+import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
 import org.apache.brooklyn.test.performance.PerformanceMeasurer;
 import org.apache.brooklyn.test.performance.PerformanceTestDescriptor;
 import org.apache.brooklyn.test.performance.PerformanceTestResult;
 import org.apache.brooklyn.util.internal.DoubleSystemProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
 import com.google.common.base.Stopwatch;
@@ -50,7 +47,7 @@ import com.google.common.base.Stopwatch;
  * We are also not running the tests for long enough to check if object creation is going
to kill
  * performance in the long-term, etc.
  */
-public class AbstractPerformanceTest {
+public class AbstractPerformanceTest extends BrooklynAppUnitTestSupport {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractPerformanceTest.class);
     
@@ -68,21 +65,30 @@ public class AbstractPerformanceTest {
     
     protected static final long TIMEOUT_MS = 10*1000;
     
-    protected TestApplication app;
     protected SimulatedLocation loc;
-    protected ManagementContext mgmt;
     
     @BeforeMethod(alwaysRun=true)
+    @Override
     public void setUp() throws Exception {
+        super.setUp();
         for (int i = 0; i < 5; i++) System.gc();
-        loc = new SimulatedLocation();
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
-        mgmt = app.getManagementContext();
+        loc = app.newSimulatedLocation();
+    }
+
+    @Override
+    protected BrooklynProperties getBrooklynProperties() {
+        if (useLiveManagementContext()) {
+            return BrooklynProperties.Factory.newDefault();
+        } else {
+            return BrooklynProperties.Factory.newEmpty();
+        }
     }
     
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws Exception {
-        if (app != null) Entities.destroyAll(app.getManagementContext());
+    /**
+     * For overriding; controls whether to load ~/.brooklyn/brooklyn.properties
+     */
+    protected boolean useLiveManagementContext() {
+        return false;
     }
 
     protected PerformanceTestResult measure(PerformanceTestDescriptor options) {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ffd799eb/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStorePersistencePerformanceTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStorePersistencePerformanceTest.java
b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStorePersistencePerformanceTest.java
index 2238385..70234d1 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStorePersistencePerformanceTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/core/mgmt/persist/jclouds/BlobStorePersistencePerformanceTest.java
@@ -42,6 +42,10 @@ public class BlobStorePersistencePerformanceTest extends AbstractPerformanceTest
     JcloudsBlobStoreBasedObjectStore objectStore;
     StoreObjectAccessor blobstoreAccessor;
     
+    protected boolean useLiveManagementContext() {
+        return true;
+    }
+
     @BeforeMethod(alwaysRun=true)
     @Override
     public void setUp() throws Exception {


Mime
View raw message