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 2016/02/01 18:47:54 UTC
[18/51] [abbrv] [partial] brooklyn-library git commit: move subdir
from incubator up a level as it is promoted to its own repo (first
non-incubator commit!)
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.conf
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.conf b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.conf
deleted file mode 100644
index 5dd10d7..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.conf
+++ /dev/null
@@ -1,63 +0,0 @@
-[#ftl]
-//
-// 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.
-//
-// Generated by Brooklyn on ${.now?string.short}
-//
-options {
- listen-on port ${entity.dnsPort} { 127.0.0.1; ${driver.address}; };
- listen-on-v6 port ${entity.dnsPort} { ::1; };
- directory "${driver.osSupport.configDirectory}";
- dump-file "${driver.dataDirectory}/cache_dump.db";
- statistics-file "${driver.dataDirectory}/named_stats.txt";
- memstatistics-file "${driver.dataDirectory}/named_mem_stats.txt";
- allow-query { localhost; ${entity.managementCidr}; };
- allow-transfer { localhost; ${driver.address}; };
- recursion yes;
- dnssec-enable yes;
- dnssec-validation yes;
- dnssec-lookaside auto;
- bindkeys-file "${driver.osSupport.keysFile}";
- managed-keys-directory "${driver.dynamicDirectory}";
-};
-
-logging {
- channel default_debug {
- file "${driver.dataDirectory}/named.run";
- severity dynamic;
- };
-};
-
-zone "." IN {
- type hint;
- file "${driver.osSupport.rootZonesFile}";
-};
-
-zone "${entity.reverseLookupDomain}" IN {
- type master;
- file "${driver.reverseZoneFile}";
- allow-update { none; };
-};
-
-zone "${entity.domainName}" IN {
- type master;
- file "${driver.domainZoneFile}";
- allow-update { none; };
-};
-
-include "${driver.rfc1912ZonesFile}";
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.empty
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.empty b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.empty
deleted file mode 100644
index 3197b41..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.empty
+++ /dev/null
@@ -1,30 +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.
-;
-;
-; Reverse data for the broadcast zone
-;
-$TTL 1W
-@ IN SOA localhost. root.localhost. (
- 1 ; serial
- 1W ; refresh
- 1D ; retry
- 1M ; expire
- 1M ) ; ttl
-;
-@ IN NS localhost.
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.localhost
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.localhost b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.localhost
deleted file mode 100644
index c683a83..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.localhost
+++ /dev/null
@@ -1,32 +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.
-;
-;
-; BIND data for the local loopback interface
-;
-$TTL 1W
-@ IN SOA localhost. root.localhost. (
- 1 ; serial
- 1W ; refresh
- 1D ; retry
- 1M ; expire
- 1M ) ; ttl
-;
-@ IN NS localhost.
-@ IN A 127.0.0.1
-@ IN AAAA ::1
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.loopback
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.loopback b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.loopback
deleted file mode 100644
index 38d701d..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/named.loopback
+++ /dev/null
@@ -1,31 +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.
-;
-;
-; BIND reverse data for the local loopback interface
-;
-$TTL 1W
-@ IN SOA localhost. root.localhost. (
- 1 ; serial
- 1W ; refresh
- 1D ; retry
- 1M ; expire
- 1M ) ; ttl
-;
-@ IN NS localhost.
-1.0.0 IN PTR localhost.
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/resolv.conf
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/resolv.conf b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/resolv.conf
deleted file mode 100644
index ade4ce0..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/resolv.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-[#ftl]
-#
-# 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.
-#
-# Generated by Brooklyn on ${.now?string.short}
-#
-#
-search ${entity.domainName}
-nameserver ${driver.address}
-nameserver 8.8.8.8
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/reverse.zone
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/reverse.zone b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/reverse.zone
deleted file mode 100644
index 6966e1e..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/reverse.zone
+++ /dev/null
@@ -1,37 +0,0 @@
-[#ftl]
-;;
-;; 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.
-;;
-;; Generated by Brooklyn on ${.now?string.short}
-;;
-[#noparse]$TTL[/#noparse] 86400
-@ IN SOA ns1.${entity.domainName}. root.${entity.domainName}. (
- ${entity.serial?c} ; serial
- 3600 ; refresh
- 1800 ; retry
- 604800 ; expire
- 86400 ; ttl
-)
-${entity.reverseLookupDomain}. IN NS ns1.${entity.domainName}.
-${entity.reverseLookupDomain}. IN NS ns2.${entity.domainName}.
-ns1 IN A ${driver.address}
-ns2 IN A ${driver.address}
-
-[#list entity.pointerRecords?keys as address]
-${address} IN PTR ${entity.pointerRecords[address]}.${entity.domainName}.
-[/#list]
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/rfc1912.zone
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/rfc1912.zone b/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/rfc1912.zone
deleted file mode 100644
index 1de4650..0000000
--- a/brooklyn-library/software/network/src/main/resources/org/apache/brooklyn/entity/network/bind/rfc1912.zone
+++ /dev/null
@@ -1,52 +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.
-//
-// Zones recommended in RFC 1912 section 4.1.
-//
-// See https://www.ietf.org/rfc/rfc1912.txt.
-//
-
-zone "localhost" {
- type master;
- file "${driver.osSupport.configDirectory}/named.localhost";
- allow-update { none; };
-};
-
-zone "127.in-addr.arpa" {
- type master;
- file "${driver.osSupport.configDirectory}/named.loopback";
- allow-update { none; };
-};
-
-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
- type master;
- file "${driver.osSupport.configDirectory}/named.loopback";
- allow-update { none; };
-};
-
-zone "0.in-addr.arpa" {
- type master;
- file "${driver.osSupport.configDirectory}/named.empty";
- allow-update { none; };
-};
-
-zone "255.in-addr.arpa" {
- type master;
- file "${driver.osSupport.configDirectory}/named.empty";
- allow-update { none; };
-};
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerByonLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerByonLiveTest.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerByonLiveTest.java
deleted file mode 100644
index 9dabcb4..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerByonLiveTest.java
+++ /dev/null
@@ -1,44 +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.entity.network.bind;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport;
-import org.apache.brooklyn.util.text.Strings;
-
-public class BindDnsServerByonLiveTest extends BrooklynAppLiveTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(BindDnsServerByonLiveTest.class);
-
- @Test(groups = "Live")
- @Parameters({"locationSpec"})
- public void testDns(@Optional String locationSpec) throws Exception {
- if (Strings.isBlank(locationSpec)) {
- LOG.info("{} got no spec, skipping test", this);
- } else {
- Location testLocation = mgmt.getLocationRegistry().resolve(locationSpec);
- BindDnsServerLiveTest.testBindStartsAndUpdates(app, testLocation);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerEc2LiveTest.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerEc2LiveTest.java
deleted file mode 100644
index 7c6391a..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerEc2LiveTest.java
+++ /dev/null
@@ -1,62 +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.entity.network.bind;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.entity.AbstractEc2LiveTest;
-
-public class BindDnsServerEc2LiveTest extends AbstractEc2LiveTest {
- private static final Logger LOG = LoggerFactory.getLogger(BindDnsServerEc2LiveTest.class);
-
- protected void doTest(Location testLocation) throws Exception {
- BindDnsServerLiveTest.testBindStartsAndUpdates(app, testLocation);
- }
-
- @Override
- public void test_Red_Hat_Enterprise_Linux_6() throws Exception {
- super.test_Red_Hat_Enterprise_Linux_6();
- }
-
- @Override
- public void test_CentOS_6_3() throws Exception {
- super.test_CentOS_6_3();
- }
-
- @Override
- public void test_Debian_7_2() throws Exception {
- super.test_Debian_7_2();
- }
-
- @Override
- public void test_Debian_6() throws Exception {
- LOG.debug("{} skipped Debian 6 test", this);
- }
-
- @Override
- public void test_Ubuntu_10_0() throws Exception {
- LOG.debug("{} skipped Ubuntu 10 test", this);
- }
-
- @Override
- public void test_CentOS_5() throws Exception {
- LOG.debug("{} skipped CentOS 5.6 test", this);
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
deleted file mode 100644
index a0c67e0..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
+++ /dev/null
@@ -1,260 +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.entity.network.bind;
-
-import static org.testng.Assert.assertEquals;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.enricher.stock.Enrichers;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Functions;
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-public class BindDnsServerIntegrationTest extends RebindTestFixture<TestApplication> {
-
- private static final Logger LOG = LoggerFactory.getLogger(BindDnsServerIntegrationTest.class);
- private BindDnsServer dns;
- private DynamicCluster cluster;
-
- @Override
- protected TestApplication createApp() {
- TestApplication app = ApplicationBuilder.newManagedApp(TestApplication.class, origManagementContext);
- dns = app.createAndManageChild(EntitySpec.create(BindDnsServer.class, TestBindDnsServerImpl.class)
- .configure(BindDnsServer.ENTITY_FILTER, Predicates.instanceOf(EmptySoftwareProcess.class))
- .configure(BindDnsServer.HOSTNAME_SENSOR, PrefixAndIdEnricher.SENSOR));
- EntitySpec<EmptySoftwareProcess> memberSpec = EntitySpec.create(EmptySoftwareProcess.class)
- .enricher(EnricherSpec.create(PrefixAndIdEnricher.class)
- .configure(PrefixAndIdEnricher.PREFIX, "dns-integration-test-")
- .configure(PrefixAndIdEnricher.MONITOR, Attributes.HOSTNAME));
- cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
- .configure(DynamicCluster.MEMBER_SPEC, memberSpec)
- .configure(DynamicCluster.INITIAL_SIZE, 3));
- return app;
- }
-
- @Test(groups = "Integration")
- public void testOneARecordAndNoCnameRecordsWhenEntitiesHaveSameName() {
- TestApplication app = ApplicationBuilder.newManagedApp(TestApplication.class, origManagementContext);
- EnricherSpec<?> dnsEnricher = Enrichers.builder().transforming(Attributes.HOSTNAME)
- .computing(Functions.constant("my-name"))
- .publishing(PrefixAndIdEnricher.SENSOR)
- .build();
- EntitySpec<EmptySoftwareProcess> emptySoftwareProcessSpec = EntitySpec.create(EmptySoftwareProcess.class)
- .enricher(dnsEnricher);
- dns = app.createAndManageChild(EntitySpec.create(BindDnsServer.class, TestBindDnsServerImpl.class)
- .configure(BindDnsServer.HOSTNAME_SENSOR, PrefixAndIdEnricher.SENSOR));
-
- // App DNS will listen to
- cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
- .configure(DynamicCluster.MEMBER_SPEC, emptySoftwareProcessSpec)
- .configure(DynamicCluster.INITIAL_SIZE, 3));
-
- app.start(ImmutableList.of(app.newLocalhostProvisioningLocation()));
-
- assertDnsEntityEventuallyHasActiveMembers(1);
- // All of the entities publish the same domain name so there should be a single DNS entry and no CNAMEs.
- assertMapSizes(1, 1, 0, 1);
- }
-
- @Test(groups = "Integration")
- public void testDuplicateAAndCnameRecordsAreIgnored() {
- TestApplication app = ApplicationBuilder.newManagedApp(TestApplication.class, origManagementContext);
- EnricherSpec<?> enricher1 = Enrichers.builder().transforming(Attributes.HOSTNAME)
- .computing(Functions.constant("my-name-1"))
- .publishing(PrefixAndIdEnricher.SENSOR)
- .build();
- EnricherSpec<?> enricher2 = Enrichers.builder().transforming(Attributes.HOSTNAME)
- .computing(Functions.constant("my-name-2"))
- .publishing(PrefixAndIdEnricher.SENSOR)
- .build();
- dns = app.createAndManageChild(EntitySpec.create(BindDnsServer.class, TestBindDnsServerImpl.class)
- .configure(BindDnsServer.HOSTNAME_SENSOR, PrefixAndIdEnricher.SENSOR));
-
- // Expect one of my-name-{1,2} to be used as the A record the other to be used as the CNAME.
- // Expect all duplicate records to be ignored.
- app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class).enricher(enricher1));
- app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class).enricher(enricher1));
- app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class).enricher(enricher1));
- app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class).enricher(enricher2));
- app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class).enricher(enricher2));
- app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class).enricher(enricher2));
- app.start(ImmutableList.of(app.newLocalhostProvisioningLocation()));
-
- assertDnsEntityEventuallyHasActiveMembers(2);
- assertMapSizes(2, 1, 1, 1);
- }
-
- @Test(groups = "Integration")
- public void testStripsInvalidCharactersFromHostname() {
- origApp.start(ImmutableList.of(origApp.newLocalhostProvisioningLocation()));
- cluster.resize(1);
- assertDnsEntityEventuallyHasActiveMembers(1);
- EntityLocal e = (EntityLocal) Iterables.getOnlyElement(cluster.getMembers());
- e.sensors().set(PrefixAndIdEnricher.SENSOR, " _-pretend.hostname.10.0.0.7.my-cloud.com");
- EntityTestUtils.assertAttributeEqualsEventually(dns, BindDnsServer.A_RECORDS,
- ImmutableMap.of("pretend-hostname-10-0-0-7-my-cloud-com", e.getAttribute(Attributes.ADDRESS)));
- }
-
- @Test(groups = "Integration")
- public void testHostnameTruncatedTo63Characters() {
- origApp.start(ImmutableList.of(origApp.newLocalhostProvisioningLocation()));
- cluster.resize(1);
- assertDnsEntityEventuallyHasActiveMembers(1);
- EntityLocal e = (EntityLocal) Iterables.getOnlyElement(cluster.getMembers());
- e.sensors().set(PrefixAndIdEnricher.SENSOR, Strings.repeat("a", 171));
- EntityTestUtils.assertAttributeEqualsEventually(dns, BindDnsServer.A_RECORDS,
- ImmutableMap.of(Strings.repeat("a", 63), e.getAttribute(Attributes.ADDRESS)));
- }
-
- @Test(groups = "Integration")
- public void testCanConfigureToListenToChildrenOfEntityOtherThanParent() {
- // Ignoring origApp
- TestApplication app = ApplicationBuilder.newManagedApp(TestApplication.class, origManagementContext);
-
- EnricherSpec<PrefixAndIdEnricher> dnsEnricher = EnricherSpec.create(PrefixAndIdEnricher.class)
- .configure(PrefixAndIdEnricher.PREFIX, "dns-integration-test-")
- .configure(PrefixAndIdEnricher.MONITOR, Attributes.HOSTNAME);
- EntitySpec<EmptySoftwareProcess> emptySoftwareProcessSpec = EntitySpec.create(EmptySoftwareProcess.class)
- .enricher(dnsEnricher);
-
- // App DNS will listen to
- cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
- .configure(DynamicCluster.MEMBER_SPEC, emptySoftwareProcessSpec)
- .configure(DynamicCluster.INITIAL_SIZE, 3));
-
- // Apps that DNS should not listen to. Appreciate that their having dnsEnricher is unrealistic!
- app.createAndManageChild(emptySoftwareProcessSpec);
- app.createAndManageChild(emptySoftwareProcessSpec);
-
- Predicate<Entity> entityFilter = Predicates.and(
- Predicates.instanceOf(EmptySoftwareProcess.class),
- EntityPredicates.isChildOf(cluster));
- dns = app.createAndManageChild(EntitySpec.create(BindDnsServer.class, TestBindDnsServerImpl.class)
- .configure(BindDnsServer.ENTITY_FILTER, entityFilter)
- .configure(BindDnsServer.HOSTNAME_SENSOR, PrefixAndIdEnricher.SENSOR));
-
- app.start(ImmutableList.of(app.newLocalhostProvisioningLocation()));
- logDnsMappings();
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).keySet().size(), 1);
- assertMapSizes(3, 1, 2, 1);
-
- cluster.resize(4);
- EntityTestUtils.assertAttributeEqualsEventually(cluster, DynamicCluster.GROUP_SIZE, 4);
- assertDnsEntityEventuallyHasActiveMembers(4);
- assertMapSizes(4, 1, 3, 1);
-
- }
-
- @Test(invocationCount=1, groups = "Integration")
- public void testRebindDns() throws Throwable {
- origApp.start(ImmutableList.of(origApp.newLocalhostProvisioningLocation()));
- logDnsMappings();
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).keySet().size(), 1);
- assertMapSizes(3, 1, 2, 1);
-
- rebind(RebindOptions.create().mementoDirBackup(mementoDirBackup));
- try {
- dns = (BindDnsServer) Iterables.getOnlyElement(Iterables.filter(newApp.getChildren(), Predicates.instanceOf(BindDnsServer.class)));
- cluster = (DynamicCluster) Iterables.getOnlyElement(Iterables.filter(newApp.getChildren(), Predicates.instanceOf(DynamicCluster.class)));
-
- // assert original attributes restored and the server can be updated.
- logDnsMappings();
- assertMapSizes(3, 1, 2, 1);
- cluster.resize(1);
- assertDnsEntityEventuallyHasActiveMembers(1);
- logDnsMappings();
- EntityTestUtils.assertAttributeEqualsEventually(cluster, DynamicCluster.GROUP_SIZE, 1);
- assertMapSizes(1, 1, 0, 1);
- cluster.resize(5);
- assertDnsEntityEventuallyHasActiveMembers(5);
- logDnsMappings();
- EntityTestUtils.assertAttributeEqualsEventually(cluster, DynamicCluster.GROUP_SIZE, 5);
- assertMapSizes(5, 1, 4, 1);
- } catch (Throwable t) {
- // Failing in jenkins occasionally; don't know why and can't reproduce.
- // Therefore dumping out lots more info on failure.
- LOG.error("Test failed; dumping out contents of original persistence dir used for rebind...", t);
- dumpMementoDir(mementoDirBackup);
- throw t;
- }
- }
-
- @Test(groups = "Integration")
- public void testMapsSeveralEntitiesOnOneMachine() {
- origApp.start(ImmutableList.of(origApp.newLocalhostProvisioningLocation()));
- EntityTestUtils.assertAttributeEqualsEventually(dns, Attributes.SERVICE_UP, true);
- logDnsMappings();
-
- // One host with one A, two CNAME and one PTR record
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).keySet().size(), 1);
- assertMapSizes(3, 1, 2, 1);
- String key = Iterables.getOnlyElement(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).keySet());
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).get(key).size(), 3);
-
- Entities.dumpInfo(dns);
- }
-
- private void assertMapSizes(int addresses, int aRecords, int cnameRecords, int ptrRecords) {
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).entries().size(), addresses, "Mismatched address mappings");
- assertEquals(dns.getAttribute(BindDnsServer.A_RECORDS).size(), aRecords, "Mismatched A records");
- assertEquals(dns.getAttribute(BindDnsServer.CNAME_RECORDS).size(), cnameRecords, "Mismatched CNAME records");
- assertEquals(dns.getAttribute(BindDnsServer.PTR_RECORDS).size(), ptrRecords, "Mismatched PTR records");
- }
-
- private void logDnsMappings() {
- LOG.info("A: " + Joiner.on(", ").withKeyValueSeparator("=").join(
- dns.getAttribute(BindDnsServer.A_RECORDS)));
- LOG.info("CNAME: " + Joiner.on(", ").withKeyValueSeparator("=").join(
- dns.getAttribute(BindDnsServer.CNAME_RECORDS).asMap()));
- LOG.info("PTR: " + Joiner.on(", ").withKeyValueSeparator("=").join(
- dns.getAttribute(BindDnsServer.PTR_RECORDS)));
- }
-
- private void assertDnsEntityEventuallyHasActiveMembers(final int size) {
- EntityTestUtils.assertPredicateEventuallyTrue(dns, new Predicate<BindDnsServer>() {
- @Override
- public boolean apply(BindDnsServer input) {
- return input.getAddressMappings().size() == size;
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerLiveTest.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerLiveTest.java
deleted file mode 100644
index 56273c7..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerLiveTest.java
+++ /dev/null
@@ -1,111 +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.entity.network.bind;
-
-import static org.apache.brooklyn.test.EntityTestUtils.assertAttributeEqualsEventually;
-import static org.testng.Assert.assertEquals;
-
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.sensor.EnricherSpec;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
-import org.apache.brooklyn.entity.software.base.SameServerEntity;
-import org.apache.brooklyn.util.repeat.Repeater;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-
-public class BindDnsServerLiveTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(BindDnsServerLiveTest.class);
-
- public static void testBindStartsAndUpdates(TestApplication app, Location testLocation) throws Exception {
- DynamicCluster cluster;
- BindDnsServer dns;
-
- SameServerEntity sse = app.createAndManageChild(EntitySpec.create(SameServerEntity.class));
- EntitySpec<EmptySoftwareProcess> memberSpec = EntitySpec.create(EmptySoftwareProcess.class)
- .enricher(EnricherSpec.create(PrefixAndIdEnricher.class)
- .configure(PrefixAndIdEnricher.PREFIX, "dns-live-test-")
- .configure(PrefixAndIdEnricher.MONITOR, Attributes.HOSTNAME));
- cluster = sse.addChild(EntitySpec.create(DynamicCluster.class)
- .configure(DynamicCluster.MEMBER_SPEC, memberSpec)
- .configure(DynamicCluster.INITIAL_SIZE, 1));
- dns = sse.addChild((EntitySpec.create(BindDnsServer.class)
- .configure(BindDnsServer.ENTITY_FILTER, Predicates.instanceOf(EmptySoftwareProcess.class))
- .configure(BindDnsServer.HOSTNAME_SENSOR, PrefixAndIdEnricher.SENSOR)));
-
- app.start(ImmutableList.of(testLocation));
- assertAttributeEqualsEventually(dns, Attributes.SERVICE_UP, true);
-
- logDnsMappings(dns);
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).entries().size(), 1);
- assertEquals(dns.getAttribute(BindDnsServer.A_RECORDS).size(), 1);
- assertEquals(dns.getAttribute(BindDnsServer.CNAME_RECORDS).size(), 0);
- // Harder to make assertions on PTR because the entity servers might not be in the right CIDR
-
- cluster.resize(2);
- waitForNumberOfAddressMappings(dns, 2);
- logDnsMappings(dns);
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).entries().size(), 2);
- assertEquals(dns.getAttribute(BindDnsServer.A_RECORDS).size(), 1);
- assertEquals(dns.getAttribute(BindDnsServer.CNAME_RECORDS).size(), 1);
-
- cluster.resize(1);
- waitForNumberOfAddressMappings(dns, 1);
- logDnsMappings(dns);
- assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).entries().size(), 1);
- assertEquals(dns.getAttribute(BindDnsServer.A_RECORDS).size(), 1);
- assertEquals(dns.getAttribute(BindDnsServer.CNAME_RECORDS).size(), 0);
- }
-
- private static void logDnsMappings(BindDnsServer dns) {
- LOG.info("A: " + Joiner.on(", ").withKeyValueSeparator("=").join(
- dns.getAttribute(BindDnsServer.A_RECORDS)));
- LOG.info("CNAME: " + Joiner.on(", ").withKeyValueSeparator("=").join(
- dns.getAttribute(BindDnsServer.CNAME_RECORDS).asMap()));
- LOG.info("PTR: " + Joiner.on(", ").withKeyValueSeparator("=").join(
- dns.getAttribute(BindDnsServer.PTR_RECORDS)));
- }
-
- /**
- * Waits for the Bind entity to have the expected number of mappings or for thirty seconds to have elapsed.
- */
- private static void waitForNumberOfAddressMappings(final BindDnsServer dns, final int expectedMappings) {
- Repeater.create()
- .every(Duration.seconds(1))
- .until(dns, new Predicate<BindDnsServer>() {
- @Override
- public boolean apply(BindDnsServer bindDnsServer) {
- return bindDnsServer.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).size() == expectedMappings;
- }
- })
- .limitTimeTo(Duration.seconds(30))
- .run();
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSoftlayerLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSoftlayerLiveTest.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSoftlayerLiveTest.java
deleted file mode 100644
index f65672c..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/BindDnsServerSoftlayerLiveTest.java
+++ /dev/null
@@ -1,32 +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.entity.network.bind;
-
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.entity.AbstractSoftlayerLiveTest;
-
-public class BindDnsServerSoftlayerLiveTest extends AbstractSoftlayerLiveTest {
-
- @Test(groups = "Live")
- protected void doTest(Location testLocation) throws Exception {
- BindDnsServerLiveTest.testBindStartsAndUpdates(app, testLocation);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
deleted file mode 100644
index 0a58326..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/DoNothingSoftwareProcessDriver.java
+++ /dev/null
@@ -1,55 +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.entity.network.bind;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-
-/**
- * Implements methods in {@link org.apache.brooklyn.entity.software.base.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/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
deleted file mode 100644
index cf03530..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/PrefixAndIdEnricher.java
+++ /dev/null
@@ -1,57 +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.entity.network.bind;
-
-import org.apache.brooklyn.api.entity.EntityLocal;
-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 org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.enricher.AbstractEnricher;
-import org.apache.brooklyn.core.sensor.Sensors;
-
-import com.google.common.reflect.TypeToken;
-
-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);
- subscriptions().subscribe(entity, getConfig(MONITOR), new SensorEventListener<Object>() {
- @Override
- public void onEvent(SensorEvent<Object> event) {
- entity.sensors().set(SENSOR, getConfig(PREFIX) + entity.getId());
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java b/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
deleted file mode 100644
index f04ac12..0000000
--- a/brooklyn-library/software/network/src/test/java/org/apache/brooklyn/entity/network/bind/TestBindDnsServerImpl.java
+++ /dev/null
@@ -1,89 +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.entity.network.bind;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntityLocal;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.ssh.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);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/pom.xml
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/pom.xml b/brooklyn-library/software/nosql/pom.xml
deleted file mode 100644
index f409e4b..0000000
--- a/brooklyn-library/software/nosql/pom.xml
+++ /dev/null
@@ -1,300 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>brooklyn-software-nosql</artifactId>
- <packaging>jar</packaging>
- <name>Brooklyn NoSQL Data Store Software Entities</name>
- <description>
- Brooklyn entities for NoSQL data store software entities
- </description>
-
- <parent>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-library</artifactId>
- <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-base</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <!-- Dependency versions mismatch between transitive dependencies, declare explicitly -->
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-webapp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <!-- just to access DatastoreMixins -->
- <artifactId>brooklyn-software-database</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-policy</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-utils-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- for mongodb sensors -->
- <dependency>
- <groupId>org.mongodb</groupId>
- <artifactId>mongo-java-driver</artifactId>
- <version>${mongodb.version}</version>
- </dependency>
-
- <!-- for redis testing -->
- <dependency>
- <groupId>redis.clients</groupId>
- <artifactId>jedis</artifactId>
- <version>${redis.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- for cassandra testing -->
- <dependency>
- <groupId>com.netflix.astyanax</groupId>
- <artifactId>astyanax</artifactId>
- <version>${astyanax.version}</version>
- <scope>test</scope>
- <exclusions>
- <!-- Dependency versions mismatch between transitive dependencies, declare explicitly -->
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>${jclouds.groupId}.provider</groupId>
- <artifactId>rackspace-cloudservers-uk</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- for couchdb testing -->
- <dependency>
- <groupId>com.google.code.jcouchdb</groupId>
- <artifactId>jcouchdb</artifactId>
- <version>${jcouchdb.version}</version>
- <scope>test</scope>
- <exclusions>
- <!-- Dependency versions mismatch between transitive dependencies, declare explicitly -->
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>httpcore</artifactId>
- <groupId>org.apache.httpcomponents</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- for hazelcast testing -->
- <dependency>
- <groupId>com.hazelcast</groupId>
- <artifactId>hazelcast-client</artifactId>
- <version>${hazelcast.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- for solr testing -->
- <dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-solrj</artifactId>
- <version>${solr.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${jclouds.groupId}.provider</groupId>
- <artifactId>aws-ec2</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-test-support</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-core</artifactId>
- <version>${project.version}</version><!--$NO-MVN-MAN-VER$-->
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-software-base</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <!-- bring in jclouds for testing -->
- <dependency>
- <groupId>org.apache.brooklyn</groupId>
- <artifactId>brooklyn-locations-jclouds</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Transitive dependencies, declared explicitly due to version mismatch -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec.version}</version>
- </dependency>
- </dependencies>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
- <!--
- Configuration artifacts (for installations) are based on templated defaults for
- the given components. These are files "without any degree of creativity" from the
- perspective of the Brooklyn/Apache contribution.
- -->
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/cassandra/cassandra-1.2.yaml</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/cassandra/cassandra-2.0.yaml</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/cassandra/cassandra-rackdc.properties</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/couchdb/couch.ini</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/couchdb/couch.uri</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/hazelcast/hazelcast-brooklyn.xml</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/default.conf</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/default-mongod.conf</exclude>
- <exclude>src/test/resources/test-mongodb.conf</exclude>
- <exclude>src/test/resources/test-mongodb-configserver.conf</exclude>
- <exclude>src/test/resources/test-mongodb-router.conf</exclude>
- <exclude>src/test/resources/mongodb-keyfile</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/redis/redis.conf</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/redis/slave.conf</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/riak/app.config</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/riak/vm.args</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/riak/riak.conf</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/riak/riak-mac.conf</exclude>
- <exclude>src/main/resources/org/apache/brooklyn/entity/nosql/solr/solr.xml</exclude>
-
- <!--
- The source code for cassandra-multicloud-snitch.jar is in sandbox/cassandra-multicloud-snitch.
- This snitch handles Cassandra datacenters in different cloud providers.
- The source will be contributed to the Cassandra project; when it is available in the
- Cassandra distro (and when we don't want to give backwards compatibility support for
- older Cassandra versions), then we can delete it from Brooklyn.
- -->
- <exclude>**/src/main/resources/brooklyn/entity/nosql/cassandra/cassandra-multicloud-snitch.jar</exclude>
-
- <!--
- This is a trivial Solr example, used for testing that a simple definition is deployed
- correctly. It is "without any degree of creativity". It is stored as a binary tgz, rather
- than us generating the tgz as part of the build, to keep the build process and testing
- simpler.
- -->
- <exclude>**/src/test/resources/solr/example.tgz</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraCluster.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraCluster.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraCluster.java
deleted file mode 100644
index c1c7674..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraCluster.java
+++ /dev/null
@@ -1,30 +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.entity.nosql.cassandra;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-
-/**
- * @deprecated since 0.7.0; use {@link CassandraDatacenter} which is equivalent but has
- * a less ambiguous name; <em>Cluster</em> in Cassandra corresponds to what Brooklyn terms a <em>Fabric</em>.
- */
-@Deprecated
-@ImplementedBy(CassandraClusterImpl.class)
-public interface CassandraCluster extends CassandraDatacenter {
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraClusterImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraClusterImpl.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraClusterImpl.java
deleted file mode 100644
index 7036285..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraClusterImpl.java
+++ /dev/null
@@ -1,27 +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.entity.nosql.cassandra;
-
-/**
- * @deprecated since 0.7.0; use {@link CassandraDatacenter} which is equivalent but has
- * a less ambiguous name; <em>Cluster</em> in Cassandra corresponds to what Brooklyn terms a <em>Fabric</em>.
- */
-@Deprecated
-public class CassandraClusterImpl extends CassandraDatacenterImpl implements CassandraCluster {
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/02abbab0/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenter.java
----------------------------------------------------------------------
diff --git a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenter.java b/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenter.java
deleted file mode 100644
index d9d2bbf..0000000
--- a/brooklyn-library/software/nosql/src/main/java/org/apache/brooklyn/entity/nosql/cassandra/CassandraDatacenter.java
+++ /dev/null
@@ -1,214 +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.entity.nosql.cassandra;
-
-import java.math.BigInteger;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.Catalog;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.ImplementedBy;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.annotation.Effector;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.effector.Effectors;
-import org.apache.brooklyn.core.effector.MethodEffector;
-import org.apache.brooklyn.core.sensor.BasicAttributeSensorAndConfigKey;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.entity.nosql.cassandra.TokenGenerators.PosNeg63TokenGenerator;
-import org.apache.brooklyn.entity.database.DatastoreMixins;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-import org.apache.brooklyn.util.core.flags.SetFromFlag;
-import org.apache.brooklyn.util.time.Duration;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.Multimap;
-import com.google.common.reflect.TypeToken;
-
-/**
- * A group of {@link CassandraNode}s -- based on Brooklyn's {@link DynamicCluster}
- * (though it is a "Datacenter" in Cassandra terms, where Cassandra's "cluster" corresponds
- * to a Brooklyn Fabric, cf {@link CassandraFabric}).
- * The Datacenter can be resized, manually or by policy if required.
- * Tokens are selected intelligently.
- * <p>
- * Note that due to how Cassandra assumes ports are the same across a cluster,
- * it is <em>NOT</em> possible to deploy a cluster of size larger than 1 to localhost.
- * (Some exploratory work has been done to use different 127.0.0.x IP's for localhost,
- * and there is evidence this could be made to work.)
- */
-@Catalog(name="Apache Cassandra Datacenter Cluster", description="Cassandra is a highly scalable, eventually " +
- "consistent, distributed, structured key-value store which provides a ColumnFamily-based data model " +
- "richer than typical key/value systems", iconUrl="classpath:///cassandra-logo.jpeg")
-@ImplementedBy(CassandraDatacenterImpl.class)
-public interface CassandraDatacenter extends DynamicCluster, DatastoreMixins.HasDatastoreUrl, DatastoreMixins.CanExecuteScript {
-
- // FIXME datacenter name -- also CASS_CLUSTER_NODES should be CASS_DC_NODES
- @SetFromFlag("clusterName")
- BasicAttributeSensorAndConfigKey<String> CLUSTER_NAME = new BasicAttributeSensorAndConfigKey<String>(String.class, "cassandra.cluster.name", "Name of the Cassandra cluster", "BrooklynCluster");
-
- @SetFromFlag("snitchName")
- ConfigKey<String> ENDPOINT_SNITCH_NAME = ConfigKeys.newStringConfigKey("cassandra.cluster.snitchName", "Type of the Cassandra snitch", "SimpleSnitch");
-
- @SetFromFlag("seedSupplier")
- @SuppressWarnings("serial")
- ConfigKey<Supplier<Set<Entity>>> SEED_SUPPLIER = ConfigKeys.newConfigKey(new TypeToken<Supplier<Set<Entity>>>() { }, "cassandra.cluster.seedSupplier", "For determining the seed nodes", null);
-
- @SuppressWarnings("serial")
- @SetFromFlag("tokenGeneratorClass")
- ConfigKey<Class<? extends TokenGenerator>> TOKEN_GENERATOR_CLASS = ConfigKeys.newConfigKey(
- new TypeToken<Class<? extends TokenGenerator>>() {}, "cassandra.cluster.tokenGenerator.class", "For determining the tokens of nodes",
- PosNeg63TokenGenerator.class);
-
- @SetFromFlag("tokenShift")
- ConfigKey<BigInteger> TOKEN_SHIFT = ConfigKeys.newConfigKey(BigInteger.class, "cassandra.cluster.tokenShift",
- "Delta applied to all tokens generated for this Cassandra datacenter, "
- + "useful when configuring multiple datacenters which should be shifted; "
- + "if not set, a random shift is applied. (Pass 0 to prevent any shift.)", null);
-
- ConfigKey<Boolean> USE_VNODES = ConfigKeys.newBooleanConfigKey(
- "cassandra.cluster.useVnodes",
- "Determines whether to use vnodes; if doing so, tokens will not be explicitly assigned to nodes in the cluster",
- false);
-
- /**
- * num_tokens will automatically be reset to 1 for each node if {@link #USE_VNODES} is false.
- */
- ConfigKey<Integer> NUM_TOKENS_PER_NODE = ConfigKeys.newIntegerConfigKey("cassandra.numTokensPerNode",
- "Number of tokens per node; if using vnodes, should set this to a value like 256; will be overridden to 1 if USE_VNODES==false",
- 256);
-
- /**
- * Additional time after the nodes in the cluster are up when starting
- * before announcing the cluster as up.
- * <p>
- * Useful to ensure nodes have synchronized.
- * <p>
- * On 1.2.2 this could be as much as 120s when using 2 seed nodes,
- * or just a few seconds with 1 seed node. On 1.2.9 it seems a few
- * seconds is sufficient even with 2 seed nodes
- */
- @SetFromFlag("delayBeforeAdvertisingCluster")
- ConfigKey<Duration> DELAY_BEFORE_ADVERTISING_CLUSTER = ConfigKeys.newConfigKey(Duration.class, "cassandra.cluster.delayBeforeAdvertisingCluster", "Delay after cluster is started before checking and advertising its availability", Duration.TEN_SECONDS);
-
- @SuppressWarnings("serial")
- AttributeSensor<Multimap<String,Entity>> DATACENTER_USAGE = Sensors.newSensor(new TypeToken<Multimap<String,Entity>>() { }, "cassandra.cluster.datacenterUsages", "Current set of datacenters in use, with nodes in each");
-
- @SuppressWarnings("serial")
- AttributeSensor<Set<String>> DATACENTERS = Sensors.newSensor(new TypeToken<Set<String>>() { }, "cassandra.cluster.datacenters", "Current set of datacenters in use");
-
- AttributeSensor<Boolean> HAS_PUBLISHED_SEEDS = Sensors.newBooleanSensor("cassandra.cluster.seeds.hasPublished", "Whether we have published any seeds");
-
- @SuppressWarnings("serial")
- AttributeSensor<Set<Entity>> CURRENT_SEEDS = Sensors.newSensor(new TypeToken<Set<Entity>>() { }, "cassandra.cluster.seeds.current", "Current set of seeds to use to bootstrap the cluster");
-
- AttributeSensor<String> HOSTNAME = Sensors.newStringSensor("cassandra.cluster.hostname", "Hostname to connect to cluster with");
-
- @SuppressWarnings("serial")
- AttributeSensor<List<String>> CASSANDRA_CLUSTER_NODES = Sensors.newSensor(new TypeToken<List<String>>() {},
- "cassandra.cluster.nodes", "List of host:port of all active nodes in the cluster (thrift port, and public hostname/IP)");
-
- AttributeSensor<Integer> THRIFT_PORT = Sensors.newIntegerSensor("cassandra.cluster.thrift.port", "Cassandra Thrift RPC port to connect to cluster with");
-
- AttributeSensor<Long> FIRST_NODE_STARTED_TIME_UTC = Sensors.newLongSensor("cassandra.cluster.first.node.started.utc", "Time (UTC) when the first node was started");
- @SuppressWarnings("serial")
- AttributeSensor<List<Entity>> QUEUED_START_NODES = Sensors.newSensor(new TypeToken<List<Entity>>() {}, "cassandra.cluster.start.nodes.queued",
- "Nodes queued for starting (for sequential start)");
-
- AttributeSensor<Integer> SCHEMA_VERSION_COUNT = Sensors.newIntegerSensor("cassandra.cluster.schema.versions.count",
- "Number of different schema versions in the cluster; should be 1 for a healthy cluster, 0 when off; " +
- "2 and above indicats a Schema Disagreement Error (and keyspace access may fail)");
-
- AttributeSensor<Long> READ_PENDING = Sensors.newLongSensor("cassandra.cluster.read.pending", "Current pending ReadStage tasks");
- AttributeSensor<Integer> READ_ACTIVE = Sensors.newIntegerSensor("cassandra.cluster.read.active", "Current active ReadStage tasks");
- AttributeSensor<Long> WRITE_PENDING = Sensors.newLongSensor("cassandra.cluster.write.pending", "Current pending MutationStage tasks");
- AttributeSensor<Integer> WRITE_ACTIVE = Sensors.newIntegerSensor("cassandra.cluster.write.active", "Current active MutationStage tasks");
-
- AttributeSensor<Long> THRIFT_PORT_LATENCY_PER_NODE = Sensors.newLongSensor("cassandra.cluster.thrift.latency.perNode", "Latency for thrift port connection averaged over all nodes (ms)");
- AttributeSensor<Double> READS_PER_SECOND_LAST_PER_NODE = Sensors.newDoubleSensor("cassandra.reads.perSec.last.perNode", "Reads/sec (last datapoint) averaged over all nodes");
- AttributeSensor<Double> WRITES_PER_SECOND_LAST_PER_NODE = Sensors.newDoubleSensor("cassandra.write.perSec.last.perNode", "Writes/sec (last datapoint) averaged over all nodes");
- AttributeSensor<Double> PROCESS_CPU_TIME_FRACTION_LAST_PER_NODE = Sensors.newDoubleSensor("cassandra.cluster.metrics.processCpuTime.fraction.perNode", "Fraction of CPU time used (percentage reported by JMX), averaged over all nodes");
-
- AttributeSensor<Double> READS_PER_SECOND_IN_WINDOW_PER_NODE = Sensors.newDoubleSensor("cassandra.reads.perSec.windowed.perNode", "Reads/sec (over time window) averaged over all nodes");
- AttributeSensor<Double> WRITES_PER_SECOND_IN_WINDOW_PER_NODE = Sensors.newDoubleSensor("cassandra.writes.perSec.windowed.perNode", "Writes/sec (over time window) averaged over all nodes");
- AttributeSensor<Double> THRIFT_PORT_LATENCY_IN_WINDOW_PER_NODE = Sensors.newDoubleSensor("cassandra.thrift.latency.windowed.perNode", "Latency for thrift port (ms, over time window) averaged over all nodes");
- AttributeSensor<Double> PROCESS_CPU_TIME_FRACTION_IN_WINDOW_PER_NODE = Sensors.newDoubleSensor("cassandra.cluster.metrics.processCpuTime.fraction.windowed", "Fraction of CPU time used (percentage, over time window), averaged over all nodes");
-
- MethodEffector<Void> UPDATE = new MethodEffector<Void>(CassandraDatacenter.class, "update");
-
- org.apache.brooklyn.api.effector.Effector<String> EXECUTE_SCRIPT = Effectors.effector(DatastoreMixins.EXECUTE_SCRIPT)
- .description("executes the given script contents using cassandra-cli")
- .buildAbstract();
-
- /**
- * Sets the number of nodes used to seed the cluster.
- * <p>
- * Version 1.2.2 is buggy and requires a big delay for 2 nodes both seeds to reconcile,
- * with 1.2.9 this seems fine, with just a few seconds' delay after starting.
- *
- * @see <a href="http://stackoverflow.com/questions/6770894/schemadisagreementexception/18639005" />
- */
- int DEFAULT_SEED_QUORUM = 2;
-
- /**
- * Can insert a delay after the first node comes up.
- * <p>
- * Reportedly not needed with 1.2.9, but we are still seeing some seed failures so re-introducing it.
- * (This does not seem to help with the bug in 1.2.2.)
- */
- Duration DELAY_AFTER_FIRST = Duration.ONE_MINUTE;
-
- /**
- * If set (ie non-null), this waits the indicated time after a successful launch of one node
- * before starting the next. (If it is null, all nodes start simultaneously,
- * possibly after the DELAY_AFTER_FIRST.)
- * <p>
- * When subsequent nodes start simultaneously, we occasionally see schema disagreement problems;
- * if nodes start sequentially, we occasionally get "no sources for (tokenRange]" problems.
- * Either way the node stops. Ideally this can be solved at the Cassandra level,
- * but if not, we will have to introduce some restarts at the Cassandra nodes (which does seem
- * to resolve the problems.)
- */
- Duration DELAY_BETWEEN_STARTS = null;
-
- /**
- * Whether to wait for the first node to start up
- * <p>
- * not sure whether this is needed or not. Need to test in env where not all nodes are seed nodes,
- * what happens if non-seed nodes start before the seed nodes?
- */
- boolean WAIT_FOR_FIRST = true;
-
- @Effector(description="Updates the cluster members")
- void update();
-
- /**
- * The name of the cluster.
- */
- String getClusterName();
-
- Set<Entity> gatherPotentialSeeds();
-
- Set<Entity> gatherPotentialRunningSeeds();
-
- String executeScript(String commands);
-
-}