From 44fc620f67e9d46c64cf76faab6c75f047e9238b Mon Sep 17 00:00:00 2001 From: danikov Date: Wed, 29 Feb 2012 11:38:41 +0000 Subject: [PATCH] outline some live testing for the upload client --- .../v1_5/features/UploadClientLiveTest.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UploadClientLiveTest.java diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UploadClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UploadClientLiveTest.java new file mode 100644 index 0000000000..cb6640e665 --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UploadClientLiveTest.java @@ -0,0 +1,66 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + *(Link.builder().regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless(Link.builder().required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.features; + +import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * Tests behavior of {@link NetworkClient} + * + * @author danikov + */ +@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest") +public class UploadClientLiveTest extends BaseVCloudDirectorClientLiveTest { + + public static final String UPLOAD = "upload"; + + /* + * Convenience reference to API client. + */ + protected UploadClient uploadClient; + + @BeforeClass(inheritGroups = true) + @Override + public void setupRequiredClients() { +// uploadClient = context.getApi().getUploadClient(); + } + + @Test(testName = "PUT ???") + public void testUpload() { + ////TODO upload to target + // long sourceChecksum = 0;// = Files.getChecksum(sourceFile, new CRC32()) + // + // // TODO: await task to complete + // media = mediaClient.getMedia(media); + // TasksInProgress tasks = media.getTasksInProgress(); + // if (tasks.getTasks().size() > 0) { +// assertTrue(tasks.getTasks().size() == 1, ""); +// Task uploadTask = Iterables.getFirst(tasks.getTasks(), null); +// Checks.checkTask(uploadTask); +// assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "createMedia")); + // } + // + // // TODO: make assertions that the task was successful + // media = mediaClient.getMedia(media); + // assertTrue(equal(sourceFile.length(), uploadFile.getSize()), ""); + // assertTrue(equal(sourceChecksum, uploadFile.getChecksum()), ""); + } +}