/*
 * Copyright 2015 Luca Burgazzoli
 *
 * 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 om.github.lburgazzoli.hazelcast.discovery.dns;

import com.github.lburgazzoli.hazelcast.discovery.dns.DnsDiscoveryStrategyFactory;
import com.hazelcast.config.Config;
import com.hazelcast.config.InterfacesConfig;
import com.hazelcast.config.XmlConfigBuilder;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.spi.discovery.DiscoveredNode;
import com.hazelcast.spi.discovery.DiscoveryMode;
import com.hazelcast.spi.discovery.DiscoveryStrategy;
import com.hazelcast.spi.discovery.DiscoveryStrategyFactory;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.assertNotNull;


@Ignore
public class DnsDiscoveryTest {
    private static final Logger LOGGER = LoggerFactory.getLogger(DnsDiscoveryTest.class);

    @Test
    public void discoveryProviderTest() {
        Map<String, Comparable> properties = new HashMap<>();
        properties.put("serviceName", "hazelcast.skydns.lb");

        DiscoveryStrategyFactory factory = new DnsDiscoveryStrategyFactory();
        DiscoveryStrategy provider = factory.newDiscoveryStrategy(properties);

        provider.start(DiscoveryMode.Member);

        Iterable<DiscoveredNode> nodes = provider.discoverNodes();
        assertNotNull(nodes);

        for(DiscoveredNode node : nodes) {
            LOGGER.info("Node -> {}", node.getPublicAddress());
        }
    }

    @Test
    public void hazelcastInstanceTest() throws Exception {
        final Config config = loadConfig("test-hazelcast-discovery-dns.xml");
        Hazelcast.newHazelcastInstance(config);
    }

    // *************************************************************************
    //
    // *************************************************************************

    private Config loadConfig(String fileName) throws IOException {

        try(InputStream in = DnsDiscoveryTest.class.getClassLoader().getResourceAsStream(fileName)) {
            Config config = new XmlConfigBuilder(in).build();

            InterfacesConfig interfaces = config.getNetworkConfig().getInterfaces();
            interfaces.clear();
            interfaces.setEnabled(true);
            interfaces.addInterface("127.0.0.1");

            return config;
        }
    }
}

@@ -921,36 +921,19 @@
 ast.
-spi.discovery.DiscoveredNode
+nio.Address
 ;%0Aim
@@ -974,17 +974,17 @@
 iscovery
-M
+N
 ode;%0Aimp
@@ -1091,24 +1091,80 @@
 egyFactory;%0A
+import com.hazelcast.spi.discovery.SimpleDiscoveryNode;%0A
 import org.j
@@ -1590,16 +1590,33 @@
 erTest()
+ throws Exception
  %7B%0A     
@@ -1731,24 +1731,111 @@
 ydns.lb%22);%0A%0A
+        DiscoveryNode local = new SimpleDiscoveryNode(new Address(%22127.0.0.1%22, 1010));%0A
         Disc
@@ -1966,16 +1966,29 @@
 trategy(
+local, null, 
 properti
@@ -2020,28 +2020,8 @@
 art(
-DiscoveryMode.Member
 );%0A%0A
@@ -2041,26 +2041,25 @@
 ble%3CDiscover
-ed
+y
 Node%3E nodes 
@@ -2137,18 +2137,17 @@
 Discover
-ed
+y
 Node nod

Update to HZ 3.6-EA3