@@ -0,0 +1,2977 @@
+package org.apache.mesos.elasticsearch.systemtest;%0A%0Aimport com.fasterxml.jackson.core.JsonParseException;%0Aimport com.fasterxml.jackson.databind.JsonMappingException;%0Aimport com.jayway.awaitility.Awaitility;%0Aimport com.mashape.unirest.http.exceptions.UnirestException;%0Aimport org.apache.log4j.Logger;%0Aimport org.apache.mesos.mini.MesosCluster;%0Aimport org.apache.mesos.mini.mesos.MesosClusterConfig;%0Aimport org.apache.mesos.mini.state.Framework;%0Aimport org.junit.Assert;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.ClassRule;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TestWatcher;%0Aimport org.junit.runner.Description;%0A%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * TODO (jhftrifork): This is a useless JavaDoc comment%0A */%0Apublic class FrameworkRoleSystemTest %7B%0A    protected static final int NODE_COUNT = 3;%0A%0A    protected static final MesosClusterConfig CONFIG = MesosClusterConfig.builder()%0A            .numberOfSlaves(NODE_COUNT)%0A            .privateRegistryPort(15000) // Currently you have to choose an available port by yourself%0A            .slaveResources(new String%5B%5D%7B%22ports(*):%5B9200-9200,9300-9300%5D%22, %22ports(*):%5B9201-9201,9301-9301%5D%22, %22ports(*):%5B9202-9202,9302-9302%5D%22%7D)%0A            .build();%0A%0A    public static final Logger LOGGER = Logger.getLogger(FrameworkRoleSystemTest.class);%0A%0A    @ClassRule%0A    public static final MesosCluster CLUSTER = new MesosCluster(CONFIG);%0A%0A    @BeforeClass%0A    public static void startScheduler() throws Exception %7B%0A        CLUSTER.injectImage(%22mesos/elasticsearch-executor%22);%0A    %7D%0A%0A    @Rule%0A    public TestWatcher watchman = new TestWatcher() %7B%0A        @Override%0A        protected void failed(Throwable e, Description description) %7B%0A            CLUSTER.stop();%0A        %7D%0A    %7D;%0A%0A    @Test%0A    public void miniMesosReportsTheRequestedFrameworkRole() throws UnirestException, JsonParseException, JsonMappingException %7B%0A        final String ARBITRARY_ROLE_STRING = %22*%22;%0A%0A        LOGGER.info(%22Starting Elasticsearch scheduler%22);%0A        ElasticsearchSchedulerContainer scheduler = new ElasticsearchSchedulerContainer(%0A                CONFIG.dockerClient,%0A                CLUSTER.getMesosContainer().getIpAddress(),%0A                ARBITRARY_ROLE_STRING%0A        );%0A        CLUSTER.addAndStartContainer(scheduler);%0A        LOGGER.info(%22Started Elasticsearch scheduler on %22 + scheduler.getIpAddress() + %22:31100%22);%0A%0A        Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -%3E %7B%0A            LOGGER.info(%22State info: %22 + CLUSTER.getStateInfo().toString());%0A            LOGGER.info(%22Framework names: %22 + CLUSTER.getStateInfo().getFrameworks().stream().map((Framework f) -%3E f.getName()).collect(Collectors.toSet()).toString());%0A            return CLUSTER.getStateInfo().getFramework(%22elasticsearch%22) != null;%0A        %7D);%0A        Assert.assertEquals(ARBITRARY_ROLE_STRING, CLUSTER.getStateInfo().getFramework(%22elasticsearch%22).getRole());%0A        scheduler.remove();%0A    %7D%0A%7D%0A

test correct framework role is reported by mini-mesos (currently fails)