// Path: consumer/spi/src/main/java/org/arquillian/algeron/consumer/spi/publisher/ContractsPublisher.java
// public interface ContractsPublisher {
// 
//     /**
//      * Publish pacts to appropriate repository.
//      */
//     void publish() throws IOException;
// 
//     /**
//      * Returns the name to identify this published in configuration file.
//      *
//      * @return name of the published
//      */
//     String getName();
// 
//     /**
//      * Method used for passing configuration parameters to publisher.
//      *
//      * @param configuration
//      *     key-values
//      */
//     void configure(Map<String, Object> configuration);
// }


import au.com.dius.pact.provider.broker.PactBrokerClient;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.Paths;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
import org.arquillian.algeron.consumer.spi.publisher.ContractsPublisher;
                        throw new IllegalStateException(String.format("Failed to publish %s contract with server failure %s", path, result));
                    }

                });
        }

    }

    private String getAuthenticateUrl(String url) {
        final String username = (String) this.configuration.get(USERNAME);
        final String password = (String) this.configuration.get(PASSWORD);

        final int slashIndex = url.indexOf("//");

        if (slashIndex > -1) {
            url = String.format("%s%s:%s@%s", url.substring(0, slashIndex + 2), username, password, url.substring(slashIndex + 2));
        } else {
            url = String.format("%s:%s@%s", username, password, url);
        }
        return url;
    }

    @Override
    public String getName() {
        return "pactbroker";
    }

    @Override
    public void configure(Map<String, Object> configuration) {

// Path: consumer/spi/src/main/java/org/arquillian/algeron/consumer/spi/publisher/ContractsPublisher.java
// public interface ContractsPublisher {
// 
//     /**
//      * Publish pacts to appropriate repository.
//      */
//     void publish() throws IOException;
// 
//     /**
//      * Returns the name to identify this published in configuration file.
//      *
//      * @return name of the published
//      */
//     String getName();
// 
//     /**
//      * Method used for passing configuration parameters to publisher.
//      *
//      * @param configuration
//      *     key-values
//      */
//     void configure(Map<String, Object> configuration);
// }


// Path: pact/consumer/pact-broker/src/main/java/org/arquillian/algeron/pact/consumer/publisher/pactbroker/PactBorkerContractsPublisher.java
import au.com.dius.pact.provider.broker.PactBrokerClient;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.Paths;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
import org.arquillian.algeron.consumer.spi.publisher.ContractsPublisher;

                        throw new IllegalStateException(String.format("Failed to publish %s contract with server failure %s", path, result));
                    }

                });
        }

    }

    private String getAuthenticateUrl(String url) {
        final String username = (String) this.configuration.get(USERNAME);
        final String password = (String) this.configuration.get(PASSWORD);

        final int slashIndex = url.indexOf("//");

        if (slashIndex > -1) {
            url = String.format("%s%s:%s@%s", url.substring(0, slashIndex + 2), username, password, url.substring(slashIndex + 2));
        } else {
            url = String.format("%s:%s@%s", username, password, url);
        }
        return url;
    }

    @Override
    public String getName() {
        return "pactbroker";
    }

    @Override
    public void configure(Map<String, Object> configuration) {

        this.configuration = configuration;