Delete deprecated test util classes

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

Branch: refs/heads/master
Commit: 858fba4d49e1fd098e66f1faf96f1c0caa1963fc
Parents: 9911286
Author: Aled Sage <[email protected]>
Authored: Wed May 17 20:34:19 2017 +0200
Committer: Aled Sage <[email protected]>
Committed: Fri May 19 10:46:35 2017 +0100

----------------------------------------------------------------------
 .../EntityPersistencePerformanceTest.java       |   2 +-
 .../ssh/SshMachineLocationPerformanceTest.java  |   2 +-
 .../apache/brooklyn/test/EntityTestUtils.java   | 192 -------------------
 .../brooklyn/test/PerformanceTestUtils.java     |  26 ---
 .../org/apache/brooklyn/test/TestUtils.java     |  83 --------
 5 files changed, 2 insertions(+), 303 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/858fba4d/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
 
b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
index a821107..513c0db 100644
--- 
a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
+++ 
b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
@@ -30,7 +30,7 @@ import org.apache.brooklyn.core.location.SimulatedLocation;
 import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
 import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.core.test.policy.TestPolicy;
-import org.apache.brooklyn.test.PerformanceTestUtils;
+import org.apache.brooklyn.test.performance.PerformanceTestUtils;
 import org.apache.brooklyn.util.repeat.Repeater;
 import org.apache.brooklyn.util.time.Duration;
 import org.testng.annotations.Test;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/858fba4d/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationPerformanceTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationPerformanceTest.java
 
b/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationPerformanceTest.java
index 95f2025..c4d7d7d 100644
--- 
a/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationPerformanceTest.java
+++ 
b/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationPerformanceTest.java
@@ -26,7 +26,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.test.PerformanceTestUtils;
+import org.apache.brooklyn.test.performance.PerformanceTestUtils;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.internal.ssh.SshTool;
 import org.apache.brooklyn.util.net.Networking;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/858fba4d/test-support/src/main/java/org/apache/brooklyn/test/EntityTestUtils.java
