incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [3/7] git commit: refs/heads/qemu-img - Add tests for QemuImgFile
Date Sat, 16 Feb 2013 15:07:18 GMT
Add tests for QemuImgFile


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d9df85f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d9df85f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d9df85f3

Branch: refs/heads/qemu-img
Commit: d9df85f3ece14cf026fd5ccf509bb46f1940d100
Parents: 4227094
Author: Wido den Hollander <wido@42on.com>
Authored: Sat Feb 16 15:53:35 2013 +0100
Committer: Wido den Hollander <wido@42on.com>
Committed: Sat Feb 16 15:53:35 2013 +0100

----------------------------------------------------------------------
 .../cloudstack/utils/qemu/QemuImgFileTest.java     |   60 +++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d9df85f3/utils/test/org/apache/cloudstack/utils/qemu/QemuImgFileTest.java
----------------------------------------------------------------------
diff --git a/utils/test/org/apache/cloudstack/utils/qemu/QemuImgFileTest.java b/utils/test/org/apache/cloudstack/utils/qemu/QemuImgFileTest.java
new file mode 100644
index 0000000..bb30868
--- /dev/null
+++ b/utils/test/org/apache/cloudstack/utils/qemu/QemuImgFileTest.java
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless 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 com.cloud.utils;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import org.apache.cloudstack.utils.qemu.QemuImgFile;
+import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
+
+public class QemuImgFileTest {
+    @Test
+    public void testFileNameAtContructor() {
+        String filename = "/tmp/test-image.qcow2";
+        QemuImgFile file = new QemuImgFile(filename);
+        assertEquals(file.getFileName(), filename);
+    }
+
+    @Test
+    public void testFileNameAndSizeAtContructor() {
+        long size = 1024;
+        String filename = "/tmp/test-image.qcow2";
+        QemuImgFile file = new QemuImgFile(filename, size);
+        assertEquals(file.getFileName(), filename);
+        assertEquals(file.getSize(), size);
+    }
+
+    @Test
+    public void testFileNameAndSizeAndFormatAtContructor() {
+        PhysicalDiskFormat format = PhysicalDiskFormat.RAW;
+        long size = 1024;
+        String filename = "/tmp/test-image.qcow2";
+        QemuImgFile file = new QemuImgFile(filename, size, format);
+        assertEquals(file.getFileName(), filename);
+        assertEquals(file.getSize(), size);
+        assertEquals(file.getFormat(), format);
+    }
+
+    @Test
+    public void testFileNameAndFormatAtContructor() {
+        PhysicalDiskFormat format = PhysicalDiskFormat.RAW;
+        String filename = "/tmp/test-image.qcow2";
+        QemuImgFile file = new QemuImgFile(filename, format);
+        assertEquals(file.getFileName(), filename);
+        assertEquals(file.getFormat(), format);
+    }
+}
\ No newline at end of file


Mime
View raw message