// Path: src/main/java/biz/paluch/spinach/impl/RoundRobinSocketAddressSupplier.java
// public class RoundRobinSocketAddressSupplier implements SocketAddressSupplier {
// 
//     protected final Collection<? extends ConnectionPoint> connectionPoint;
//     protected RoundRobin<? extends ConnectionPoint> roundRobin;
// 
//     /**
//      * 
//      * @param connectionPoints the collection of {@link ConnectionPoint connection points}, must not be {@literal null}.
//      */
//     public RoundRobinSocketAddressSupplier(Collection<? extends ConnectionPoint> connectionPoints) {
//         this(connectionPoints, null);
//     }
// 
//     /**
//      * 
//      * @param connectionPoints the collection of {@link ConnectionPoint connection points}, must not be {@literal null}.
//      * @param offset {@link ConnectionPoint connection point} offset for starting the round robin cycle at that point, can be
//      *        {@literal null}.
//      */
//     public RoundRobinSocketAddressSupplier(Collection<? extends ConnectionPoint> connectionPoints, ConnectionPoint offset) {
//         LettuceAssert.notNull(connectionPoints, "ConnectionPoints must not be null");
//         this.connectionPoint = connectionPoints;
//         this.roundRobin = new RoundRobin<ConnectionPoint>(connectionPoints, offset);
//     }
// 
//     @Override
//     public SocketAddress get() {
//         ConnectionPoint connectionPoint = roundRobin.next();
//         return getSocketAddress(connectionPoint);
//     }
// 
//     protected static SocketAddress getSocketAddress(ConnectionPoint connectionPoint) {
// 
//         if (connectionPoint instanceof DisqueURI.DisqueSocket) {
//             return ((DisqueURI.DisqueSocket) connectionPoint).getSocketAddress();
//         }
//         return InetSocketAddress.createUnresolved(connectionPoint.getHost(), connectionPoint.getPort());
//     }
// }


import static org.assertj.core.api.Assertions.assertThat;
import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import biz.paluch.spinach.impl.RoundRobinSocketAddressSupplier;
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package biz.paluch.spinach;





/**
 * @author Mark Paluch
 */
public class RoundRobinSocketAddressSupplierTest {

    private static DisqueURI.DisqueHostAndPort hap1 = new DisqueURI.DisqueHostAndPort("127.0.0.1", 1);
    private static DisqueURI.DisqueHostAndPort hap2 = new DisqueURI.DisqueHostAndPort("127.0.0.1", 2);
    private static DisqueURI.DisqueHostAndPort hap3 = new DisqueURI.DisqueHostAndPort("127.0.0.1", 3);

    private Collection<DisqueURI.DisqueHostAndPort> points = Arrays.asList(hap1, hap2, hap3);

    @Test
    public void noOffset() throws Exception {

// Path: src/main/java/biz/paluch/spinach/impl/RoundRobinSocketAddressSupplier.java
// public class RoundRobinSocketAddressSupplier implements SocketAddressSupplier {
// 
//     protected final Collection<? extends ConnectionPoint> connectionPoint;
//     protected RoundRobin<? extends ConnectionPoint> roundRobin;
// 
//     /**
//      * 
//      * @param connectionPoints the collection of {@link ConnectionPoint connection points}, must not be {@literal null}.
//      */
//     public RoundRobinSocketAddressSupplier(Collection<? extends ConnectionPoint> connectionPoints) {
//         this(connectionPoints, null);
//     }
// 
//     /**
//      * 
//      * @param connectionPoints the collection of {@link ConnectionPoint connection points}, must not be {@literal null}.
//      * @param offset {@link ConnectionPoint connection point} offset for starting the round robin cycle at that point, can be
//      *        {@literal null}.
//      */
//     public RoundRobinSocketAddressSupplier(Collection<? extends ConnectionPoint> connectionPoints, ConnectionPoint offset) {
//         LettuceAssert.notNull(connectionPoints, "ConnectionPoints must not be null");
//         this.connectionPoint = connectionPoints;
//         this.roundRobin = new RoundRobin<ConnectionPoint>(connectionPoints, offset);
//     }
// 
//     @Override
//     public SocketAddress get() {
//         ConnectionPoint connectionPoint = roundRobin.next();
//         return getSocketAddress(connectionPoint);
//     }
// 
//     protected static SocketAddress getSocketAddress(ConnectionPoint connectionPoint) {
// 
//         if (connectionPoint instanceof DisqueURI.DisqueSocket) {
//             return ((DisqueURI.DisqueSocket) connectionPoint).getSocketAddress();
//         }
//         return InetSocketAddress.createUnresolved(connectionPoint.getHost(), connectionPoint.getPort());
//     }
// }


// Path: src/test/java/biz/paluch/spinach/RoundRobinSocketAddressSupplierTest.java
import static org.assertj.core.api.Assertions.assertThat;
import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import biz.paluch.spinach.impl.RoundRobinSocketAddressSupplier;

/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package biz.paluch.spinach;





/**
 * @author Mark Paluch
 */
public class RoundRobinSocketAddressSupplierTest {

    private static DisqueURI.DisqueHostAndPort hap1 = new DisqueURI.DisqueHostAndPort("127.0.0.1", 1);
    private static DisqueURI.DisqueHostAndPort hap2 = new DisqueURI.DisqueHostAndPort("127.0.0.1", 2);
    private static DisqueURI.DisqueHostAndPort hap3 = new DisqueURI.DisqueHostAndPort("127.0.0.1", 3);

    private Collection<DisqueURI.DisqueHostAndPort> points = Arrays.asList(hap1, hap2, hap3);

    @Test
    public void noOffset() throws Exception {

        RoundRobinSocketAddressSupplier sut = new RoundRobinSocketAddressSupplier(points, null);