Search in sources :

Example 1 with MesosFramework

use of com.twitter.heron.scheduler.mesos.framework.MesosFramework in project heron by twitter.

the class MesosSchedulerTest method before.

@Before
public void before() throws Exception {
    Config config = Mockito.mock(Config.class);
    Mockito.when(config.getStringValue(Key.TOPOLOGY_NAME)).thenReturn(TOPOLOGY_NAME);
    Mockito.when(config.getStringValue(Key.ROLE)).thenReturn(ROLE);
    Mockito.when(config.getStringValue(Key.CORE_PACKAGE_URI)).thenReturn(CORE_PACKAGE_URI);
    Config runtime = Mockito.mock(Config.class);
    Mockito.when(runtime.getLongValue(Key.NUM_CONTAINERS)).thenReturn(NUM_CONTAINER);
    Properties properties = new Properties();
    properties.put(Key.TOPOLOGY_PACKAGE_URI.value(), TOPOLOGY_PACKAGE_URI);
    Mockito.when(runtime.get(Key.SCHEDULER_PROPERTIES)).thenReturn(properties);
    mesosFramework = Mockito.mock(MesosFramework.class);
    SchedulerDriver driver = Mockito.mock(SchedulerDriver.class);
    baseContainer = Mockito.mock(BaseContainer.class);
    scheduler = Mockito.spy(MesosScheduler.class);
    Mockito.doReturn(mesosFramework).when(scheduler).getMesosFramework();
    Mockito.doReturn(driver).when(scheduler).getSchedulerDriver(Mockito.anyString(), Mockito.eq(mesosFramework));
    Mockito.doNothing().when(scheduler).startSchedulerDriver();
    scheduler.initialize(config, runtime);
}
Also used : BaseContainer(com.twitter.heron.scheduler.mesos.framework.BaseContainer) MesosFramework(com.twitter.heron.scheduler.mesos.framework.MesosFramework) Config(com.twitter.heron.spi.common.Config) Properties(java.util.Properties) SchedulerDriver(org.apache.mesos.SchedulerDriver) Before(org.junit.Before)

Aggregations

BaseContainer (com.twitter.heron.scheduler.mesos.framework.BaseContainer)1 MesosFramework (com.twitter.heron.scheduler.mesos.framework.MesosFramework)1 Config (com.twitter.heron.spi.common.Config)1 Properties (java.util.Properties)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1 Before (org.junit.Before)1