@@ -0,0 +1,2937 @@
+package mesosphere.marathon.client.model.v2;%0A%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.JsonObject;%0Aimport mesosphere.marathon.client.Marathon;%0Aimport mesosphere.marathon.client.MarathonClient;%0Aimport okhttp3.mockwebserver.MockResponse;%0Aimport okhttp3.mockwebserver.MockWebServer;%0Aimport okhttp3.mockwebserver.RecordedRequest;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0A%0Aimport static org.junit.Assert.*;%0A%0Apublic class ExternalVolumeTest %7B%0A%0A    @Test%0A    public void testExternalVolumes() throws Exception %7B%0A        final MockWebServer server = new MockWebServer();%0A        final String mockResponse = %22%7B%5C%22container%5C%22: %7B%5C%22volumes%5C%22: %5B%22 +%0A                %22%7B%5C%22containerPath%5C%22:%5C%22/data/db%5C%22,%5C%22mode%5C%22:%5C%22RW%5C%22,%5C%22external%5C%22:%22 +%0A                %22%7B%5C%22name%5C%22:%5C%22mongodb-testvol%5C%22,%5C%22provider%5C%22:%5C%22dvdi%5C%22,%5C%22options%5C%22:%22 +%0A                %22%7B%5C%22dvdi/driver%5C%22:%5C%22rexray%5C%22%7D%7D%7D%5D%7D%7D%22;%0A%0A        try %7B%0A            server.enqueue(new MockResponse().setBody(mockResponse));%0A            server.start();%0A            Marathon client = MarathonClient.getInstance(server.url(%22/%22).toString());%0A%0A            App app = new App();%0A            app.setId(%22mongo%22);%0A            app.setCpus(1.0);%0A            app.setMem(256.0);%0A            app.setContainer(new Container());%0A            app.getContainer().setDocker(new Docker());%0A            app.getContainer().getDocker().setImage(%22mongo%22);%0A            app.getContainer().setVolumes(new ArrayList%3CVolume%3E());%0A%0A            ExternalVolume externalVolume = new ExternalVolume();%0A            externalVolume.setName(%22mongodb-testvol%22);%0A            externalVolume.setMode(%22RW%22);%0A            externalVolume.setContainerPath(%22/data/db%22);%0A            externalVolume.setProvider(%22dvdi%22);%0A            externalVolume.setDriver(%22rexray%22);%0A%0A            app.getContainer().getVolumes().add(externalVolume);%0A%0A            final App appRes = client.createApp(app);%0A            assertFalse(appRes.getContainer().getVolumes().isEmpty());%0A%0A            ExternalVolume responseVolume = (ExternalVolume) appRes.getContainer().getVolumes().iterator().next();%0A            assertEquals(%22mongodb-testvol%22, responseVolume.getExternalVolumeInfo().getName());%0A%0A            RecordedRequest request = server.takeRequest();%0A            assertNotNull(request);%0A%0A            final String requestBody = request.getBody().readUtf8();%0A            assertNotNull(requestBody);%0A%0A            // request to JSON%0A            JsonObject requestPayload = new Gson().fromJson(requestBody, JsonObject.class);%0A            assertNotNull(requestPayload);%0A            JsonObject requestVolume = requestPayload.getAsJsonObject(%22container%22).getAsJsonArray(%22volumes%22).get(0).getAsJsonObject();%0A            assertNotNull(requestVolume);%0A            assertEquals(%22RW%22, requestVolume.get(%22mode%22).getAsString());%0A            assertEquals(%22/data/db%22, requestVolume.get(%22containerPath%22).getAsString());%0A        %7D finally %7B%0A            server.shutdown();%0A        %7D%0A    %7D%0A%0A%7D

Add Test for External Volumes