diff --git a/.travis.yml b/.travis.yml
index fe777404..b01bc2ee 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,9 +14,9 @@ install:
- ./mvnw --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true
- ./docs/src/main/asciidoc/ghpages.sh
script:
-- ./consul agent -server -advertise 127.0.0.1 -bootstrap-expect 1 -data-dir /tmp/consul -ui-dir ./src/test/resources/consul_ui &
-- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw --settings .settings.xml deploy -nsu -Dmaven.test.redirectTestOutputToFile=true'
-- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw --settings .settings.xml install -nsu -Dmaven.test.redirectTestOutputToFile=true'
+- ./src/test/bash/travis_run_consul.sh
+- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw -P ci --settings .settings.xml deploy -nsu -Dmaven.test.redirectTestOutputToFile=true'
+- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw -P ci --settings .settings.xml install -nsu -Dmaven.test.redirectTestOutputToFile=true'
env:
global:
- GIT_NAME="Spencer Gibb"
diff --git a/pom.xml b/pom.xml
index 1c242d06..6a256e14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,6 +121,35 @@
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/ConsulDiscoveryClientAclTests.java
+
+
+
+
+
+
+ ci
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ **/ConsulPropertySourceLocatorTests.java
+
+
+
+
+
+
diff --git a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientAclTests.java b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientAclTests.java
new file mode 100644
index 00000000..de34ff87
--- /dev/null
+++ b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientAclTests.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed 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.springframework.cloud.consul.discovery;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.WebIntegrationTest;
+import org.springframework.cloud.client.ServiceInstance;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.consul.ConsulAutoConfiguration;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * @author Spencer Gibb
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration(classes = ConsulDiscoveryClientAclTests.MyTestConfig.class)
+@WebIntegrationTest(value = {"spring.application.name=testConsulDiscoveryAcl",
+ "spring.cloud.consul.discovery.preferIpAddress=true",
+ "spring.cloud.consul.discovery.aclToken=2d2e6b3b-1c82-40ab-8171-54609d8ad304"}, randomPort = true)
+public class ConsulDiscoveryClientAclTests {
+
+ @Autowired
+ private ConsulDiscoveryClient discoveryClient;
+
+ @Test
+ public void getInstancesForThisServiceWorks() {
+ List instances = discoveryClient.getInstances("testConsulDiscovery");
+ assertNotNull("instances was null", instances);
+ assertFalse("instances was empty", instances.isEmpty());
+ }
+
+ @Configuration
+ @EnableDiscoveryClient
+ @EnableAutoConfiguration
+ @Import({ ConsulAutoConfiguration.class, ConsulDiscoveryClientConfiguration.class })
+ public static class MyTestConfig {
+
+ }
+}
diff --git a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientTests.java b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientTests.java
index cae7de89..38005ef5 100644
--- a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientTests.java
+++ b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClientTests.java
@@ -38,7 +38,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ConsulDiscoveryClientTests.MyTestConfig.class)
-@WebIntegrationTest(value = {"spring.application.name=testConsulDiscovery", "spring.cloud.consul.discovery.preferIpAddress=true"}, randomPort = true)
+@WebIntegrationTest(value = {"spring.application.name=testConsulDiscovery",
+ "spring.cloud.consul.discovery.preferIpAddress=true"}, randomPort = true)
public class ConsulDiscoveryClientTests {
@Autowired
diff --git a/src/main/bash/local_run_consul.sh b/src/main/bash/local_run_consul.sh
index 3f262b21..9f1054d2 100755
--- a/src/main/bash/local_run_consul.sh
+++ b/src/main/bash/local_run_consul.sh
@@ -1,3 +1,4 @@
#!/bin/bash
mkdir /tmp/consul-config
-consul agent -server -bootstrap-expect 1 -advertise 127.0.0.1 -data-dir /tmp/consul -config-dir=/tmp/consul-config -ui-dir `dirname $0`/../../../src/test/resources/consul_ui
+BASEDIR=`dirname $0`/../../..
+consul agent -server -bootstrap-expect 1 -advertise 127.0.0.1 -data-dir /tmp/consul -config-dir=/tmp/consul-config -ui-dir ${BASEDIR}/src/test/resources/consul_ui
diff --git a/src/test/bash/travis_run_consul.sh b/src/test/bash/travis_run_consul.sh
new file mode 100755
index 00000000..881ff5df
--- /dev/null
+++ b/src/test/bash/travis_run_consul.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+BASEDIR=`dirname $0`/../../..
+${BASEDIR}/consul agent -server -bootstrap-expect 1 -advertise 127.0.0.1 -data-dir /tmp/consul -ui-dir ${BASEDIR}/src/test/resources/consul_ui -config-dir ${BASEDIR}/src/test/resources/consul_config &
+# wait for consul to elect a leader before sending acl
+sleep 5
+curl -X PUT -d @`dirname $0`/../../test/resources/consul_acl/consul_discovery_client_acl.json http://localhost:8500/v1/acl/create?token=2ee647bd-bd69-4118-9f34-b9a6e9e60746
diff --git a/src/test/resources/consul_acl/consul_discovery_client_acl.json b/src/test/resources/consul_acl/consul_discovery_client_acl.json
new file mode 100644
index 00000000..a458cb15
--- /dev/null
+++ b/src/test/resources/consul_acl/consul_discovery_client_acl.json
@@ -0,0 +1,12 @@
+{
+ "ID": "2d2e6b3b-1c82-40ab-8171-54609d8ad304",
+ "Name": "discover_client_test_acl",
+ "Type": "client",
+ "Rules": "{
+ \"service\": {
+ \"testConsulDiscoveryAcl\": {
+ \"policy\": \"write\"
+ }
+ }
+ }"
+}
diff --git a/src/test/resources/consul_config/acl_config.json b/src/test/resources/consul_config/acl_config.json
new file mode 100644
index 00000000..ea9e761b
--- /dev/null
+++ b/src/test/resources/consul_config/acl_config.json
@@ -0,0 +1,6 @@
+{
+ "datacenter": "local",
+ "acl_datacenter": "local",
+ "acl_master_token": "2ee647bd-bd69-4118-9f34-b9a6e9e60746",
+ "acl_default_policy": "deny"
+}