Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master ef3af1213 -> f8b7271b0


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/689b49c3/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git 
a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
 
b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
new file mode 100644
index 0000000..8be9f99
--- /dev/null
+++ 
b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
@@ -0,0 +1,55 @@
+/*
+ * 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.entity.network.bind;
+
+import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
+import brooklyn.entity.basic.EntityLocal;
+import brooklyn.location.basic.SshMachineLocation;
+
+/**
+ * Implements methods in {@link 
brooklyn.entity.basic.AbstractSoftwareProcessSshDriver}.
+ * {@link #isRunning()} returns true.
+ */
+public class DoNothingSoftwareProcessDriver extends 
AbstractSoftwareProcessSshDriver {
+
+    public DoNothingSoftwareProcessDriver(EntityLocal entity, 
SshMachineLocation machine) {
+        super(entity, machine);
+    }
+
+    @Override
+    public boolean isRunning() {
+        return true;
+    }
+
+    @Override
+    public void install() {
+    }
+
+    @Override
+    public void customize() {
+    }
+
+    @Override
+    public void launch() {
+    }
+
+    @Override
+    public void stop() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/689b49c3/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
----------------------------------------------------------------------
diff --git 
a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
 
b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
new file mode 100644
index 0000000..85f1dde
--- /dev/null
+++ 
b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
@@ -0,0 +1,57 @@
+/*
+ * 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.entity.network.bind;
+
+import com.google.common.reflect.TypeToken;
+
+import brooklyn.config.ConfigKey;
+import brooklyn.enricher.basic.AbstractEnricher;
+import brooklyn.entity.basic.ConfigKeys;
+import brooklyn.entity.basic.EntityLocal;
+import brooklyn.event.AttributeSensor;
+import brooklyn.event.SensorEvent;
+import brooklyn.event.SensorEventListener;
+import brooklyn.event.basic.Sensors;
+
+public class PrefixAndIdEnricher extends AbstractEnricher {
+
+    public static final AttributeSensor<String> SENSOR = 
Sensors.newStringSensor(
+            "prefixandid.sensor");
+
+    public static final ConfigKey<String> PREFIX = 
ConfigKeys.newStringConfigKey(
+            "prefixandid.prefix", "Sets SENSOR to prefix+entity id");
+
+    public static final ConfigKey<AttributeSensor<?>> MONITOR = 
ConfigKeys.newConfigKey(new TypeToken<AttributeSensor<?>>() {},
+            "prefixandid.attributetomonitor", "Changes on this sensor are 
monitored and the prefix/id republished");
+
+    public PrefixAndIdEnricher() {
+    }
+
+    @Override
+    public void setEntity(final EntityLocal entity) {
+        super.setEntity(entity);
+        subscribe(entity, getConfig(MONITOR), new 
SensorEventListener<Object>() {
+            @Override
+            public void onEvent(SensorEvent<Object> event) {
+                entity.setAttribute(SENSOR, getConfig(PREFIX) + 
entity.getId());
+            }
+        });
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/689b49c3/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
----------------------------------------------------------------------
diff --git 
a/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
 
b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
new file mode 100644
index 0000000..e87f1d0
--- /dev/null
+++ 
b/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.entity.network.bind;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.EntityLocal;
+import brooklyn.location.basic.SshMachineLocation;
+
+public class TestBindDnsServerImpl extends BindDnsServerImpl {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(TestBindDnsServerImpl.class);
+
+    public static class TestBindDnsServerDriver extends 
DoNothingSoftwareProcessDriver implements BindDnsServerDriver {
+
+        private final BindDnsServerSshDriver delegate;
+
+        public TestBindDnsServerDriver(EntityLocal entity, SshMachineLocation 
machine) {
+            super(entity, machine);
+            delegate = new BindDnsServerSshDriver((BindDnsServerImpl) entity, 
machine);
+        }
+
+        @Override
+        public void updateBindConfiguration() {
+            LOG.info("Skipped copy of Bind configuration files to server");
+            LOG.debug("Configuration:\n{}", 
processTemplate(entity.getConfig(BindDnsServer.NAMED_CONF_TEMPLATE)));
+            LOG.debug("domain.zone:\n{}", 
processTemplate(entity.getConfig(BindDnsServer.DOMAIN_ZONE_FILE_TEMPLATE)));
+            LOG.debug("reverse.zone:\n{}", 
processTemplate(entity.getConfig(BindDnsServer.REVERSE_ZONE_FILE_TEMPLATE)));
+        }
+
+        @Override
+        public BindOsSupport getOsSupport() {
+            return BindOsSupport.forRhel();
+        }
+
+        public String getDataDirectory() {
+            return delegate.getDataDirectory();
+        }
+
+        public String getDynamicDirectory() {
+            return delegate.getDynamicDirectory();
+        }
+
+        public String getDomainZoneFile() {
+            return delegate.getDomainZoneFile();
+        }
+
+        public String getReverseZoneFile() {
+            return delegate.getReverseZoneFile();
+        }
+
+        public String getRfc1912ZonesFile() {
+            return delegate.getRfc1912ZonesFile();
+        }
+    }
+
+    @Override
+    public Class<?> getDriverInterface() {
+        return TestBindDnsServerDriver.class;
+    }
+
+    @Override
+    protected void configureResolver(Entity entity) {
+        LOG.debug("Skipped configuration of resolver on {}", entity);
+    }
+
+    @Override
+    protected void appendTemplate(String template, String destination, 
SshMachineLocation machine) {
+        LOG.debug("Skipped append of template to {}@{}", destination, machine);
+    }
+
+}

Reply via email to