brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/3] incubator-brooklyn git commit: Tidy
Date Thu, 17 Dec 2015 11:17:57 GMT
Tidy


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

Branch: refs/heads/master
Commit: 1b7b5a831605ce734ed804ac416703542a24a8c8
Parents: 110d277
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Tue Dec 15 15:17:30 2015 +0000
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Tue Dec 15 15:17:30 2015 +0000

----------------------------------------------------------------------
 .../brooklyn/core/entity/EntityAsserts.java     |  2 -
 .../brooklyn/core/entity/EntityFunctions.java   | 16 +++----
 .../apache/brooklyn/core/feed/FeedConfig.java   | 44 ++++++++++++--------
 .../JettyWebAppFixtureIntegrationTest.java      |  8 ----
 ...omcatServerWebAppFixtureIntegrationTest.java | 24 +----------
 .../java/org/apache/brooklyn/test/Asserts.java  |  2 -
 6 files changed, 37 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b7b5a83/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
index 4641447..e78a1af 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java
@@ -191,8 +191,6 @@ public class EntityAsserts {
         });
     }
 
-
-
     /**
      * Assert that the given attribute of an entity does not take any of the disallowed values
during a given period.
      *

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b7b5a83/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
index 355c5b5..c65a176 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityFunctions.java
@@ -51,7 +51,7 @@ public class EntityFunctions {
             @Override public T apply(Entity input) {
                 return (input == null) ? null : input.getAttribute(attribute);
             }
-        };
+        }
         return new GetEntityAttributeFunction();
     }
     
@@ -63,7 +63,7 @@ public class EntityFunctions {
             @Override public T apply(Entity input) {
                 return (input == null) ? null : input.getConfig(key);
             }
-        };
+        }
         return new GetEntityConfigFunction();
     }
     
@@ -75,7 +75,7 @@ public class EntityFunctions {
             @Override public String apply(Entity input) {
                 return (input == null) ? null : input.getDisplayName();
             }
-        };
+        }
         return new GetEntityDisplayName();
     }
     
@@ -87,7 +87,7 @@ public class EntityFunctions {
             @Override public String apply(Identifiable input) {
                 return (input == null) ? null : input.getId();
             }
-        };
+        }
         return new GetIdFunction();
     }
 
@@ -154,7 +154,7 @@ public class EntityFunctions {
         @Override public T apply(Entity input) {
             return (input == null) ? null : input.getAttribute(attribute);
         }
-    };
+    }
 
     public static <T> Function<Object, T> attribute(Entity entity, AttributeSensor<T>
attribute) {
         return new GetFixedEntityAttributeFunction<>(entity, attribute);
@@ -186,7 +186,7 @@ public class EntityFunctions {
         @Override public T apply(Entity input) {
             return (input == null) ? null : input.getConfig(key);
         }
-    };
+    }
 
     public static Function<Entity, String> displayName() {
         return GetEntityDisplayName.INSTANCE;
@@ -197,7 +197,7 @@ public class EntityFunctions {
         @Override public String apply(Entity input) {
             return (input == null) ? null : input.getDisplayName();
         }
-    };
+    }
 
     public static Function<Identifiable, String> id() {
         return GetIdFunction.INSTANCE;
@@ -208,7 +208,7 @@ public class EntityFunctions {
         @Override public String apply(Identifiable input) {
             return (input == null) ? null : input.getId();
         }
-    };
+    }
 
 
     /** returns a function which sets the given sensors on the entity passed in,

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b7b5a83/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java b/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
index 4d06680..b9662ef 100644
--- a/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
+++ b/core/src/main/java/org/apache/brooklyn/core/feed/FeedConfig.java
@@ -122,6 +122,7 @@ public class FeedConfig<V, T, F extends FeedConfig<V, T, F>>
{
     public F checkSuccess(final Function<? super V,Boolean> val) {
         return checkSuccess(Functionals.predicate(val));
     }
+
     @SuppressWarnings("unused")
     /** @deprecated since 0.7.0, kept for rebind */ @Deprecated
     private F checkSuccessLegacy(final Function<? super V,Boolean> val) {
@@ -137,53 +138,63 @@ public class FeedConfig<V, T, F extends FeedConfig<V, T, F>>
{
         this.onsuccess = checkNotNull(val, "onSuccess");
         return self();
     }
-    
+
     public F setOnSuccess(T val) {
         return onSuccess(Functions.constant(val));
     }
-    
-    /** a failure is when the connection is fine (no exception) but the other end returns
a result object V 
-     * which the feed can tell indicates a failure (e.g. HTTP code 404) */
+
+    /**
+     * A failure is when the connection is fine (no exception) but the other end returns
a result object V
+     * which the feed can tell indicates a failure (e.g. HTTP code 404)
+     */
     public F onFailure(Function<? super V,T> val) {
         this.onfailure = checkNotNull(val, "onFailure");
         return self();
     }
 
+    /** @see #onFailure(Function) */
     public F setOnFailure(T val) {
         return onFailure(Functions.constant(val));
     }
 
-    /** registers a callback to be used {@link #onSuccess(Function)} and {@link #onFailure(Function)},

-     * i.e. whenever a result comes back, but not in case of exceptions being thrown (ie
problems communicating) */
+    /**
+     * Registers a callback to be used by {@link #onSuccess(Function)} and {@link #onFailure(Function)},
+     * i.e. whenever a result comes back, but not in case of exceptions being thrown (ie
problems communicating)
+     */
     public F onResult(Function<? super V, T> val) {
         onSuccess(val);
         return onFailure(val);
     }
 
+    /** @see #onResult(Function) */
     public F setOnResult(T val) {
         return onResult(Functions.constant(val));
     }
 
-    /** an exception is when there is an error in the communication */
+    /**
+     * An exception is when there is an error in the communication
+     */
     public F onException(Function<? super Exception,T> val) {
         this.onexception = checkNotNull(val, "onException");
         return self();
     }
-    
+
+    /** @see #onException(Function) */
     public F setOnException(T val) {
         return onException(Functions.constant(val));
     }
 
-    /** convenience for indicating a behaviour to occur for both
-     * {@link #onException(Function)}
-     * (error connecting) and 
-     * {@link #onFailure(Function)} 
-     * (successful communication but failure report from remote end) */
+    /**
+     * A convenience for indicating a behaviour to occur for both {@link #onException(Function)}
+     * (error connecting) and {@link #onFailure(Function)} (successful communication but
failure
+     * report from remote end)
+     */
     public F onFailureOrException(Function<Object,T> val) {
         onFailure(val);
         return onException(val);
     }
-    
+
+    /** @see #onFailureOrException(Function) */
     public F setOnFailureOrException(T val) {
         return onFailureOrException(Functions.constant(val));
     }
@@ -192,7 +203,7 @@ public class FeedConfig<V, T, F extends FeedConfig<V, T, F>>
{
         suppressDuplicates = val;
         return self();
     }
-    
+
     /**
      * Whether this feed is enabled (defaulting to true).
      */
@@ -200,7 +211,7 @@ public class FeedConfig<V, T, F extends FeedConfig<V, T, F>>
{
         enabled = val;
         return self();
     }
-    
+
     public boolean hasSuccessHandler() {
         return this.onsuccess != null;
     }
@@ -216,7 +227,6 @@ public class FeedConfig<V, T, F extends FeedConfig<V, T, F>>
{
     public boolean hasCheckSuccessHandler() {
         return this.checkSuccess != null;
     }
-
     
     @Override
     public String toString() {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b7b5a83/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/jetty/JettyWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/jetty/JettyWebAppFixtureIntegrationTest.java
b/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/jetty/JettyWebAppFixtureIntegrationTest.java
index f8d83c5..38b242b 100644
--- a/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/jetty/JettyWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/jetty/JettyWebAppFixtureIntegrationTest.java
@@ -55,13 +55,5 @@ public class JettyWebAppFixtureIntegrationTest extends AbstractWebAppFixtureInte
             String urlSubPathToPageToQuery) {
         super.testWarDeployAndUndeploy(entity, war, urlSubPathToWebApp, urlSubPathToPageToQuery);
     }
-    
-    public static void main(String ...args) throws Exception {
-        JettyWebAppFixtureIntegrationTest t = new JettyWebAppFixtureIntegrationTest();
-        t.setUp();
-        t.canStartAndStop((SoftwareProcess) t.basicEntities()[0][0]);
-        t.shutdownApp();
-        t.shutdownMgmt();
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b7b5a83/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
b/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
index 0d21d03..e824e26 100644
--- a/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
@@ -84,13 +84,13 @@ public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixt
     public void canStartAndStop(final SoftwareProcess entity) {
         super.canStartAndStop(entity);
     }
+
     @Test(groups = "Integration", dataProvider = "basicEntities")
     public void testReportsServiceDownWhenKilled(final SoftwareProcess entity) throws Exception
{
         super.testReportsServiceDownWhenKilled(entity);
     }
 
     @Override
-    // as parent, but with spring travel
     @DataProvider(name = "entitiesWithWarAndURL")
     public Object[][] entitiesWithWar() {
         TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
@@ -104,19 +104,6 @@ public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixt
                     "" // no sub-page path
                     });
         }
-
-        // TODO would be nice to test against spring web framework stock booking example
-        // but we'd need an external URL for that (we removed the binary from here for apache
compliance reasons)
-//        TestApplication tomcatApp = newTestApplication();
-//        TomcatServer tomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
-//                .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
-//        result.add(new Object[] {
-//                tomcat,
-//                "swf-booking-mvc.war",
-//                "swf-booking-mvc/",
-//                "spring/intro",
-//               });
-        
         return result.toArray(new Object[][] {});
     }
 
@@ -147,14 +134,7 @@ public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixt
                     .limitIterationsTo(25)
                     .run();
             
-            if (socketClosed == false) {
-//                log.error("WebApp did not shut down - this is a failure of the last test
run");
-//                log.warn("I'm sending a message to the shutdown port {}", shutdownPort);
-//                OutputStreamWriter writer = new OutputStreamWriter(shutdownSocket.getOutputStream());
-//                writer.write("SHUTDOWN\r\n");
-//                writer.flush();
-//                writer.close();
-//                shutdownSocket.close();
+            if (!socketClosed) {
                 throw new Exception("Last test run did not shut down WebApp entity "+entity+"
(port "+shutdownPort+")");
             }
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1b7b5a83/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
index 668362a..2bd7b5c 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
@@ -669,8 +669,6 @@ public class Asserts {
         assertEquals(actual, expected, null);
     }
 
-
-
     /**
      * Asserts that a condition is true. If it isn't, an AssertionError is thrown.
      * @param condition the condition to evaluate


Mime
View raw message