Test changes Signed-off-by: Chip Childers <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/31f0e622 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/31f0e622 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/31f0e622 Branch: refs/heads/junit-tests Commit: 31f0e622809e7b3ee02cb01ebcba7b3669301959 Parents: d41baa0 Author: Yichi Lu <[email protected]> Authored: Mon Oct 22 13:31:30 2012 -0400 Committer: Chip Childers <[email protected]> Committed: Mon Oct 22 13:31:30 2012 -0400 ---------------------------------------------------------------------- .../com/cloud/agent/api/SnapshotCommandTest.java | 98 +++++++++++++++ api/src/test/pom.xml | 66 ++++++++++ api/unittest/.gitignore | 1 - api/unittest/pom.xml | 78 ------------ api/unittest/src/com/cloud/agent/api/.gitignore | 15 --- 5 files changed, 164 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/31f0e622/api/src/test/java/com/cloud/agent/api/SnapshotCommandTest.java ---------------------------------------------------------------------- diff --git a/api/src/test/java/com/cloud/agent/api/SnapshotCommandTest.java b/api/src/test/java/com/cloud/agent/api/SnapshotCommandTest.java new file mode 100644 index 0000000..5bb412e --- /dev/null +++ b/api/src/test/java/com/cloud/agent/api/SnapshotCommandTest.java @@ -0,0 +1,98 @@ +// 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 +// with 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.agent.api; + +import com.cloud.agent.api.*; +import static org.junit.Assert.*; +import org.junit.Test; + +public class SnapshotCommandTest { + SnapshotCommand ssc = new SnapshotCommand("primaryStoragePoolNameLabel", + "http://secondary.Storage.Url", + "420fa39c-4ef1-a83c-fd93-46dc1ff515ae", + "snapshotName", + 101L, + 102L, + 103L); + + SnapshotCommand ssc1 = new SnapshotCommand(); + + @Test + public void testGetPrimaryStoragePoolNameLabel() { + String label = ssc.getPrimaryStoragePoolNameLabel(); + assertTrue(label.equals("primaryStoragePoolNameLabel")); + } + + @Test + public void testGetSecondaryStorageUrl() { + String url = ssc.getSecondaryStorageUrl(); + assertTrue(url.equals("http://secondary.Storage.Url")); + } + + @Test + public void testGetSnapshotUuid() { + String uuid = ssc.getSnapshotUuid(); + assertTrue(uuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae")); + } + + @Test + public void testGetSnapshotName() { + String name = ssc.getSnapshotName(); + assertTrue(name.equals("snapshotName")); + } + + @Test + public void testGetVolumePath() { + ssc.setVolumePath("vPath"); + String path = ssc.getVolumePath(); + assertTrue(path.equals("vPath")); + + ssc1.setVolumePath("vPath1"); + path = ssc1.getVolumePath(); + assertTrue(path.equals("vPath1")); + } + + @Test + public void testExecuteInSequence() { + boolean b = ssc.executeInSequence(); + assertFalse(b); + + b = ssc1.executeInSequence(); + assertFalse(b); + } + + @Test + public void testGetDataCenterId() { + Long dcId = ssc.getDataCenterId(); + Long expected = 101L; + assertEquals(expected, dcId); + } + + @Test + public void testGetAccountId() { + Long aId = ssc.getAccountId(); + Long expected = 102L; + assertEquals(expected, aId); + } + + @Test + public void testGetVolumeId() { + Long vId = ssc.getVolumeId(); + Long expected = 103L; + assertEquals(expected, vId); + } +} http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/31f0e622/api/src/test/pom.xml ---------------------------------------------------------------------- diff --git a/api/src/test/pom.xml b/api/src/test/pom.xml new file mode 100644 index 0000000..3f803ff --- /dev/null +++ b/api/src/test/pom.xml @@ -0,0 +1,66 @@ +<!-- + 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 + with 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.cloudstack</groupId> + <artifactId>cloud-api-test</artifactId> + <name>Apache CloudStack API Unittest</name> + <version>4.0.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.cloudstack</groupId> + <artifactId>cloud-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cloudstack</groupId> + <artifactId>cloud-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.cloudstack</groupId> + <artifactId>cloud-api-test</artifactId> + <version>4.0.0-SNAPSHOT</version> + </plugin> + </plugins> + <sourceDirectory>../../src/com/cloud/agent/api</sourceDirectory> + <testSourceDirectory>java/com/cloud/agent/api</testSourceDirectory> + <testOutputDirectory>java/com/cloud/agent/api</testOutputDirectory> + <testResources> + <testResource> + <directory>target/test-classes</directory> + </testResource> + </testResources> + </build> +</project> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/31f0e622/api/unittest/.gitignore ---------------------------------------------------------------------- diff --git a/api/unittest/.gitignore b/api/unittest/.gitignore deleted file mode 100644 index eb5a316..0000000 --- a/api/unittest/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/31f0e622/api/unittest/pom.xml ---------------------------------------------------------------------- diff --git a/api/unittest/pom.xml b/api/unittest/pom.xml deleted file mode 100644 index 8774191..0000000 --- a/api/unittest/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ -<!-- - 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 - with 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.cloudstack</groupId> - <artifactId>cloud-api-unittest</artifactId> - <name>Apache CloudStack API Unittest</name> - <version>4.0.0-SNAPSHOT</version> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - </properties> - <dependencies> - <dependency> - <groupId>org.apache.cloudstack</groupId> - <artifactId>cloud-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cloudstack</groupId> - <artifactId>cloud-utils</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.8.2</version> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.cloudstack</groupId> - <artifactId>cloud-api-unittest</artifactId> - <version>4.0.0-SNAPSHOT</version> - <configuration> - <includes> - <include>../src/com/cloud/agent/api/*.java</include> - </includes> - </configuration> - </plugin> - </plugins> - <sourceDirectory>../src/com/cloud/agent/api</sourceDirectory> - <testSourceDirectory>src/com/cloud/agent/api</testSourceDirectory> - <testOutputDirectory>src/com/cloud/agent/api</testOutputDirectory> -<!-- - <testSourceDirectory>target/test-classes</testSourceDirectory> - <testOutputDirectory>target/test-classes</testOutputDirectory> ---> - <testResources> - <testResource> -<!-- - <directory>src/com/cloud/agent/api</directory> ---> - <directory>target/test-classes</directory> - </testResource> - </testResources> - </build> -</project> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/31f0e622/api/unittest/src/com/cloud/agent/api/.gitignore ---------------------------------------------------------------------- diff --git a/api/unittest/src/com/cloud/agent/api/.gitignore b/api/unittest/src/com/cloud/agent/api/.gitignore deleted file mode 100644 index 991a3b6..0000000 --- a/api/unittest/src/com/cloud/agent/api/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.class -*.jar -*.pom -*.properties -*.repositories -*.sha1 -*.xml -META-INF/ -baremetal/ -check/ -com/ -proxy/ -routing/ -storage/ -to/
