Search in sources :

Example 1 with MesosFramework

use of org.apache.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(org.apache.heron.scheduler.mesos.framework.BaseContainer) MesosFramework(org.apache.heron.scheduler.mesos.framework.MesosFramework) Config(org.apache.heron.spi.common.Config) Properties(java.util.Properties) SchedulerDriver(org.apache.mesos.SchedulerDriver) Before(org.junit.Before)

Aggregations

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