knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [47/49] knox git commit: KNOX-998 - Merge from trunk 0.14.0 code
Date Thu, 14 Dec 2017 21:13:34 GMT
http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
deleted file mode 100644
index 0bfc39a..0000000
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
+++ /dev/null
@@ -1,263 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.gateway.config.GatewayConfig;
-import org.apache.hadoop.gateway.service.config.remote.config.RemoteConfigurationRegistriesAccessor;
-import org.apache.hadoop.gateway.services.ServiceLifecycleException;
-import org.apache.hadoop.gateway.services.config.client.RemoteConfigurationRegistryClient;
-import org.apache.hadoop.gateway.services.config.client.RemoteConfigurationRegistryClientService;
-import org.apache.hadoop.gateway.services.security.AliasService;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.PosixFilePermission;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Function;
-
-/**
- * An implementation of RemoteConfigurationRegistryClientService intended to be used for testing without having to
- * connect to an actual remote configuration registry.
- */
-public class LocalFileSystemRemoteConfigurationRegistryClientService implements RemoteConfigurationRegistryClientService {
-
-    public static final String TYPE = "LocalFileSystem";
-
-    private Map<String, RemoteConfigurationRegistryClient> clients = new HashMap<>();
-
-
-    @Override
-    public void setAliasService(AliasService aliasService) {
-        // N/A
-    }
-
-    @Override
-    public RemoteConfigurationRegistryClient get(String name) {
-        return clients.get(name);
-    }
-
-    @Override
-    public void init(GatewayConfig config, Map<String, String> options) throws ServiceLifecycleException {
-        List<RemoteConfigurationRegistryConfig> registryConfigurations =
-                                        RemoteConfigurationRegistriesAccessor.getRemoteRegistryConfigurations(config);
-        for (RemoteConfigurationRegistryConfig registryConfig : registryConfigurations) {
-            if (TYPE.equalsIgnoreCase(registryConfig.getRegistryType())) {
-                RemoteConfigurationRegistryClient registryClient = createClient(registryConfig);
-                clients.put(registryConfig.getName(), registryClient);
-            }
-        }
-    }
-
-    @Override
-    public void start() throws ServiceLifecycleException {
-
-    }
-
-    @Override
-    public void stop() throws ServiceLifecycleException {
-
-    }
-
-
-    private RemoteConfigurationRegistryClient createClient(RemoteConfigurationRegistryConfig config) {
-        String rootDir = config.getConnectionString();
-
-        return new RemoteConfigurationRegistryClient() {
-            private File root = new File(rootDir);
-
-            @Override
-            public String getAddress() {
-                return root.getAbsolutePath();
-            }
-
-            @Override
-            public boolean entryExists(String path) {
-                return (new File(root, path)).exists();
-            }
-
-            @Override
-            public List<EntryACL> getACL(String path) {
-                List<EntryACL> result = new ArrayList<>();
-
-                Path resolved = Paths.get(rootDir, path);
-                try {
-                    Map<String, List<String>> collected = new HashMap<>();
-
-                    Set<PosixFilePermission> perms = Files.getPosixFilePermissions(resolved);
-                    for (PosixFilePermission perm : perms) {
-                        String[] parsed = perm.toString().split("_");
-                        collected.computeIfAbsent(parsed[0].toLowerCase(), s -> new ArrayList<>()).add(parsed[1].toLowerCase());
-                    }
-
-                    for (String id : collected.keySet()) {
-                        EntryACL acl = new EntryACL() {
-                            @Override
-                            public String getId() {
-                                return id;
-                            }
-
-                            @Override
-                            public String getType() {
-                                return "fs";
-                            }
-
-                            @Override
-                            public Object getPermissions() {
-                                return collected.get(id).toString();
-                            }
-
-                            @Override
-                            public boolean canRead() {
-                                return true;
-                            }
-
-                            @Override
-                            public boolean canWrite() {
-                                return true;
-                            }
-                        };
-                        result.add(acl);
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-                return result;
-            }
-
-            @Override
-            public List<String> listChildEntries(String path) {
-                List<String> result = new ArrayList<>();
-
-                File entry = new File(root, path);
-                if (entry.exists() && entry.isDirectory()) {
-                    String[] list = entry.list();
-                    if (list != null) {
-                        result.addAll(Arrays.asList(entry.list()));
-                    }
-                }
-
-                return result;
-            }
-
-            @Override
-            public String getEntryData(String path) {
-                return getEntryData(path, "UTF-8");
-            }
-
-            @Override
-            public String getEntryData(String path, String encoding) {
-                String result = null;
-                File entry = new File(root, path);
-                if (entry.isFile() && entry.exists()) {
-                    try {
-                        result = FileUtils.readFileToString(entry, encoding);
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-                return result;
-            }
-
-            @Override
-            public void createEntry(String path) {
-                createEntry(path, "");
-            }
-
-            @Override
-            public void createEntry(String path, String data) {
-                createEntry(path, data, "UTF-8");
-            }
-
-            @Override
-            public void createEntry(String path, String data, String encoding) {
-                File entry = new File(root, path);
-                if (!entry.exists()) {
-                    if (data != null) {
-                        try {
-                            FileUtils.writeStringToFile(entry, data, encoding);
-                        } catch (IOException e) {
-                            e.printStackTrace();
-                        }
-                    }
-                }
-            }
-
-            @Override
-            public int setEntryData(String path, String data) {
-                setEntryData(path, data, "UTF-8");
-                return 0;
-            }
-
-            @Override
-            public int setEntryData(String path, String data, String encoding) {
-                File entry = new File(root, path);
-                if (entry.exists()) {
-                    try {
-                        FileUtils.writeStringToFile(entry, data, encoding);
-                    } catch (IOException e) {
-                        e.printStackTrace();
-                    }
-                }
-                return 0;
-            }
-
-            @Override
-            public boolean isAuthenticationConfigured() {
-                return false;
-            }
-
-            @Override
-            public void setACL(String path, List<EntryACL> acls) {
-                //
-            }
-
-            @Override
-            public void deleteEntry(String path) {
-                File entry = new File(root, path);
-                if (entry.exists()) {
-                    entry.delete();
-                }
-            }
-
-            @Override
-            public void addChildEntryListener(String path, ChildEntryListener listener) throws Exception {
-                // N/A
-            }
-
-            @Override
-            public void addEntryListener(String path, EntryListener listener) throws Exception {
-                // N/A
-            }
-
-            @Override
-            public void removeEntryListener(String path) throws Exception {
-                // N/A
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java
deleted file mode 100644
index 42e79c1..0000000
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote;
-
-import org.apache.hadoop.gateway.services.config.client.RemoteConfigurationRegistryClientService;
-
-public class LocalFileSystemRemoteConfigurationRegistryClientServiceProvider implements RemoteConfigurationRegistryClientServiceProvider {
-
-    @Override
-    public String getType() {
-        return LocalFileSystemRemoteConfigurationRegistryClientService.TYPE;
-    }
-
-    @Override
-    public RemoteConfigurationRegistryClientService newInstance() {
-        return new LocalFileSystemRemoteConfigurationRegistryClientService();
-    }
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
deleted file mode 100644
index 1c4ed6e..0000000
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
+++ /dev/null
@@ -1,355 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.topology.monitor;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.retry.ExponentialBackoffRetry;
-import org.apache.curator.test.InstanceSpec;
-import org.apache.curator.test.TestingCluster;
-import org.apache.hadoop.gateway.config.GatewayConfig;
-import org.apache.hadoop.gateway.service.config.remote.zk.ZooKeeperClientService;
-import org.apache.hadoop.gateway.service.config.remote.zk.ZooKeeperClientServiceProvider;
-import org.apache.hadoop.gateway.services.config.client.RemoteConfigurationRegistryClientService;
-import org.apache.hadoop.gateway.services.security.AliasService;
-import org.apache.hadoop.test.TestUtils;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.easymock.EasyMock;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Test the ZooKeeperConfigMonitor WITHOUT SASL configured or znode ACLs applied.
- * The implementation of the monitor is the same regardless, since the ACLs are defined by the ZooKeeper znode
- * creator, and the SASL config is purely JAAS (and external to the implementation).
- */
-public class ZooKeeperConfigurationMonitorTest {
-
-    private static final String PATH_KNOX = "/knox";
-    private static final String PATH_KNOX_CONFIG = PATH_KNOX + "/config";
-    private static final String PATH_KNOX_PROVIDERS = PATH_KNOX_CONFIG + "/shared-providers";
-    private static final String PATH_KNOX_DESCRIPTORS = PATH_KNOX_CONFIG + "/descriptors";
-
-    private static File testTmp;
-    private static File providersDir;
-    private static File descriptorsDir;
-
-    private static TestingCluster zkCluster;
-
-    private static CuratorFramework client;
-
-    private GatewayConfig gc;
-
-
-    @BeforeClass
-    public static void setupSuite() throws Exception {
-        testTmp = TestUtils.createTempDir(ZooKeeperConfigurationMonitorTest.class.getName());
-        File confDir   = TestUtils.createTempDir(testTmp + "/conf");
-        providersDir   = TestUtils.createTempDir(confDir + "/shared-providers");
-        descriptorsDir = TestUtils.createTempDir(confDir + "/descriptors");
-
-        configureAndStartZKCluster();
-    }
-
-    private static void configureAndStartZKCluster() throws Exception {
-        // Configure security for the ZK cluster instances
-        Map<String, Object> customInstanceSpecProps = new HashMap<>();
-        customInstanceSpecProps.put("authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
-        customInstanceSpecProps.put("requireClientAuthScheme", "sasl");
-
-        // Define the test cluster
-        List<InstanceSpec> instanceSpecs = new ArrayList<>();
-        for (int i = 0 ; i < 3 ; i++) {
-            InstanceSpec is = new InstanceSpec(null, -1, -1, -1, false, (i+1), -1, -1, customInstanceSpecProps);
-            instanceSpecs.add(is);
-        }
-        zkCluster = new TestingCluster(instanceSpecs);
-
-        // Start the cluster
-        zkCluster.start();
-
-        // Create the client for the test cluster
-        client = CuratorFrameworkFactory.builder()
-                                        .connectString(zkCluster.getConnectString())
-                                        .retryPolicy(new ExponentialBackoffRetry(100, 3))
-                                        .build();
-        assertNotNull(client);
-        client.start();
-
-        // Create the knox config paths with an ACL for the sasl user configured for the client
-        List<ACL> acls = new ArrayList<>();
-        acls.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.ANYONE_ID_UNSAFE));
-
-        client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).withACL(acls).forPath(PATH_KNOX_DESCRIPTORS);
-        assertNotNull("Failed to create node:" + PATH_KNOX_DESCRIPTORS,
-                client.checkExists().forPath(PATH_KNOX_DESCRIPTORS));
-        client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).withACL(acls).forPath(PATH_KNOX_PROVIDERS);
-        assertNotNull("Failed to create node:" + PATH_KNOX_PROVIDERS,
-                client.checkExists().forPath(PATH_KNOX_PROVIDERS));
-    }
-
-    @AfterClass
-    public static void tearDownSuite() throws Exception {
-        // Clean up the ZK nodes, and close the client
-        if (client != null) {
-            client.delete().deletingChildrenIfNeeded().forPath(PATH_KNOX);
-            client.close();
-        }
-
-        // Shutdown the ZK cluster
-        zkCluster.close();
-
-        // Delete the working dir
-        testTmp.delete();
-    }
-
-    @Test
-    public void testZooKeeperConfigMonitor() throws Exception {
-        String configMonitorName = "remoteConfigMonitorClient";
-
-        // Setup the base GatewayConfig mock
-        gc = EasyMock.createNiceMock(GatewayConfig.class);
-        EasyMock.expect(gc.getGatewayProvidersConfigDir()).andReturn(providersDir.getAbsolutePath()).anyTimes();
-        EasyMock.expect(gc.getGatewayDescriptorsDir()).andReturn(descriptorsDir.getAbsolutePath()).anyTimes();
-        EasyMock.expect(gc.getRemoteRegistryConfigurationNames())
-                .andReturn(Collections.singletonList(configMonitorName))
-                .anyTimes();
-        final String registryConfig =
-                                GatewayConfig.REMOTE_CONFIG_REGISTRY_TYPE + "=" + ZooKeeperClientService.TYPE + ";" +
-                                GatewayConfig.REMOTE_CONFIG_REGISTRY_ADDRESS + "=" + zkCluster.getConnectString();
-        EasyMock.expect(gc.getRemoteRegistryConfiguration(configMonitorName))
-                .andReturn(registryConfig)
-                .anyTimes();
-        EasyMock.expect(gc.getRemoteConfigurationMonitorClientName()).andReturn(configMonitorName).anyTimes();
-        EasyMock.replay(gc);
-
-        AliasService aliasService = EasyMock.createNiceMock(AliasService.class);
-        EasyMock.replay(aliasService);
-
-        RemoteConfigurationRegistryClientService clientService = (new ZooKeeperClientServiceProvider()).newInstance();
-        clientService.setAliasService(aliasService);
-        clientService.init(gc, Collections.emptyMap());
-        clientService.start();
-
-        DefaultRemoteConfigurationMonitor cm = new DefaultRemoteConfigurationMonitor(gc, clientService);
-
-        try {
-            cm.start();
-        } catch (Exception e) {
-            fail("Failed to start monitor: " + e.getMessage());
-        }
-
-        try {
-            final String pc_one_znode = getProviderPath("providers-config1.xml");
-            final File pc_one         = new File(providersDir, "providers-config1.xml");
-            final String pc_two_znode = getProviderPath("providers-config2.xml");
-            final File pc_two         = new File(providersDir, "providers-config2.xml");
-
-            client.create().withMode(CreateMode.PERSISTENT).forPath(pc_one_znode, TEST_PROVIDERS_CONFIG_1.getBytes());
-            Thread.sleep(100);
-            assertTrue(pc_one.exists());
-            assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_one));
-
-            client.create().withMode(CreateMode.PERSISTENT).forPath(getProviderPath("providers-config2.xml"), TEST_PROVIDERS_CONFIG_2.getBytes());
-            Thread.sleep(100);
-            assertTrue(pc_two.exists());
-            assertEquals(TEST_PROVIDERS_CONFIG_2, FileUtils.readFileToString(pc_two));
-
-            client.setData().forPath(pc_two_znode, TEST_PROVIDERS_CONFIG_1.getBytes());
-            Thread.sleep(100);
-            assertTrue(pc_two.exists());
-            assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_two));
-
-            client.delete().forPath(pc_two_znode);
-            Thread.sleep(100);
-            assertFalse(pc_two.exists());
-
-            client.delete().forPath(pc_one_znode);
-            Thread.sleep(100);
-            assertFalse(pc_one.exists());
-
-            final String desc_one_znode   = getDescriptorPath("test1.json");
-            final String desc_two_znode   = getDescriptorPath("test2.json");
-            final String desc_three_znode = getDescriptorPath("test3.json");
-            final File desc_one           = new File(descriptorsDir, "test1.json");
-            final File desc_two           = new File(descriptorsDir, "test2.json");
-            final File desc_three         = new File(descriptorsDir, "test3.json");
-
-            client.create().withMode(CreateMode.PERSISTENT).forPath(desc_one_znode, TEST_DESCRIPTOR_1.getBytes());
-            Thread.sleep(100);
-            assertTrue(desc_one.exists());
-            assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_one));
-
-            client.create().withMode(CreateMode.PERSISTENT).forPath(desc_two_znode, TEST_DESCRIPTOR_1.getBytes());
-            Thread.sleep(100);
-            assertTrue(desc_two.exists());
-            assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_two));
-
-            client.setData().forPath(desc_two_znode, TEST_DESCRIPTOR_2.getBytes());
-            Thread.sleep(100);
-            assertTrue(desc_two.exists());
-            assertEquals(TEST_DESCRIPTOR_2, FileUtils.readFileToString(desc_two));
-
-            client.create().withMode(CreateMode.PERSISTENT).forPath(desc_three_znode, TEST_DESCRIPTOR_1.getBytes());
-            Thread.sleep(100);
-            assertTrue(desc_three.exists());
-            assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_three));
-
-            client.delete().forPath(desc_two_znode);
-            Thread.sleep(100);
-            assertFalse("Expected test2.json to have been deleted.", desc_two.exists());
-
-            client.delete().forPath(desc_three_znode);
-            Thread.sleep(100);
-            assertFalse(desc_three.exists());
-
-            client.delete().forPath(desc_one_znode);
-            Thread.sleep(100);
-            assertFalse(desc_one.exists());
-        } finally {
-            cm.stop();
-        }
-    }
-
-    private static String getDescriptorPath(String descriptorName) {
-        return PATH_KNOX_DESCRIPTORS + "/" + descriptorName;
-    }
-
-    private static String getProviderPath(String providerConfigName) {
-        return PATH_KNOX_PROVIDERS + "/" + providerConfigName;
-    }
-
-
-    private static final String TEST_PROVIDERS_CONFIG_1 =
-            "<gateway>\n" +
-            "    <provider>\n" +
-            "        <role>identity-assertion</role>\n" +
-            "        <name>Default</name>\n" +
-            "        <enabled>true</enabled>\n" +
-            "    </provider>\n" +
-            "    <provider>\n" +
-            "        <role>hostmap</role>\n" +
-            "        <name>static</name>\n" +
-            "        <enabled>true</enabled>\n" +
-            "        <param><name>localhost</name><value>sandbox,sandbox.hortonworks.com</value></param>\n" +
-            "    </provider>\n" +
-            "</gateway>\n";
-
-    private static final String TEST_PROVIDERS_CONFIG_2 =
-            "<gateway>\n" +
-            "    <provider>\n" +
-            "        <role>authentication</role>\n" +
-            "        <name>ShiroProvider</name>\n" +
-            "        <enabled>true</enabled>\n" +
-            "        <param>\n" +
-            "            <name>sessionTimeout</name>\n" +
-            "            <value>30</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>main.ldapRealm</name>\n" +
-            "            <value>org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>main.ldapContextFactory</name>\n" +
-            "            <value>org.apache.hadoop.gateway.shirorealm.KnoxLdapContextFactory</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>main.ldapRealm.contextFactory</name>\n" +
-            "            <value>$ldapContextFactory</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>main.ldapRealm.userDnTemplate</name>\n" +
-            "            <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>main.ldapRealm.contextFactory.url</name>\n" +
-            "            <value>ldap://localhost:33389</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>main.ldapRealm.contextFactory.authenticationMechanism</name>\n" +
-            "            <value>simple</value>\n" +
-            "        </param>\n" +
-            "        <param>\n" +
-            "            <name>urls./**</name>\n" +
-            "            <value>authcBasic</value>\n" +
-            "        </param>\n" +
-            "    </provider>\n" +
-            "</gateway>\n";
-
-    private static final String TEST_DESCRIPTOR_1 =
-            "{\n" +
-            "  \"discovery-type\":\"AMBARI\",\n" +
-            "  \"discovery-address\":\"http://sandbox.hortonworks.com:8080\",\n" +
-            "  \"discovery-user\":\"maria_dev\",\n" +
-            "  \"discovery-pwd-alias\":\"sandbox.ambari.discovery.password\",\n" +
-            "  \"provider-config-ref\":\"sandbox-providers.xml\",\n" +
-            "  \"cluster\":\"Sandbox\",\n" +
-            "  \"services\":[\n" +
-            "    {\"name\":\"NODEUI\"},\n" +
-            "    {\"name\":\"YARNUI\"},\n" +
-            "    {\"name\":\"HDFSUI\"},\n" +
-            "    {\"name\":\"OOZIEUI\"},\n" +
-            "    {\"name\":\"HBASEUI\"},\n" +
-            "    {\"name\":\"NAMENODE\"},\n" +
-            "    {\"name\":\"JOBTRACKER\"},\n" +
-            "    {\"name\":\"WEBHDFS\"},\n" +
-            "    {\"name\":\"WEBHCAT\"},\n" +
-            "    {\"name\":\"OOZIE\"},\n" +
-            "    {\"name\":\"WEBHBASE\"},\n" +
-            "    {\"name\":\"RESOURCEMANAGER\"},\n" +
-            "    {\"name\":\"AMBARI\", \"urls\":[\"http://c6401.ambari.apache.org:8080\"]},\n" +
-            "    {\"name\":\"AMBARIUI\", \"urls\":[\"http://c6401.ambari.apache.org:8080\"]}\n" +
-            "  ]\n" +
-            "}\n";
-
-    private static final String TEST_DESCRIPTOR_2 =
-            "{\n" +
-            "  \"discovery-type\":\"AMBARI\",\n" +
-            "  \"discovery-address\":\"http://sandbox.hortonworks.com:8080\",\n" +
-            "  \"discovery-user\":\"maria_dev\",\n" +
-            "  \"discovery-pwd-alias\":\"sandbox.ambari.discovery.password\",\n" +
-            "  \"provider-config-ref\":\"sandbox-providers.xml\",\n" +
-            "  \"cluster\":\"Sandbox\",\n" +
-            "  \"services\":[\n" +
-            "    {\"name\":\"NAMENODE\"},\n" +
-            "    {\"name\":\"JOBTRACKER\"},\n" +
-            "    {\"name\":\"WEBHDFS\"},\n" +
-            "    {\"name\":\"WEBHCAT\"},\n" +
-            "    {\"name\":\"OOZIE\"},\n" +
-            "    {\"name\":\"WEBHBASE\"},\n" +
-            "    {\"name\":\"RESOURCEMANAGER\"}\n" +
-            "  ]\n" +
-            "}\n";
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java b/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
new file mode 100644
index 0000000..3bf7d2e
--- /dev/null
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientService.java
@@ -0,0 +1,263 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.knox.gateway.service.config.remote;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.service.config.remote.config.RemoteConfigurationRegistriesAccessor;
+import org.apache.knox.gateway.services.ServiceLifecycleException;
+import org.apache.knox.gateway.services.config.client.RemoteConfigurationRegistryClient;
+import org.apache.knox.gateway.services.config.client.RemoteConfigurationRegistryClientService;
+import org.apache.knox.gateway.services.security.AliasService;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+
+/**
+ * An implementation of RemoteConfigurationRegistryClientService intended to be used for testing without having to
+ * connect to an actual remote configuration registry.
+ */
+public class LocalFileSystemRemoteConfigurationRegistryClientService implements RemoteConfigurationRegistryClientService {
+
+    public static final String TYPE = "LocalFileSystem";
+
+    private Map<String, RemoteConfigurationRegistryClient> clients = new HashMap<>();
+
+
+    @Override
+    public void setAliasService(AliasService aliasService) {
+        // N/A
+    }
+
+    @Override
+    public RemoteConfigurationRegistryClient get(String name) {
+        return clients.get(name);
+    }
+
+    @Override
+    public void init(GatewayConfig config, Map<String, String> options) throws ServiceLifecycleException {
+        List<RemoteConfigurationRegistryConfig> registryConfigurations =
+                                        RemoteConfigurationRegistriesAccessor.getRemoteRegistryConfigurations(config);
+        for (RemoteConfigurationRegistryConfig registryConfig : registryConfigurations) {
+            if (TYPE.equalsIgnoreCase(registryConfig.getRegistryType())) {
+                RemoteConfigurationRegistryClient registryClient = createClient(registryConfig);
+                clients.put(registryConfig.getName(), registryClient);
+            }
+        }
+    }
+
+    @Override
+    public void start() throws ServiceLifecycleException {
+
+    }
+
+    @Override
+    public void stop() throws ServiceLifecycleException {
+
+    }
+
+
+    private RemoteConfigurationRegistryClient createClient(RemoteConfigurationRegistryConfig config) {
+        String rootDir = config.getConnectionString();
+
+        return new RemoteConfigurationRegistryClient() {
+            private File root = new File(rootDir);
+
+            @Override
+            public String getAddress() {
+                return root.getAbsolutePath();
+            }
+
+            @Override
+            public boolean entryExists(String path) {
+                return (new File(root, path)).exists();
+            }
+
+            @Override
+            public List<EntryACL> getACL(String path) {
+                List<EntryACL> result = new ArrayList<>();
+
+                Path resolved = Paths.get(rootDir, path);
+                try {
+                    Map<String, List<String>> collected = new HashMap<>();
+
+                    Set<PosixFilePermission> perms = Files.getPosixFilePermissions(resolved);
+                    for (PosixFilePermission perm : perms) {
+                        String[] parsed = perm.toString().split("_");
+                        collected.computeIfAbsent(parsed[0].toLowerCase(), s -> new ArrayList<>()).add(parsed[1].toLowerCase());
+                    }
+
+                    for (String id : collected.keySet()) {
+                        EntryACL acl = new EntryACL() {
+                            @Override
+                            public String getId() {
+                                return id;
+                            }
+
+                            @Override
+                            public String getType() {
+                                return "fs";
+                            }
+
+                            @Override
+                            public Object getPermissions() {
+                                return collected.get(id).toString();
+                            }
+
+                            @Override
+                            public boolean canRead() {
+                                return true;
+                            }
+
+                            @Override
+                            public boolean canWrite() {
+                                return true;
+                            }
+                        };
+                        result.add(acl);
+                    }
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+                return result;
+            }
+
+            @Override
+            public List<String> listChildEntries(String path) {
+                List<String> result = new ArrayList<>();
+
+                File entry = new File(root, path);
+                if (entry.exists() && entry.isDirectory()) {
+                    String[] list = entry.list();
+                    if (list != null) {
+                        result.addAll(Arrays.asList(entry.list()));
+                    }
+                }
+
+                return result;
+            }
+
+            @Override
+            public String getEntryData(String path) {
+                return getEntryData(path, "UTF-8");
+            }
+
+            @Override
+            public String getEntryData(String path, String encoding) {
+                String result = null;
+                File entry = new File(root, path);
+                if (entry.isFile() && entry.exists()) {
+                    try {
+                        result = FileUtils.readFileToString(entry, encoding);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+                return result;
+            }
+
+            @Override
+            public void createEntry(String path) {
+                createEntry(path, "");
+            }
+
+            @Override
+            public void createEntry(String path, String data) {
+                createEntry(path, data, "UTF-8");
+            }
+
+            @Override
+            public void createEntry(String path, String data, String encoding) {
+                File entry = new File(root, path);
+                if (!entry.exists()) {
+                    if (data != null) {
+                        try {
+                            FileUtils.writeStringToFile(entry, data, encoding);
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+            }
+
+            @Override
+            public int setEntryData(String path, String data) {
+                setEntryData(path, data, "UTF-8");
+                return 0;
+            }
+
+            @Override
+            public int setEntryData(String path, String data, String encoding) {
+                File entry = new File(root, path);
+                if (entry.exists()) {
+                    try {
+                        FileUtils.writeStringToFile(entry, data, encoding);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+                return 0;
+            }
+
+            @Override
+            public boolean isAuthenticationConfigured() {
+                return false;
+            }
+
+            @Override
+            public void setACL(String path, List<EntryACL> acls) {
+                //
+            }
+
+            @Override
+            public void deleteEntry(String path) {
+                File entry = new File(root, path);
+                if (entry.exists()) {
+                    entry.delete();
+                }
+            }
+
+            @Override
+            public void addChildEntryListener(String path, ChildEntryListener listener) throws Exception {
+                // N/A
+            }
+
+            @Override
+            public void addEntryListener(String path, EntryListener listener) throws Exception {
+                // N/A
+            }
+
+            @Override
+            public void removeEntryListener(String path) throws Exception {
+                // N/A
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java b/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java
new file mode 100644
index 0000000..3b96068
--- /dev/null
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/service/config/remote/LocalFileSystemRemoteConfigurationRegistryClientServiceProvider.java
@@ -0,0 +1,32 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.knox.gateway.service.config.remote;
+
+import org.apache.knox.gateway.services.config.client.RemoteConfigurationRegistryClientService;
+
+public class LocalFileSystemRemoteConfigurationRegistryClientServiceProvider implements RemoteConfigurationRegistryClientServiceProvider {
+
+    @Override
+    public String getType() {
+        return LocalFileSystemRemoteConfigurationRegistryClientService.TYPE;
+    }
+
+    @Override
+    public RemoteConfigurationRegistryClientService newInstance() {
+        return new LocalFileSystemRemoteConfigurationRegistryClientService();
+    }
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
new file mode 100644
index 0000000..75cd5d0
--- /dev/null
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/topology/monitor/ZooKeeperConfigurationMonitorTest.java
@@ -0,0 +1,355 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.knox.gateway.topology.monitor;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.curator.test.InstanceSpec;
+import org.apache.curator.test.TestingCluster;
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.service.config.remote.zk.ZooKeeperClientService;
+import org.apache.knox.gateway.service.config.remote.zk.ZooKeeperClientServiceProvider;
+import org.apache.knox.gateway.services.config.client.RemoteConfigurationRegistryClientService;
+import org.apache.knox.gateway.services.security.AliasService;
+import org.apache.knox.test.TestUtils;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.data.ACL;
+import org.easymock.EasyMock;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Test the ZooKeeperConfigMonitor WITHOUT SASL configured or znode ACLs applied.
+ * The implementation of the monitor is the same regardless, since the ACLs are defined by the ZooKeeper znode
+ * creator, and the SASL config is purely JAAS (and external to the implementation).
+ */
+public class ZooKeeperConfigurationMonitorTest {
+
+    private static final String PATH_KNOX = "/knox";
+    private static final String PATH_KNOX_CONFIG = PATH_KNOX + "/config";
+    private static final String PATH_KNOX_PROVIDERS = PATH_KNOX_CONFIG + "/shared-providers";
+    private static final String PATH_KNOX_DESCRIPTORS = PATH_KNOX_CONFIG + "/descriptors";
+
+    private static File testTmp;
+    private static File providersDir;
+    private static File descriptorsDir;
+
+    private static TestingCluster zkCluster;
+
+    private static CuratorFramework client;
+
+    private GatewayConfig gc;
+
+
+    @BeforeClass
+    public static void setupSuite() throws Exception {
+        testTmp = TestUtils.createTempDir(ZooKeeperConfigurationMonitorTest.class.getName());
+        File confDir   = TestUtils.createTempDir(testTmp + "/conf");
+        providersDir   = TestUtils.createTempDir(confDir + "/shared-providers");
+        descriptorsDir = TestUtils.createTempDir(confDir + "/descriptors");
+
+        configureAndStartZKCluster();
+    }
+
+    private static void configureAndStartZKCluster() throws Exception {
+        // Configure security for the ZK cluster instances
+        Map<String, Object> customInstanceSpecProps = new HashMap<>();
+        customInstanceSpecProps.put("authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
+        customInstanceSpecProps.put("requireClientAuthScheme", "sasl");
+
+        // Define the test cluster
+        List<InstanceSpec> instanceSpecs = new ArrayList<>();
+        for (int i = 0 ; i < 3 ; i++) {
+            InstanceSpec is = new InstanceSpec(null, -1, -1, -1, false, (i+1), -1, -1, customInstanceSpecProps);
+            instanceSpecs.add(is);
+        }
+        zkCluster = new TestingCluster(instanceSpecs);
+
+        // Start the cluster
+        zkCluster.start();
+
+        // Create the client for the test cluster
+        client = CuratorFrameworkFactory.builder()
+                                        .connectString(zkCluster.getConnectString())
+                                        .retryPolicy(new ExponentialBackoffRetry(100, 3))
+                                        .build();
+        assertNotNull(client);
+        client.start();
+
+        // Create the knox config paths with an ACL for the sasl user configured for the client
+        List<ACL> acls = new ArrayList<>();
+        acls.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.ANYONE_ID_UNSAFE));
+
+        client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).withACL(acls).forPath(PATH_KNOX_DESCRIPTORS);
+        assertNotNull("Failed to create node:" + PATH_KNOX_DESCRIPTORS,
+                client.checkExists().forPath(PATH_KNOX_DESCRIPTORS));
+        client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).withACL(acls).forPath(PATH_KNOX_PROVIDERS);
+        assertNotNull("Failed to create node:" + PATH_KNOX_PROVIDERS,
+                client.checkExists().forPath(PATH_KNOX_PROVIDERS));
+    }
+
+    @AfterClass
+    public static void tearDownSuite() throws Exception {
+        // Clean up the ZK nodes, and close the client
+        if (client != null) {
+            client.delete().deletingChildrenIfNeeded().forPath(PATH_KNOX);
+            client.close();
+        }
+
+        // Shutdown the ZK cluster
+        zkCluster.close();
+
+        // Delete the working dir
+        testTmp.delete();
+    }
+
+    @Test
+    public void testZooKeeperConfigMonitor() throws Exception {
+        String configMonitorName = "remoteConfigMonitorClient";
+
+        // Setup the base GatewayConfig mock
+        gc = EasyMock.createNiceMock(GatewayConfig.class);
+        EasyMock.expect(gc.getGatewayProvidersConfigDir()).andReturn(providersDir.getAbsolutePath()).anyTimes();
+        EasyMock.expect(gc.getGatewayDescriptorsDir()).andReturn(descriptorsDir.getAbsolutePath()).anyTimes();
+        EasyMock.expect(gc.getRemoteRegistryConfigurationNames())
+                .andReturn(Collections.singletonList(configMonitorName))
+                .anyTimes();
+        final String registryConfig =
+                                GatewayConfig.REMOTE_CONFIG_REGISTRY_TYPE + "=" + ZooKeeperClientService.TYPE + ";" +
+                                GatewayConfig.REMOTE_CONFIG_REGISTRY_ADDRESS + "=" + zkCluster.getConnectString();
+        EasyMock.expect(gc.getRemoteRegistryConfiguration(configMonitorName))
+                .andReturn(registryConfig)
+                .anyTimes();
+        EasyMock.expect(gc.getRemoteConfigurationMonitorClientName()).andReturn(configMonitorName).anyTimes();
+        EasyMock.replay(gc);
+
+        AliasService aliasService = EasyMock.createNiceMock(AliasService.class);
+        EasyMock.replay(aliasService);
+
+        RemoteConfigurationRegistryClientService clientService = (new ZooKeeperClientServiceProvider()).newInstance();
+        clientService.setAliasService(aliasService);
+        clientService.init(gc, Collections.emptyMap());
+        clientService.start();
+
+        DefaultRemoteConfigurationMonitor cm = new DefaultRemoteConfigurationMonitor(gc, clientService);
+
+        try {
+            cm.start();
+        } catch (Exception e) {
+            fail("Failed to start monitor: " + e.getMessage());
+        }
+
+        try {
+            final String pc_one_znode = getProviderPath("providers-config1.xml");
+            final File pc_one         = new File(providersDir, "providers-config1.xml");
+            final String pc_two_znode = getProviderPath("providers-config2.xml");
+            final File pc_two         = new File(providersDir, "providers-config2.xml");
+
+            client.create().withMode(CreateMode.PERSISTENT).forPath(pc_one_znode, TEST_PROVIDERS_CONFIG_1.getBytes());
+            Thread.sleep(100);
+            assertTrue(pc_one.exists());
+            assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_one));
+
+            client.create().withMode(CreateMode.PERSISTENT).forPath(getProviderPath("providers-config2.xml"), TEST_PROVIDERS_CONFIG_2.getBytes());
+            Thread.sleep(100);
+            assertTrue(pc_two.exists());
+            assertEquals(TEST_PROVIDERS_CONFIG_2, FileUtils.readFileToString(pc_two));
+
+            client.setData().forPath(pc_two_znode, TEST_PROVIDERS_CONFIG_1.getBytes());
+            Thread.sleep(100);
+            assertTrue(pc_two.exists());
+            assertEquals(TEST_PROVIDERS_CONFIG_1, FileUtils.readFileToString(pc_two));
+
+            client.delete().forPath(pc_two_znode);
+            Thread.sleep(100);
+            assertFalse(pc_two.exists());
+
+            client.delete().forPath(pc_one_znode);
+            Thread.sleep(100);
+            assertFalse(pc_one.exists());
+
+            final String desc_one_znode   = getDescriptorPath("test1.json");
+            final String desc_two_znode   = getDescriptorPath("test2.json");
+            final String desc_three_znode = getDescriptorPath("test3.json");
+            final File desc_one           = new File(descriptorsDir, "test1.json");
+            final File desc_two           = new File(descriptorsDir, "test2.json");
+            final File desc_three         = new File(descriptorsDir, "test3.json");
+
+            client.create().withMode(CreateMode.PERSISTENT).forPath(desc_one_znode, TEST_DESCRIPTOR_1.getBytes());
+            Thread.sleep(100);
+            assertTrue(desc_one.exists());
+            assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_one));
+
+            client.create().withMode(CreateMode.PERSISTENT).forPath(desc_two_znode, TEST_DESCRIPTOR_1.getBytes());
+            Thread.sleep(100);
+            assertTrue(desc_two.exists());
+            assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_two));
+
+            client.setData().forPath(desc_two_znode, TEST_DESCRIPTOR_2.getBytes());
+            Thread.sleep(100);
+            assertTrue(desc_two.exists());
+            assertEquals(TEST_DESCRIPTOR_2, FileUtils.readFileToString(desc_two));
+
+            client.create().withMode(CreateMode.PERSISTENT).forPath(desc_three_znode, TEST_DESCRIPTOR_1.getBytes());
+            Thread.sleep(100);
+            assertTrue(desc_three.exists());
+            assertEquals(TEST_DESCRIPTOR_1, FileUtils.readFileToString(desc_three));
+
+            client.delete().forPath(desc_two_znode);
+            Thread.sleep(100);
+            assertFalse("Expected test2.json to have been deleted.", desc_two.exists());
+
+            client.delete().forPath(desc_three_znode);
+            Thread.sleep(100);
+            assertFalse(desc_three.exists());
+
+            client.delete().forPath(desc_one_znode);
+            Thread.sleep(100);
+            assertFalse(desc_one.exists());
+        } finally {
+            cm.stop();
+        }
+    }
+
+    private static String getDescriptorPath(String descriptorName) {
+        return PATH_KNOX_DESCRIPTORS + "/" + descriptorName;
+    }
+
+    private static String getProviderPath(String providerConfigName) {
+        return PATH_KNOX_PROVIDERS + "/" + providerConfigName;
+    }
+
+
+    private static final String TEST_PROVIDERS_CONFIG_1 =
+            "<gateway>\n" +
+            "    <provider>\n" +
+            "        <role>identity-assertion</role>\n" +
+            "        <name>Default</name>\n" +
+            "        <enabled>true</enabled>\n" +
+            "    </provider>\n" +
+            "    <provider>\n" +
+            "        <role>hostmap</role>\n" +
+            "        <name>static</name>\n" +
+            "        <enabled>true</enabled>\n" +
+            "        <param><name>localhost</name><value>sandbox,sandbox.hortonworks.com</value></param>\n" +
+            "    </provider>\n" +
+            "</gateway>\n";
+
+    private static final String TEST_PROVIDERS_CONFIG_2 =
+            "<gateway>\n" +
+            "    <provider>\n" +
+            "        <role>authentication</role>\n" +
+            "        <name>ShiroProvider</name>\n" +
+            "        <enabled>true</enabled>\n" +
+            "        <param>\n" +
+            "            <name>sessionTimeout</name>\n" +
+            "            <value>30</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>main.ldapRealm</name>\n" +
+            "            <value>org.apache.knox.gateway.shirorealm.KnoxLdapRealm</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>main.ldapContextFactory</name>\n" +
+            "            <value>org.apache.knox.gateway.shirorealm.KnoxLdapContextFactory</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>main.ldapRealm.contextFactory</name>\n" +
+            "            <value>$ldapContextFactory</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>main.ldapRealm.userDnTemplate</name>\n" +
+            "            <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>main.ldapRealm.contextFactory.url</name>\n" +
+            "            <value>ldap://localhost:33389</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>main.ldapRealm.contextFactory.authenticationMechanism</name>\n" +
+            "            <value>simple</value>\n" +
+            "        </param>\n" +
+            "        <param>\n" +
+            "            <name>urls./**</name>\n" +
+            "            <value>authcBasic</value>\n" +
+            "        </param>\n" +
+            "    </provider>\n" +
+            "</gateway>\n";
+
+    private static final String TEST_DESCRIPTOR_1 =
+            "{\n" +
+            "  \"discovery-type\":\"AMBARI\",\n" +
+            "  \"discovery-address\":\"http://sandbox.hortonworks.com:8080\",\n" +
+            "  \"discovery-user\":\"maria_dev\",\n" +
+            "  \"discovery-pwd-alias\":\"sandbox.ambari.discovery.password\",\n" +
+            "  \"provider-config-ref\":\"sandbox-providers.xml\",\n" +
+            "  \"cluster\":\"Sandbox\",\n" +
+            "  \"services\":[\n" +
+            "    {\"name\":\"NODEUI\"},\n" +
+            "    {\"name\":\"YARNUI\"},\n" +
+            "    {\"name\":\"HDFSUI\"},\n" +
+            "    {\"name\":\"OOZIEUI\"},\n" +
+            "    {\"name\":\"HBASEUI\"},\n" +
+            "    {\"name\":\"NAMENODE\"},\n" +
+            "    {\"name\":\"JOBTRACKER\"},\n" +
+            "    {\"name\":\"WEBHDFS\"},\n" +
+            "    {\"name\":\"WEBHCAT\"},\n" +
+            "    {\"name\":\"OOZIE\"},\n" +
+            "    {\"name\":\"WEBHBASE\"},\n" +
+            "    {\"name\":\"RESOURCEMANAGER\"},\n" +
+            "    {\"name\":\"AMBARI\", \"urls\":[\"http://c6401.ambari.apache.org:8080\"]},\n" +
+            "    {\"name\":\"AMBARIUI\", \"urls\":[\"http://c6401.ambari.apache.org:8080\"]}\n" +
+            "  ]\n" +
+            "}\n";
+
+    private static final String TEST_DESCRIPTOR_2 =
+            "{\n" +
+            "  \"discovery-type\":\"AMBARI\",\n" +
+            "  \"discovery-address\":\"http://sandbox.hortonworks.com:8080\",\n" +
+            "  \"discovery-user\":\"maria_dev\",\n" +
+            "  \"discovery-pwd-alias\":\"sandbox.ambari.discovery.password\",\n" +
+            "  \"provider-config-ref\":\"sandbox-providers.xml\",\n" +
+            "  \"cluster\":\"Sandbox\",\n" +
+            "  \"services\":[\n" +
+            "    {\"name\":\"NAMENODE\"},\n" +
+            "    {\"name\":\"JOBTRACKER\"},\n" +
+            "    {\"name\":\"WEBHDFS\"},\n" +
+            "    {\"name\":\"WEBHCAT\"},\n" +
+            "    {\"name\":\"OOZIE\"},\n" +
+            "    {\"name\":\"WEBHBASE\"},\n" +
+            "    {\"name\":\"RESOURCEMANAGER\"}\n" +
+            "  ]\n" +
+            "}\n";
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
index 902327c..b768937 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.util;
 import com.mycila.xmltool.XMLDoc;
 import com.mycila.xmltool.XMLTag;
 import org.apache.commons.io.FileUtils;
-import org.apache.knox.conf.Configuration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.knox.gateway.config.impl.GatewayConfigImpl;
 import org.apache.knox.gateway.services.GatewayServices;
 import org.apache.knox.gateway.services.config.client.RemoteConfigurationRegistryClient;

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/resources/META-INF/services/org.apache.hadoop.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/resources/META-INF/services/org.apache.hadoop.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider b/gateway-server/src/test/resources/META-INF/services/org.apache.hadoop.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider
deleted file mode 100644
index ffd9284..0000000
--- a/gateway-server/src/test/resources/META-INF/services/org.apache.hadoop.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider
+++ /dev/null
@@ -1,19 +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.
-##########################################################################
-
-org.apache.hadoop.gateway.service.config.remote.LocalFileSystemRemoteConfigurationRegistryClientServiceProvider

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-server/src/test/resources/META-INF/services/org.apache.knox.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/resources/META-INF/services/org.apache.knox.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider b/gateway-server/src/test/resources/META-INF/services/org.apache.knox.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider
new file mode 100644
index 0000000..46dbdf2
--- /dev/null
+++ b/gateway-server/src/test/resources/META-INF/services/org.apache.knox.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceProvider
@@ -0,0 +1,19 @@
+##########################################################################
+# 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.
+##########################################################################
+
+org.apache.knox.gateway.service.config.remote.LocalFileSystemRemoteConfigurationRegistryClientServiceProvider

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml
----------------------------------------------------------------------
diff --git a/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml b/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationMessages.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationMessages.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationMessages.java
deleted file mode 100644
index 7cd1324..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationMessages.java
+++ /dev/null
@@ -1,49 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote;
-
-import org.apache.hadoop.gateway.i18n.messages.Message;
-import org.apache.hadoop.gateway.i18n.messages.MessageLevel;
-import org.apache.hadoop.gateway.i18n.messages.Messages;
-import org.apache.hadoop.gateway.i18n.messages.StackTrace;
-
-
-/**
- *
- */
-@Messages(logger="org.apache.hadoop.gateway.service.config.remote")
-public interface RemoteConfigurationMessages {
-
-    @Message(level = MessageLevel.WARN,
-             text = "Multiple remote configuration registries are not currently supported if any of them requires authentication.")
-    void multipleRemoteRegistryConfigurations();
-
-    @Message(level = MessageLevel.ERROR, text = "Failed to resolve the credential alias {0}")
-    void unresolvedCredentialAlias(final String alias);
-
-    @Message(level = MessageLevel.ERROR, text = "An error occurred interacting with the remote configuration registry : {0}")
-    void errorInteractingWithRemoteConfigRegistry(@StackTrace(level = MessageLevel.DEBUG) Exception e);
-
-    @Message(level = MessageLevel.ERROR, text = "An error occurred handling the ACL for remote configuration {0} : {1}")
-    void errorHandlingRemoteConfigACL(final String path,
-                                      @StackTrace(level = MessageLevel.DEBUG) Exception e);
-
-    @Message(level = MessageLevel.ERROR, text = "An error occurred setting the ACL for remote configuration {0} : {1}")
-    void errorSettingEntryACL(final String path,
-                              @StackTrace(level = MessageLevel.DEBUG) Exception e);
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceFactory.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceFactory.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceFactory.java
deleted file mode 100644
index cd58e22..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceFactory.java
+++ /dev/null
@@ -1,41 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote;
-
-import org.apache.hadoop.gateway.config.GatewayConfig;
-import org.apache.hadoop.gateway.services.config.client.RemoteConfigurationRegistryClientService;
-
-import java.util.ServiceLoader;
-
-public class RemoteConfigurationRegistryClientServiceFactory {
-
-    public static RemoteConfigurationRegistryClientService newInstance(GatewayConfig config) {
-        RemoteConfigurationRegistryClientService rcs = null;
-
-        ServiceLoader<RemoteConfigurationRegistryClientServiceProvider> providers =
-                                             ServiceLoader.load(RemoteConfigurationRegistryClientServiceProvider.class);
-        for (RemoteConfigurationRegistryClientServiceProvider provider : providers) {
-            rcs = provider.newInstance();
-            if (rcs != null) {
-                break;
-            }
-        }
-
-        return rcs;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceProvider.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceProvider.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceProvider.java
deleted file mode 100644
index ddfc392..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryClientServiceProvider.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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote;
-
-import org.apache.hadoop.gateway.services.config.client.RemoteConfigurationRegistryClientService;
-
-public interface RemoteConfigurationRegistryClientServiceProvider {
-
-    String getType();
-
-    RemoteConfigurationRegistryClientService newInstance();
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryConfig.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryConfig.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryConfig.java
deleted file mode 100644
index 6409250..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/RemoteConfigurationRegistryConfig.java
+++ /dev/null
@@ -1,43 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote;
-
-public interface RemoteConfigurationRegistryConfig {
-
-    String getName();
-
-    String getRegistryType();
-
-    String getConnectionString();
-
-    String getNamespace();
-
-    boolean isSecureRegistry();
-
-    String getAuthType(); // digest, kerberos, etc...
-
-    String getPrincipal();
-
-    String getCredentialAlias();
-
-    String getKeytab();
-
-    boolean isUseTicketCache();
-
-    boolean isUseKeyTab();
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/DefaultRemoteConfigurationRegistries.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/DefaultRemoteConfigurationRegistries.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/DefaultRemoteConfigurationRegistries.java
deleted file mode 100644
index ebcae1b..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/DefaultRemoteConfigurationRegistries.java
+++ /dev/null
@@ -1,104 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote.config;
-
-import org.apache.hadoop.gateway.config.GatewayConfig;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A set of RemoteConfigurationRegistry configurations based on a set of property name-value pairs.
- */
-class DefaultRemoteConfigurationRegistries extends RemoteConfigurationRegistries {
-
-    private static final String PROPERTY_DELIM       = ";";
-    private static final String PROPERTY_VALUE_DELIM = "=";
-
-    private List<RemoteConfigurationRegistry> configuredRegistries = new ArrayList<>();
-
-    /**
-     * Derive the remote registry configurations from the specified GatewayConfig.
-     *
-     * @param gc The source GatewayConfig
-     */
-    DefaultRemoteConfigurationRegistries(GatewayConfig gc) {
-        List<String> configRegistryNames = gc.getRemoteRegistryConfigurationNames();
-        for (String configRegistryName : configRegistryNames) {
-            configuredRegistries.add(extractConfigForRegistry(gc, configRegistryName));
-        }
-    }
-
-    /**
-     * Extract the configuration for the specified registry configuration name.
-     *
-     * @param gc           The GatewayConfig from which to extract the registry config.
-     * @param registryName The name of the registry config.
-     *
-     * @return The resulting RemoteConfigurationRegistry object, or null.
-     */
-    private static RemoteConfigurationRegistry extractConfigForRegistry(GatewayConfig gc, String registryName) {
-        RemoteConfigurationRegistry result = new RemoteConfigurationRegistry();
-
-        result.setName(registryName);
-
-        Map<String, String> properties = parsePropertyValue(gc.getRemoteRegistryConfiguration(registryName));
-
-        result.setRegistryType(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_TYPE));
-        result.setConnectionString(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_ADDRESS));
-        result.setNamespace(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_NAMESPACE));
-        result.setAuthType(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_AUTH_TYPE));
-        result.setPrincipal(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_PRINCIPAL));
-        result.setCredentialAlias(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_CREDENTIAL_ALIAS));
-        result.setKeytab(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_KEYTAB));
-        result.setUseKeytab(Boolean.valueOf(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_USE_KEYTAB)));
-        result.setUseTicketCache(Boolean.valueOf(properties.get(GatewayConfig.REMOTE_CONFIG_REGISTRY_USE_TICKET_CACHE)));
-
-        return result;
-    }
-
-    /**
-     * Parse the specified registry config properties String.
-     *
-     * @param value The property value content from GatewayConfig.
-     *
-     * @return A Map of the parsed properties and their respective values.
-     */
-    private static Map<String, String> parsePropertyValue(final String value) {
-        Map<String, String> result = new HashMap<>();
-
-        if (value != null) {
-            String[] props = value.split(PROPERTY_DELIM);
-            for (String prop : props) {
-                String[] split = prop.split(PROPERTY_VALUE_DELIM);
-                String propName  = split[0];
-                String propValue = (split.length > 1) ? split[1] : null;
-                result.put(propName, propValue);
-            }
-        }
-
-        return result;
-    }
-
-    @Override
-    List<RemoteConfigurationRegistry> getRegistryConfigurations() {
-        return configuredRegistries;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistries.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistries.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistries.java
deleted file mode 100644
index fa045c0..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistries.java
+++ /dev/null
@@ -1,33 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote.config;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.ArrayList;
-import java.util.List;
-
-@XmlRootElement(name="remote-configuration-registries")
-class RemoteConfigurationRegistries {
-
-    private List<RemoteConfigurationRegistry> registryConfigurations = new ArrayList<>();
-
-    @XmlElement(name="remote-configuration-registry")
-    List<RemoteConfigurationRegistry> getRegistryConfigurations() {
-        return registryConfigurations;
-    }
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesAccessor.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesAccessor.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesAccessor.java
deleted file mode 100644
index 9fed589..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesAccessor.java
+++ /dev/null
@@ -1,60 +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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote.config;
-
-import org.apache.hadoop.gateway.config.GatewayConfig;
-import org.apache.hadoop.gateway.service.config.remote.RemoteConfigurationRegistryConfig;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class RemoteConfigurationRegistriesAccessor {
-
-    // System property for specifying a reference to an XML configuration external to the gateway config
-    private static final String XML_CONFIG_REFERENCE_SYSTEM_PROPERTY_NAME =
-                                                                "org.apache.knox.gateway.remote.registry.config.file";
-
-
-    public static List<RemoteConfigurationRegistryConfig> getRemoteRegistryConfigurations(GatewayConfig gatewayConfig) {
-        List<RemoteConfigurationRegistryConfig> result = new ArrayList<>();
-
-        boolean useReferencedFile = false;
-
-        // First check for the system property pointing to a valid XML config for the remote registries
-        String remoteConfigRegistryConfigFilename = System.getProperty(XML_CONFIG_REFERENCE_SYSTEM_PROPERTY_NAME);
-        if (remoteConfigRegistryConfigFilename != null) {
-            File remoteConfigRegistryConfigFile = new File(remoteConfigRegistryConfigFilename);
-            if (remoteConfigRegistryConfigFile.exists()) {
-                useReferencedFile = true;
-                // Parse the file, and build the registry config set
-                result.addAll(RemoteConfigurationRegistriesParser.getConfig(remoteConfigRegistryConfigFilename));
-            }
-        }
-
-        // If the system property was not set to a valid reference to another config file, then try to derive the
-        // registry configurations from the gateway config.
-        if (!useReferencedFile) {
-            RemoteConfigurationRegistries remoteConfigRegistries =
-                                                            new DefaultRemoteConfigurationRegistries(gatewayConfig);
-            result.addAll(remoteConfigRegistries.getRegistryConfigurations());
-        }
-
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/e766b3b7/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesParser.java
----------------------------------------------------------------------
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesParser.java b/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesParser.java
deleted file mode 100644
index 3ea71ef..0000000
--- a/gateway-service-remoteconfig/src/main/java/org/apache/hadoop/gateway/service/config/remote/config/RemoteConfigurationRegistriesParser.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.hadoop.gateway.service.config.remote.config;
-
-import org.apache.hadoop.gateway.service.config.remote.RemoteConfigurationRegistryConfig;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-class RemoteConfigurationRegistriesParser {
-
-    static List<RemoteConfigurationRegistryConfig> getConfig(String configFilename) {
-        List<RemoteConfigurationRegistryConfig> result = new ArrayList<>();
-
-        File file = new File(configFilename);
-
-        try {
-            JAXBContext jaxbContext = JAXBContext.newInstance(RemoteConfigurationRegistries.class);
-            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
-            RemoteConfigurationRegistries parsedContent = (RemoteConfigurationRegistries) jaxbUnmarshaller.unmarshal(file);
-            if (parsedContent != null) {
-                result.addAll(parsedContent.getRegistryConfigurations());
-            }
-        } catch (JAXBException e) {
-            e.printStackTrace();
-        }
-
-        return result;
-    }
-}


Mime
View raw message