----------------------------------------------------------------------
diff --git 
a/test-support/src/main/java/org/apache/brooklyn/test/EntityTestUtils.java 
b/test-support/src/main/java/org/apache/brooklyn/test/EntityTestUtils.java
deleted file mode 100644
index 28d9f2c..0000000
--- a/test-support/src/main/java/org/apache/brooklyn/test/EntityTestUtils.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.Group;
-import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.SensorEvent;
-import org.apache.brooklyn.api.sensor.SensorEventListener;
-import org.apache.brooklyn.config.ConfigKey;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * A utility class containing tests on Entities.
- *
- * @deprecated since 0.9.0. Prefer core assertions class 
org.apache.brooklyn.core.entity.EntityAsserts.
- */
-@Deprecated
-public class EntityTestUtils {
-
-//    public static LocalManagementContext newManagementContext() { return new 
LocalManagementContextForTests(); }
-    
-    // TODO Delete methods from TestUtils, to just have them here (or switch 
so TestUtils delegates here,
-    // and deprecate methods in TestUtils until deleted).
-    
-    public static <T> void assertAttributeEquals(Entity entity, 
AttributeSensor<T> attribute, T expected) {
-        assertEquals(entity.getAttribute(attribute), expected, "entity=" + 
entity + "; attribute=" + attribute);
-    }
-    
-    public static <T> void assertConfigEquals(Entity entity, ConfigKey<T> 
configKey, T expected) {
-        assertEquals(entity.getConfig(configKey), expected, "entity=" + entity 
+ "; configKey=" + configKey);
-    }
-    
-    public static <T> void assertAttributeEqualsEventually(final Entity 
entity, final AttributeSensor<T> attribute, final T expected) {
-        assertAttributeEqualsEventually(Maps.newLinkedHashMap(), entity, 
attribute, expected);
-    }
-
-    public static <T> void assertAttributeEqualsEventually(Map<?,?> flags, 
final Entity entity, final AttributeSensor<T> attribute, final T expected) {
-        // Not using assertAttributeEventually(predicate) so get nicer error 
message
-        Asserts.succeedsEventually((Map) flags, new Runnable() {
-            @Override
-            public void run() {
-                assertAttributeEquals(entity, attribute, expected);
-            }
-        });
-    }
-
-    public static <T> T assertAttributeEventuallyNonNull(final Entity entity, 
final AttributeSensor<T> attribute) {
-        return assertAttributeEventuallyNonNull(Maps.newLinkedHashMap(), 
entity, attribute);
-    }
-
-    public static <T> T assertAttributeEventuallyNonNull(Map<?,?> flags, final 
Entity entity, final AttributeSensor<T> attribute) {
-        return assertAttributeEventually(flags, entity, attribute, 
Predicates.notNull());
-    }
-
-    public static <T> T assertAttributeEventually(final Entity entity, final 
AttributeSensor<T> attribute, Predicate<? super T> predicate) {
-        return assertAttributeEventually(ImmutableMap.of(), entity, attribute, 
predicate);
-    }
-    
-    public static <T> T assertAttributeEventually(Map<?,?> flags, final Entity 
entity, final AttributeSensor<T> attribute, final Predicate<? super T> 
predicate) {
-        final AtomicReference<T> result = new AtomicReference<T>();
-        Asserts.succeedsEventually((Map)flags, new Runnable() {
-            @Override public void run() {
-                T val = entity.getAttribute(attribute);
-                assertTrue(predicate.apply(val), "val="+val);
-                result.set(val);
-            }});
-        return result.get();
-    }
-
-    public static <T> T assertAttribute(final Entity entity, final 
AttributeSensor<T> attribute, final Predicate<? super T> predicate) {
-        T val = entity.getAttribute(attribute);
-        assertTrue(predicate.apply(val), "val="+val);
-        return val;
-    }
-
-    public static <T extends Entity> void assertPredicateEventuallyTrue(final 
T entity, final Predicate<? super T> predicate) {
-        assertPredicateEventuallyTrue(Maps.newLinkedHashMap(), entity, 
predicate);
-    }
-
-    public static <T extends Entity> void 
assertPredicateEventuallyTrue(Map<?,?> flags, final T entity, final Predicate<? 
super T> predicate) {
-        Asserts.succeedsEventually((Map) flags, new Runnable() {
-            @Override
-            public void run() {
-                assertTrue(predicate.apply(entity));
-            }
-        });
-    }
-
-    public static <T> void assertAttributeEqualsContinually(final Entity 
entity, final AttributeSensor<T> attribute, final T expected) {
-        assertAttributeEqualsContinually(Maps.newLinkedHashMap(), entity, 
attribute, expected);
-    }
-    
-    public static <T> void assertAttributeEqualsContinually(Map<?,?> flags, 
final Entity entity, final AttributeSensor<T> attribute, final T expected) {
-        Asserts.succeedsContinually(flags, new Runnable() {
-            @Override
-            public void run() {
-                assertAttributeEquals(entity, attribute, expected);
-            }
-        });
-    }
-
-    public static void assertGroupSizeEqualsEventually(final Group group, int 
expected) {
-        assertGroupSizeEqualsEventually(ImmutableMap.of(), group, expected);
-    }
-    
-    public static void assertGroupSizeEqualsEventually(Map<?,?> flags, final 
Group group, final int expected) {
-        Asserts.succeedsEventually((Map) flags, new Runnable() {
-            @Override
-            public void run() {
-                Collection<Entity> members = group.getMembers();
-                assertEquals(members.size(), expected, "members=" + members);
-            }
-        });
-    }
-
-    /** checks that the entity's value for this attribute changes, by 
registering a subscription and checking the value */
-    public static void assertAttributeChangesEventually(final Entity entity, 
final AttributeSensor<?> attribute) {
-        final Object origValue = entity.getAttribute(attribute);
-        final AtomicBoolean changed = new AtomicBoolean();
-        SubscriptionHandle handle = entity.subscriptions().subscribe(entity, 
attribute, new SensorEventListener<Object>() {
-            @Override public void onEvent(SensorEvent<Object> event) {
-                if (!Objects.equal(origValue, event.getValue())) {
-                    changed.set(true);
-                }
-            }});
-        try {
-            Asserts.succeedsEventually(new Runnable() {
-                @Override public void run() {
-                    assertTrue(changed.get(), entity+" -> "+attribute+" not 
changed");
-                }});
-        } finally {
-            entity.subscriptions().unsubscribe(entity, handle);
-        }
-    }
-    
-    /** alternate version of {@link #assertAttributeChangesEventually(Entity, 
AttributeSensor)} not using subscriptions and 
-     * with simpler code, for comparison */
-    @Beta
-    public static <T> void assertAttributeChangesEventually2(final Entity 
entity, final AttributeSensor<T> attribute) {
-        assertAttributeEventually(entity, attribute,
-                
Predicates.not(Predicates.equalTo(entity.getAttribute(attribute))));
-    }
-
-    @Beta
-    public static <T> void assertAttributeNever(final Entity entity, final 
AttributeSensor<T> attribute, T... disallowed) {
-        final Set<T> reject = Sets.newHashSet(disallowed);
-        Asserts.succeedsContinually(new Runnable() {
-            @Override
-            public void run() {
-                T val = entity.getAttribute(attribute);
-                assertFalse(reject.contains(val),
-                        "Attribute " + attribute + " on " + entity + " has 
disallowed value " + val);
-            }
-        });
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/858fba4d/test-support/src/main/java/org/apache/brooklyn/test/PerformanceTestUtils.java
----------------------------------------------------------------------
diff --git 
a/test-support/src/main/java/org/apache/brooklyn/test/PerformanceTestUtils.java 
b/test-support/src/main/java/org/apache/brooklyn/test/PerformanceTestUtils.java
deleted file mode 100644
index c0e9a71..0000000
--- 
a/test-support/src/main/java/org/apache/brooklyn/test/PerformanceTestUtils.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.test;
-
-/**
- * @deprecated since 0.9.0; see {@link 
org.apache.brooklyn.test.performance.PerformanceTestUtils}.
- */
-@Deprecated
-public class PerformanceTestUtils extends 
org.apache.brooklyn.test.performance.PerformanceTestUtils {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/858fba4d/test-support/src/main/java/org/apache/brooklyn/test/TestUtils.java
----------------------------------------------------------------------
diff --git a/test-support/src/main/java/org/apache/brooklyn/test/TestUtils.java 
b/test-support/src/main/java/org/apache/brooklyn/test/TestUtils.java
deleted file mode 100644
index 40fd53f..0000000
--- a/test-support/src/main/java/org/apache/brooklyn/test/TestUtils.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.test;
-
-import static org.testng.Assert.fail;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-
-import org.codehaus.groovy.runtime.InvokerInvocationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper functions for tests of Tomcat, JBoss and others.
- * 
- * @deprecated Since 0.8. Methods moving to {@link Asserts}.
- */
-@Deprecated
-public class TestUtils {
-    private static final Logger log = LoggerFactory.getLogger(TestUtils.class);
-
-    private TestUtils() { }
-
-    /** @deprecated since 0.8; use Asserts.BooleanWithMessage */
-    @Deprecated
-    public static class BooleanWithMessage {
-        boolean value; String message;
-        public BooleanWithMessage(boolean value, String message) {
-            this.value = value; this.message = message;
-        }
-        public boolean asBoolean() {
-            return value;
-        }
-        @Override
-        public String toString() {
-            return message;
-        }
-    }
-    
-    /** @deprecated since 0.8; use Exceptions.getFirstInteresting */ 
-    @Deprecated
-    public static Throwable unwrapThrowable(Throwable t) {
-        if (t.getCause() == null) {
-            return t;
-        } else if (t instanceof ExecutionException) {
-            return unwrapThrowable(t.getCause());
-        } else if (t instanceof InvokerInvocationException) {
-            return unwrapThrowable(t.getCause());
-        } else {
-            return t;
-        }
-    }
-
-    /** @deprecated since 0.8; use Asserts.assertEqualsIgnoringOrder */
-    @Deprecated
-    public static void assertSetsEqual(Collection c1, Collection c2) {
-        Set s = new LinkedHashSet();
-        s.addAll(c1); s.removeAll(c2);
-        if (!s.isEmpty()) fail("First argument contains additional contents: 
"+s);
-        s.clear(); s.addAll(c2); s.removeAll(c1);
-        if (!s.isEmpty()) fail("Second argument contains additional contents: 
"+s);
-    }
-    
-}

Reply via email to