use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class OfferEvaluatorTestBase method beforeEach.
@Before
public void beforeEach() throws Exception {
MockitoAnnotations.initMocks(this);
Persister persister = new MemPersister();
frameworkStore = new FrameworkStore(persister);
frameworkStore.storeFrameworkId(Protos.FrameworkID.newBuilder().setValue("framework-id").build());
stateStore = new StateStore(persister);
targetConfig = UUID.randomUUID();
evaluator = new OfferEvaluator(frameworkStore, stateStore, new OfferOutcomeTracker(), TestConstants.SERVICE_NAME, targetConfig, ArtifactResource.getUrlFactory(TestConstants.SERVICE_NAME), SCHEDULER_CONFIG, Optional.empty(), true);
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class DefaultServiceSpecTest method validateServiceSpec.
private void validateServiceSpec(String fileName, Boolean supportGpu) throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource(fileName).getFile());
DefaultServiceSpec serviceSpec = DefaultServiceSpec.newGenerator(file, SCHEDULER_CONFIG).build();
capabilities = mock(Capabilities.class);
when(capabilities.supportsGpuResource()).thenReturn(supportGpu);
when(capabilities.supportsCNINetworking()).thenReturn(true);
when(capabilities.supportsDomains()).thenReturn(true);
Capabilities.overrideCapabilities(capabilities);
DefaultScheduler.newBuilder(serviceSpec, SCHEDULER_CONFIG, new MemPersister()).build();
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class UninstallSchedulerTest method beforeEach.
@Before
public void beforeEach() throws Exception {
MockitoAnnotations.initMocks(this);
Persister persister = new MemPersister();
frameworkStore = new FrameworkStore(persister);
frameworkStore.storeFrameworkId(TestConstants.FRAMEWORK_ID);
stateStore = new StateStore(persister);
stateStore.storeTasks(Collections.singletonList(TASK_A));
// Have the mock plan customizer default to returning the plan unchanged.
when(mockPlanCustomizer.updateUninstallPlan(any())).thenAnswer(invocation -> invocation.getArguments()[0]);
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class CassandraRecoveryPlanOverriderTest method beforeEach.
@Before
public void beforeEach() throws Exception {
stateStore = new StateStore(new MemPersister());
ConfigStore<ServiceSpec> configStore = new ConfigStore<>(DefaultServiceSpec.getConfigurationFactory(serviceSpec), new MemPersister());
UUID targetConfig = configStore.store(serviceSpec);
configStore.setTargetConfig(targetConfig);
planOverrider = new CassandraRecoveryPlanOverrider(stateStore, getReplacePlan(configStore));
}
use of com.mesosphere.sdk.storage.MemPersister in project dcos-commons by mesosphere.
the class DefaultStepFactoryTest method getPodInstanceWithSameDnsPrefixes.
private PodInstance getPodInstanceWithSameDnsPrefixes() throws Exception {
TaskSpec taskSpec0 = TestPodFactory.getTaskSpec(TestConstants.TASK_NAME + 0, TestConstants.RESOURCE_SET_ID + 0, TestConstants.TASK_DNS_PREFIX);
TaskSpec taskSpec1 = TestPodFactory.getTaskSpec(TestConstants.TASK_NAME + 1, TestConstants.RESOURCE_SET_ID + 1, TestConstants.TASK_DNS_PREFIX);
PodSpec podSpec = DefaultPodSpec.newBuilder(SCHEDULER_CONFIG.getExecutorURI()).type(TestConstants.POD_TYPE).count(1).tasks(Arrays.asList(taskSpec0, taskSpec1)).build();
ServiceSpec serviceSpec = DefaultServiceSpec.newBuilder().name(TestConstants.SERVICE_NAME).role(TestConstants.ROLE).principal(TestConstants.PRINCIPAL).zookeeperConnection("foo.bar.com").pods(Arrays.asList(podSpec)).build();
Persister persister = new MemPersister();
stateStore = new StateStore(persister);
configStore = new ConfigStore<>(DefaultServiceSpec.getConfigurationFactory(serviceSpec), persister);
UUID configId = configStore.store(serviceSpec);
configStore.setTargetConfig(configId);
stepFactory = new DefaultStepFactory(configStore, stateStore);
return new DefaultPodInstance(podSpec, 0);
}
Aggregations