use of com.mesosphere.sdk.specification.DefaultConfigFileSpec in project dcos-commons by mesosphere.
the class ArtifactQueriesTest method testGetTemplateSuccess.
@Test
public void testGetTemplateSuccess() throws ConfigStoreException {
UUID uuid = UUID.randomUUID();
when(mockConfigStore.fetch(uuid)).thenReturn(mockServiceSpec);
when(mockServiceSpec.getPods()).thenReturn(Arrays.asList(mockPodSpec));
when(mockPodSpec.getType()).thenReturn("pod");
when(mockPodSpec.getTasks()).thenReturn(Arrays.asList(mockTaskSpec));
when(mockTaskSpec.getName()).thenReturn("task");
ConfigFileSpec configSpec = new DefaultConfigFileSpec("conffile", "../conf/confpath.xml", "content goes here");
when(mockTaskSpec.getConfigFiles()).thenReturn(Arrays.asList(configSpec));
Response r = ArtifactQueries.getTemplate(mockConfigStore, uuid.toString(), "pod", "task", "conffile");
assertEquals(200, r.getStatus());
assertEquals(MediaType.TEXT_PLAIN_TYPE, r.getMediaType());
assertEquals(configSpec.getTemplateContent(), r.getEntity());
}
Aggregations