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 2014/08/30 01:01:17 UTC
[17/26] rewrite of ServiceFailureDetector -- part of what it did
before is now done by ServiceStateLogic of course, so now this extends that,
and provides options for emitting notifications of ENTITY_FAILED,
ENTITY_RECOVERED, as well as suppressing ON_FI
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b2daedf8/software/webapp/src/test/java/brooklyn/entity/webapp/JBossExample.groovy
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/JBossExample.groovy b/software/webapp/src/test/java/brooklyn/entity/webapp/JBossExample.groovy
deleted file mode 100644
index c47ae76..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/JBossExample.groovy
+++ /dev/null
@@ -1,48 +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 brooklyn.entity.webapp
-
-import brooklyn.entity.basic.AbstractApplication
-import brooklyn.entity.basic.Entities
-import brooklyn.entity.webapp.jboss.JBoss7Server
-import brooklyn.entity.webapp.jboss.JBoss7ServerImpl
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation
-
-/**
- * TODO Turn into unit or integration test, or delete
- *
- * @deprecated This should either be turned into a unit/integration test, or deleted
- */
-@Deprecated
-class JBossExample extends AbstractApplication {
-
- JBoss7Server s;
-
- @Override
- public void init() {
- s = new JBoss7ServerImpl(this, httpPort: "8080+", war:"classpath://hello-world.war");
- }
-
- public static void main(String[] args) {
- def ex = new JBossExample();
- ex.start( [ new LocalhostMachineProvisioningLocation(name:'london') ] )
- Entities.dumpInfo(ex)
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b2daedf8/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.groovy
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.groovy b/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.groovy
deleted file mode 100644
index 7fbf8bc..0000000
--- a/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.groovy
+++ /dev/null
@@ -1,75 +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 brooklyn.test.entity
-
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-
-import brooklyn.entity.Effector
-import brooklyn.entity.Entity
-import brooklyn.entity.basic.MethodEffector
-import brooklyn.entity.basic.SoftwareProcessImpl
-import brooklyn.entity.effector.EffectorAndBody
-import brooklyn.entity.java.VanillaJavaAppImpl
-import brooklyn.entity.webapp.WebAppServiceConstants
-import brooklyn.location.Location
-import brooklyn.util.flags.SetFromFlag
-
-/**
- * Mock web application server entity for testing.
- */
-public class TestJavaWebAppEntity extends VanillaJavaAppImpl {
- private static final Logger LOG = LoggerFactory.getLogger(TestJavaWebAppEntity.class);
- public static final Effector<Void> START = new EffectorAndBody<Void>(SoftwareProcessImpl.START, new MethodEffector(TestJavaWebAppEntity.class, "customStart").getBody());
-
- public TestJavaWebAppEntity(Map properties=[:], Entity parent=null) {
- super(properties, parent)
- }
-
- @SetFromFlag public int a;
- @SetFromFlag public int b;
- @SetFromFlag public int c;
-
- public void waitForHttpPort() { }
-
-
- public void customStart(Collection<? extends Location> loc) {
- LOG.trace "Starting {}", this
- }
-
- @Override
- protected void doStop() {
- LOG.trace "Stopping {}", this
- }
-
- @Override
- public void doRestart() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- String toString() {
- return "Entity["+id[-8..-1]+"]"
- }
-
- public synchronized void spoofRequest() {
- def rc = getAttribute(WebAppServiceConstants.REQUEST_COUNT) ?: 0
- setAttribute(WebAppServiceConstants.REQUEST_COUNT, rc+1)
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b2daedf8/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.java b/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.java
new file mode 100644
index 0000000..96edbcd
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/test/entity/TestJavaWebAppEntity.java
@@ -0,0 +1,73 @@
+/*
+ * 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 brooklyn.test.entity;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.Effector;
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.MethodEffector;
+import brooklyn.entity.basic.SoftwareProcessImpl;
+import brooklyn.entity.effector.EffectorAndBody;
+import brooklyn.entity.java.VanillaJavaAppImpl;
+import brooklyn.entity.webapp.WebAppServiceConstants;
+import brooklyn.location.Location;
+import brooklyn.util.flags.SetFromFlag;
+
+/**
+ * Mock web application server entity for testing.
+ */
+public class TestJavaWebAppEntity extends VanillaJavaAppImpl {
+ private static final Logger LOG = LoggerFactory.getLogger(TestJavaWebAppEntity.class);
+ public static final Effector<Void> START = new EffectorAndBody<Void>(SoftwareProcessImpl.START, new MethodEffector<Void>(TestJavaWebAppEntity.class, "customStart").getBody());
+
+ @SetFromFlag public int a;
+ @SetFromFlag public int b;
+ @SetFromFlag public int c;
+
+ public TestJavaWebAppEntity() {}
+ public TestJavaWebAppEntity(@SuppressWarnings("rawtypes") Map flags, Entity parent) { super(flags, parent); }
+
+ public void waitForHttpPort() { }
+
+
+ public void customStart(Collection<? extends Location> loc) {
+ LOG.trace("Starting {}", this);
+ }
+
+ @Override
+ protected void doStop() {
+ LOG.trace("Stopping {}", this);
+ }
+
+ @Override
+ public void doRestart() {
+ throw new UnsupportedOperationException();
+ }
+
+ public synchronized void spoofRequest() {
+ Integer rc = getAttribute(WebAppServiceConstants.REQUEST_COUNT);
+ if (rc==null) rc = 0;
+ setAttribute(WebAppServiceConstants.REQUEST_COUNT, rc+1);
+ }
+}