Search in sources :

Example 1 with DefaultConfigFileSpec

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());
}
Also used : Response(javax.ws.rs.core.Response) DefaultConfigFileSpec(com.mesosphere.sdk.specification.DefaultConfigFileSpec) ConfigFileSpec(com.mesosphere.sdk.specification.ConfigFileSpec) UUID(java.util.UUID) DefaultConfigFileSpec(com.mesosphere.sdk.specification.DefaultConfigFileSpec) Test(org.junit.Test)

Aggregations

ConfigFileSpec (com.mesosphere.sdk.specification.ConfigFileSpec)1 DefaultConfigFileSpec (com.mesosphere.sdk.specification.DefaultConfigFileSpec)1 UUID (java.util.UUID)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1