diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-11-25 20:13:35 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-11-25 20:13:35 +0530 |
| commit | 1142b0e41de39010de7845cf70d71dbb001fc1dc (patch) | |
| tree | 3513487f65c1a7df47996bd2852393aceaac1b8a /src/com.gluster.storage.management.core/junit | |
| parent | 92c52d8edf285945d31e446503fc742fde9dcc49 (diff) | |
Renamed projects / packages com.gluster.* to org.gluster.*
Diffstat (limited to 'src/com.gluster.storage.management.core/junit')
10 files changed, 0 insertions, 2132 deletions
diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/AlertTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/AlertTest.java deleted file mode 100644 index 81c7a601..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/AlertTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.gluster.storage.management.core.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.gluster.storage.management.core.model.Alert.ALERT_TYPES; - -/** - * The class <code>AlertTest</code> contains tests for the class <code>{@link Alert}</code>. - * - * @generatedBy CodePro at 10/17/11 3:32 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class AlertTest { - - /** - * Run the void copyFrom(Alert) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 3:32 PM - */ - @Test - public void testCopyFrom_1() - throws Exception { - Alert fixture = new Alert(ALERT_TYPES.DISK_USAGE_ALERT, "server1:sda", - Alert.ALERT_TYPE_STR[ALERT_TYPES.DISK_USAGE_ALERT.ordinal()] + " [85% used] in disk [server1:sda]"); - Alert alert = new Alert(); - alert.copyFrom(fixture); - - assertEquals(fixture.getId(), alert.getId()); - assertEquals(fixture.getReference(), alert.getReference()); - assertEquals(fixture.getType(), alert.getType()); - assertEquals(fixture.getMessage(), alert.getMessage()); - assertNotNull(alert); - } - - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 10/17/11 3:32 PM - */ - @Before - public void setUp() - throws Exception { - // add additional set up code here - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 10/17/11 3:32 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 10/17/11 3:32 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(AlertTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/BrickTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/BrickTest.java deleted file mode 100644 index 329ee926..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/BrickTest.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.gluster.storage.management.core.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.gluster.storage.management.core.model.Brick.BRICK_STATUS; - -/** - * The class <code>BrickTest</code> contains tests for the class <code>{@link Brick}</code>. - * - * @generatedBy CodePro at 10/17/11 4:39 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class BrickTest { - /** - * Run the void copyFrom(Brick) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testCopyFrom_1() - throws Exception { - Brick fixture = new Brick("Server1", BRICK_STATUS.ONLINE, "/sda1/songs"); - Brick newBrick = new Brick(); - newBrick.copyFrom(fixture); - - assertEquals(fixture.getServerName(), newBrick.getServerName()); - assertEquals(fixture.getBrickDirectory(), newBrick.getBrickDirectory()); - assertEquals(fixture.getStatus(), newBrick.getStatus()); - assertEquals(fixture.getQualifiedName(), newBrick.getQualifiedName()); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testEquals_1() - throws Exception { - Brick fixture = new Brick("Server1", BRICK_STATUS.ONLINE, "/sda1/songs"); - Brick newBrick = new Brick(); - newBrick.copyFrom(fixture); - - boolean result = fixture.equals(newBrick); - assertTrue(result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testEquals_2() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - Brick newBrick = new Brick(); - newBrick.copyFrom(fixture); - - boolean result = fixture.equals(newBrick); - assertTrue(result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testEquals_3() - throws Exception { - Brick fixture = new Brick("", BRICK_STATUS.ONLINE, ""); - Brick newBrick = new Brick(); - newBrick.copyFrom(fixture); - - boolean result = fixture.equals(newBrick); - assertTrue(result); - } - - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testFilter_1() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String filterString = "Ser"; - boolean caseSensitive = true; - - boolean result = fixture.filter(filterString, caseSensitive); - assertTrue(result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testFilter_2() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String filterString = "ser"; - boolean caseSensitive = true; - - boolean result = fixture.filter(filterString, caseSensitive); - assertEquals(result, false); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testFilter_3() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String filterString = "Ser"; - boolean caseSensitive = false; - - boolean result = fixture.filter(filterString, caseSensitive); - assertTrue(result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testFilter_4() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.ONLINE, "/md1/test"); - - String filterString = "ser"; - boolean caseSensitive = false; - - boolean result = fixture.filter(filterString, caseSensitive); - assertTrue(result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testFilter_5() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String filterString = ""; - boolean caseSensitive = false; - - boolean result = fixture.filter(filterString, caseSensitive); - assertTrue(result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testFilter_6() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String filterString = ""; - boolean caseSensitive = true; - - boolean result = fixture.filter(filterString, caseSensitive); - assertTrue(result); - } - - - /** - * Run the String getQualifiedName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testGetQualifiedName_1() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String result = fixture.getQualifiedName(); - - assertNotNull(result); - assertEquals(result, "Server2:/md1/test"); - } - - /** - * Run the String getQualifiedName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testGetQualifiedName_2() - throws Exception { - Brick fixture = new Brick("", BRICK_STATUS.OFFLINE, ""); - - String result = fixture.getQualifiedName(); - - assertNotNull(result); - assertEquals(result, ":"); - } - - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Test - public void testToString_1() - throws Exception { - Brick fixture = new Brick("Server2", BRICK_STATUS.OFFLINE, "/md1/test"); - - String result = fixture.toString(); - - assertNotNull(result); - assertEquals(result, "Server2:/md1/test"); - } - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @Before - public void setUp() - throws Exception { - // add additional set up code here - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 10/17/11 4:39 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(BrickTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/ClusterTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/ClusterTest.java deleted file mode 100644 index c2e488b1..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/ClusterTest.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.gluster.storage.management.core.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.gluster.storage.management.core.model.Brick.BRICK_STATUS; -import com.gluster.storage.management.core.model.Device.DEVICE_STATUS; -import com.gluster.storage.management.core.model.Device.DEVICE_TYPE; -import com.gluster.storage.management.core.model.Server.SERVER_STATUS; -import com.gluster.storage.management.core.model.Volume.TRANSPORT_TYPE; -import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS; -import com.gluster.storage.management.core.model.Volume.VOLUME_TYPE; - -/** - * The class <code>ClusterTest</code> contains tests for the class <code>{@link Cluster}</code>. - * - * @generatedBy CodePro at 10/18/11 2:53 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class ClusterTest { - private Cluster fixture; - - public List<Disk> getDisks(Server server) { - List<Disk> disks = new ArrayList<Disk>(); - disks.add(new Disk(server, "sda", "", 12456.0, 0.0, DEVICE_STATUS.UNINITIALIZED)); - Disk disk = new Disk(server, "sdb1", "/export", 134342456.0, 120343.0, DEVICE_STATUS.INITIALIZED); - disk.setType(DEVICE_TYPE.DATA); - disks.add(disk); - disk = new Disk(server, "sdc2", "/export", 876534346.0, 56334.0, DEVICE_STATUS.INITIALIZED); - disk.setType(DEVICE_TYPE.DATA); - disks.add(disk); - return disks; - } - - public List<GlusterServer> getServers() { - List<GlusterServer> servers = new ArrayList<GlusterServer>(); - GlusterServer server1 = new GlusterServer("Server1", null, SERVER_STATUS.ONLINE, 2, 10, 8, 4); - server1.addDisks(getDisks(server1)); - servers.add(server1); - - GlusterServer server2 = new GlusterServer("Server2", null, SERVER_STATUS.ONLINE, 1, 90, 10, 9); - server2.addDisks(getDisks(server2)); - servers.add(server2); - - GlusterServer server3 = new GlusterServer("Server3", null, SERVER_STATUS.ONLINE, 4, 50, 6, 5); - server3.addDisks(getDisks(server3)); - servers.add(server3); - - GlusterServer server4 = new GlusterServer("Server4", null, SERVER_STATUS.ONLINE, 2, 40, 4, 3); - server4.addDisks(getDisks(server4)); - servers.add(server4); - - return servers; - } - - public List<Brick> getBricks(String volumeName) { - List<Brick> bricks = new ArrayList<Brick>(); - Brick brick1 = new Brick("Server1", BRICK_STATUS.ONLINE, "/sda1/"+volumeName); - bricks.add(brick1); - Brick brick2 = new Brick("Server2", BRICK_STATUS.ONLINE, "/sdb1/"+volumeName); - bricks.add(brick2); - Brick brick3 = new Brick("Server3", BRICK_STATUS.ONLINE, "/sdc1/"+volumeName); - bricks.add(brick3); - Brick brick4 = new Brick("Server4", BRICK_STATUS.OFFLINE, "/sda2/"+volumeName); - bricks.add(brick4); - return bricks; - } - - - public void populateVolumes(Cluster cluster) { - Volume volume1 = new Volume("Songs", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.ETHERNET, - VOLUME_STATUS.ONLINE); - volume1.addBricks(getBricks(volume1.getName())); - cluster.addVolume(volume1); - - Volume volume2 = new Volume("Movie", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.ETHERNET, - VOLUME_STATUS.ONLINE); - volume2.addBricks(getBricks(volume1.getName())); - cluster.addVolume(volume2); - - Volume volume3 = new Volume("graphics", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.INFINIBAND, - VOLUME_STATUS.ONLINE); - volume3.addBricks(getBricks(volume1.getName())); - cluster.addVolume(volume3); - - Volume volume4 = new Volume("cartoon", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.ETHERNET, - VOLUME_STATUS.ONLINE); - volume4.addBricks(getBricks(volume1.getName())); - cluster.addVolume(volume4); - return; - } - - /** - * Run the double getDiskSpaceInUse() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - @Test - public void testGetDiskSpaceInUse_1() - throws Exception { - double result = fixture.getDiskSpaceInUse(); - - assertEquals(706708.0, result, 0.1); - } - - /** - * Run the GlusterServer getServer(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - @Test - public void testGetServer_1() - throws Exception { - GlusterServer result = fixture.getServer("Server1"); - - assertNotNull(result); - assertEquals("Server1", result.getName()); - assertEquals(2, result.getNumOfCPUs()); - assertEquals(3, result.getNumOfDisks() ); - } - - /** - * Run the double getTotalDiskSpace() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - @Test - public void testGetTotalDiskSpace_1() - throws Exception { - double result = fixture.getTotalDiskSpace(); - assertEquals(4043557032.0, result, 0.1); // Including unformatted disks(!) - } - - /** - * Run the double getTotalDiskSpace() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - @Test - public void testGetVolume_1() - throws Exception { - populateVolumes(fixture); - Volume result = fixture.getVolume("Songs"); - assertNotNull(result); - assertTrue(result instanceof Volume); - } - - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - @Before - public void setUp() - throws Exception { - fixture = new Cluster(); - fixture.setServers(getServers()); - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 10/18/11 2:53 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(ClusterTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/DiskTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/DiskTest.java deleted file mode 100644 index b6bd4142..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/DiskTest.java +++ /dev/null @@ -1,483 +0,0 @@ -package com.gluster.storage.management.core.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.util.ArrayList; -import java.util.Collection; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.gluster.storage.management.core.model.Device.DEVICE_STATUS; -import com.gluster.storage.management.core.model.Device.DEVICE_TYPE; - -/** - * The class <code>DiskTest</code> contains tests for the class <code>{@link Disk}</code>. - * - * @generatedBy CodePro at 10/19/11 6:26 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class DiskTest { - private Disk disk; - - /** - * Run the Disk() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testDisk_1() - throws Exception { - - // add additional test code here - assertNotNull(disk); - assertEquals(new Double(5000.0), disk.getSpace()); - assertEquals("Hitachi HTS72323 ATA", disk.getDescription()); - assertEquals(true, disk.isReady()); - assertEquals(null, disk.getDiskInterface()); - assertEquals(null, disk.getRaidDisks()); - assertEquals(false, disk.hasPartitions()); - assertEquals(new Double(3000.0), disk.getSpaceInUse()); - assertEquals(DEVICE_TYPE.DATA, disk.getType()); - assertEquals(new Double(2000.0), disk.getFreeSpace()); - assertEquals(DEVICE_STATUS.INITIALIZED, disk.getStatus()); - assertEquals("Server1:sda1", disk.getQualifiedName()); - assertEquals(true, disk.isInitialized()); - assertEquals(false, disk.hasErrors()); - assertEquals("Server1", disk.getServerName()); - assertEquals("Available", disk.getStatusStr()); - assertEquals(false, disk.isUninitialized()); - assertEquals("/md0/sda1", disk.getMountPoint()); - assertEquals("ext4", disk.getFsType()); - assertEquals("3.2.3", disk.getFsVersion()); - assertEquals("sda1", disk.toString()); - assertEquals("sda1", disk.getName()); - assertTrue(disk.getParent() instanceof Server); - } - - /** - * Run the Disk(Server,String,String,Double,Double,DEVICE_STATUS) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testDisk_2() - throws Exception { - Server server = new Server(); - String name = ""; - String mountPoint = ""; - Double space = new Double(1.0); - Double spaceInUse = new Double(1.0); - Device.DEVICE_STATUS status = Device.DEVICE_STATUS.INITIALIZED; - - Disk newDisk = new Disk(server, name, mountPoint, space, spaceInUse, status); - - // add additional test code here - assertNotNull(newDisk); - assertEquals(new Double(1.0), newDisk.getSpace()); - assertEquals(null, newDisk.getDescription()); - assertEquals(false, newDisk.isReady()); - assertEquals(null, newDisk.getDiskInterface()); - assertEquals(null, newDisk.getRaidDisks()); - assertEquals(false, newDisk.hasPartitions()); - assertEquals(new Double(1.0), newDisk.getSpaceInUse()); - assertEquals(null, newDisk.getType()); - assertEquals(new Double(0.0), newDisk.getFreeSpace()); - assertEquals("null:", newDisk.getQualifiedName()); - assertEquals(true, newDisk.isInitialized()); - assertEquals(false, newDisk.hasErrors()); - assertEquals(null, newDisk.getServerName()); - assertEquals("Initialized", newDisk.getStatusStr()); - assertEquals(false, newDisk.isUninitialized()); - assertEquals("", newDisk.getMountPoint()); - assertEquals(null, newDisk.getFsType()); - assertEquals(null, newDisk.getFsVersion()); - assertEquals("", newDisk.toString()); - assertEquals("", newDisk.getName()); - } - - /** - * Run the void copyFrom(Disk) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testCopyFrom_1() - throws Exception { - Disk newDisk = new Disk(); - newDisk.copyFrom(disk); - - assertEquals(newDisk.getSpace(), disk.getSpace()); - assertEquals(newDisk.getDescription(), disk.getDescription()); - assertEquals(newDisk.isReady(), disk.isReady()); - assertEquals(newDisk.getDiskInterface(), disk.getDiskInterface()); - assertEquals(newDisk.getRaidDisks(), disk.getRaidDisks()); - assertEquals(newDisk.hasPartitions(), disk.hasPartitions()); - assertEquals(newDisk.getSpaceInUse(), disk.getSpaceInUse()); - assertEquals(newDisk.getType(), disk.getType()); - assertEquals(newDisk.getFreeSpace(), disk.getFreeSpace()); - assertEquals(newDisk.getStatus(), disk.getStatus()); - assertEquals(newDisk.getQualifiedName(), disk.getQualifiedName()); - assertEquals(newDisk.isInitialized(), disk.isInitialized()); - assertEquals(newDisk.hasErrors(), disk.hasErrors()); - assertEquals(newDisk.getServerName(), disk.getServerName()); - assertEquals(newDisk.getStatusStr(), disk.getStatusStr()); - assertEquals(newDisk.isUninitialized(), disk.isUninitialized()); - assertEquals(newDisk.getMountPoint(), disk.getMountPoint()); - assertEquals(newDisk.getFsType(), disk.getFsType()); - assertEquals(newDisk.getFsVersion(), disk.getFsVersion()); - assertEquals(newDisk.toString(), disk.toString()); - assertEquals(newDisk.getName(), disk.getName()); - assertEquals(newDisk.getParent(), disk.getParent()); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testEquals_1() - throws Exception { - - Disk newDisk = new Disk(); - newDisk.copyFrom(disk); - boolean result = newDisk.equals(disk); - - assertTrue(result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testEquals_2() - throws Exception { - Server server = new Server(); - String name = ""; - String mountPoint = ""; - Double space = new Double(1.0); - Double spaceInUse = new Double(1.0); - Device.DEVICE_STATUS status = Device.DEVICE_STATUS.INITIALIZED; - Disk newDisk = new Disk(server, name, mountPoint, space, spaceInUse, status); - - boolean result = newDisk.equals(disk); - - assertTrue(!result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testEquals_3() - throws Exception { - - Disk newDisk = new Disk(); - newDisk.copyFrom(disk); - boolean result = newDisk.equals(disk); - - assertTrue(result); - } - - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testFilter_1() - throws Exception { - String filterString = ""; - boolean caseSensitive = true; - boolean result = disk.filter(filterString, caseSensitive); - - assertTrue(result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testFilter_2() - throws Exception { - String filterString = "Serv"; - boolean caseSensitive = true; - boolean result = disk.filter(filterString, caseSensitive); - - assertTrue(result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testFilter_3() - throws Exception { - String filterString = "serv"; - boolean caseSensitive = true; - boolean result = disk.filter(filterString, caseSensitive); - assertTrue(!result); - } - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testFilter_4() - throws Exception { - String filterString = "hitachi"; - boolean caseSensitive = true; - - boolean result = disk.filter(filterString, caseSensitive); - assertTrue(!result); - } - - - - /** - * Run the boolean filter(String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testFilter_5() - throws Exception { - String filterString = "hitachi"; - boolean caseSensitive = false; - - boolean result = disk.filter(filterString, caseSensitive); - assertTrue(result); - } - - - /** - * Run the Double getSpace() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testGetSpace_1() - throws Exception { - Double result = disk.getSpace(); - assertNotNull(result); - assertTrue(result instanceof Double); - } - - - - /** - * Run the Double getSpaceInUse() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testGetSpaceInUse_1() - throws Exception { - Double result = disk.getSpaceInUse(); - assertNotNull(result); - assertTrue(result instanceof Double); - } - - - /** - * Run the boolean hasPartitions() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testHasPartitions_1() - throws Exception { - disk.setPartitions(new ArrayList<Partition>()); - boolean result = disk.hasPartitions(); - assertTrue(!result); - } - - - - /** - * Run the boolean isReady() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testIsReady_1() - throws Exception { - boolean result = disk.isReady(); - System.out.println("Disk status is [" + result + "] on [" + disk.getName() +"] and Status is [" + disk.getStatusStr() +"]"); - assertTrue(result); - } - - /** - * Run the boolean isReady() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testIsReady_2() - throws Exception { - disk.setPartitions(new ArrayList<Partition>()); - boolean result = disk.isReady(); - assertTrue(result); - } - - /** - * Run the boolean isReady() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testIsReady_3() - throws Exception { - disk.setStatus(DEVICE_STATUS.UNINITIALIZED); - boolean result = disk.isReady(); - assertTrue(!result); - } - - /** - * Run the boolean isReady() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testIsReady_4() - throws Exception { - disk.setStatus(DEVICE_STATUS.IO_ERROR); - boolean result = disk.isReady(); - - assertTrue(!result); - } - - /** - * Run the boolean isReady() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testIsReady_5() - throws Exception { - disk.setStatus(DEVICE_STATUS.INITIALIZING); - boolean result = disk.isReady(); - - assertTrue(!result); - } - - /** - * Run the boolean isReady() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Test - public void testIsReady_6() - throws Exception { - disk.setStatus(DEVICE_STATUS.UNKNOWN); - boolean result = disk.isReady(); - - assertTrue(!result); - } - - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @Before - public void setUp() - throws Exception { - Server server = new Server("Server1", null, 2, 25D, 5000D, 2000D); - disk = new Disk(server,"sda1", "/md0/sda1", 5000D, 3000D, DEVICE_STATUS.INITIALIZED); - disk.setDescription("Hitachi HTS72323 ATA"); - disk.setFsType("ext4"); - disk.setFsVersion("3.2.3"); - disk.setType(DEVICE_TYPE.DATA); - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(DiskTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/TestAll.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/TestAll.java deleted file mode 100644 index 159ff256..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/model/TestAll.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.gluster.storage.management.core.model; - -import org.junit.runner.JUnitCore; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * The class <code>TestAll</code> builds a suite that can be used to run all - * of the tests within its package as well as within any subpackages of its - * package. - * - * @generatedBy CodePro at 10/19/11 6:26 PM - * @author root - * @version $Revision: 1.0 $ - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - BrickTest.class, - ClusterTest.class, - AlertTest.class, - DiskTest.class, -}) -public class TestAll { - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 10/19/11 6:26 PM - */ - public static void main(String[] args) { - JUnitCore.runClasses(new Class[] { TestAll.class }); - } -} diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java deleted file mode 100644 index c19b75d2..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.gluster.storage.management.core.utils; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.gluster.storage.management.core.constants.CoreConstants; -import com.gluster.storage.management.core.exceptions.GlusterRuntimeException; - -/** - * The class <code>DateUtilTest</code> contains tests for the class <code>{@link DateUtil}</code>. - * - * @generatedBy CodePro at 9/27/11 12:31 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class DateUtilTest { - - private Date date = DateUtil.getDate(2011, 9, 29, 11, 17, 38, 10); - - /** - * Run the String dateToString(Date) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testDateToString_1() - throws Exception { - String result = DateUtil.dateToString(date); - - assertEquals("09/29/2011 11:17:38", result); - } - - /** - * Run the String dateToString(Date,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testDateToString_2() - throws Exception { - String dateFormat = ""; - - String result = DateUtil.dateToString(date, dateFormat); - assertEquals("", result); - } - - /** - * Run the String dateToString(Date,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testDateToString_3() - throws Exception { - String dateFormat = CoreConstants.PURE_DATE_FORMAT; - - String result = DateUtil.dateToString(date, dateFormat); - assertEquals("09/29/2011", result); - } - - /** - * Run the String formatDate(Date) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testFormatDate_1() - throws Exception { - String result = DateUtil.formatDate(date); - - assertEquals("09/29/2011", result); - } - - /** - * Run the String formatDate(Date) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testFormatDate_2() - throws Exception { - Date date1 = DateUtil.getDate(1965, 1, 12, 0, 0, 0, 0); - String result = DateUtil.formatDate(date1); - assertEquals("01/12/1965", result); - } - - /** - * Run the String formatTime(Date) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testFormatTime_1() - throws Exception { - String result = DateUtil.formatTime(date); - - // add additional test code here - assertEquals("11:17:38.010", result); - } - - /** - * Run the Date stringToDate(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test(expected=GlusterRuntimeException.class) - public void testStringToDate_1() - throws Exception { - DateUtil.stringToDate(""); - } - - /** - * Run the Date stringToDate(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test(expected=GlusterRuntimeException.class) - public void testStringToDate_2() - throws Exception { - String testDate = "09/29/2011"; - DateUtil.stringToDate(testDate); - } - - /** - * Run the Date stringToDate(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test - public void testStringToDate_3() - throws Exception { - String dateFormat = "MM/dd/yyyy"; - String input = "09/29/2011"; // MM/dd/yyyy HH:mm:ss - Date expectedDate = DateUtil.getDate(2011, 9, 29, 0, 0, 0, 0); - - Date result = DateUtil.stringToDate(input, dateFormat); - assertEquals(expectedDate, result); - } - - /** - * Run the Date stringToDate(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Test(expected = GlusterRuntimeException.class) - public void testStringToDate_4() - throws Exception { - String inputDate = ""; - String dateFormat = ""; - - DateUtil.stringToDate(inputDate, dateFormat); - } - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @Before - public void setUp() - throws Exception { - // add additional set up code here - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 9/27/11 12:31 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(DateUtilTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java deleted file mode 100644 index 9302619e..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java +++ /dev/null @@ -1,481 +0,0 @@ -package com.gluster.storage.management.core.utils; - -import static org.junit.Assert.*; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.gluster.storage.management.core.exceptions.GlusterRuntimeException; - - -/** - * The class <code>FileUtilTest</code> contains tests for the class <code>{@link FileUtil}</code>. - * - * @generatedBy CodePro at 9/29/11 2:39 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class FileUtilTest { - - - private static final String TEST_FILE_PATH = FileUtil.getTempDirName() + "/test.txt"; - private static final String TEST_FILE_CONTENT = "Welcome to Gluster Storage Management console."; - - - /** - * To write the text into given file. - * - * @generatedBy - */ - private boolean writeToFile(String fileName, String text) { - try { - Writer output = null; - File file = new File(fileName); - output = new BufferedWriter(new FileWriter(file)); - output.write(text); - output.close(); - return true; - } catch (Exception e) { - return false; - } - } - - private boolean createNestedDir(String path) { - File file = new File(path); - return file.mkdirs(); - } - - private boolean createEmptyFile(String fileName) { - File file = new File(fileName); - if (file.exists()) { - return true; - } - - try { - return file.createNewFile(); - } catch (IOException e) { - return false; - } - } - - /** - * Run the File createTempDir() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testCreateTempDir_1() - throws Exception { - - File result = FileUtil.createTempDir(); - - assertNotNull(result); - assertTrue(File.class.equals(result.getClass())); - } - - /** - * Run the File createTempDir() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testCreateTempDir_2() - throws Exception { - - File result1 = FileUtil.createTempDir(); - File result2 = FileUtil.createTempDir(); - - assertNotSame(result1, result2); - } - - - /** - * Run the void createTextFile(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test(expected=GlusterRuntimeException.class) - public void testCreateTextFile_1() - throws Exception { - String fileName = ""; - String contents = ""; - FileUtil.createTextFile(fileName, contents); - } - - /** - * Run the String getTempDirName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testGetTempDirName_1() - throws Exception { - String result = FileUtil.getTempDirName(); - - // while running on linux - assertEquals("/tmp", result); - } - - /** - * Run the byte[] readFileAsByteArray(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - - @Test(expected=GlusterRuntimeException.class) - public void testReadFileAsByteArray_1() - throws Exception { - File file = new File(""); - - byte[] result = FileUtil.readFileAsByteArray(file); - } - - /** - * Run the byte[] readFileAsByteArray(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testReadFileAsByteArray_2() - throws Exception { - File file = new File(TEST_FILE_PATH); - - byte[] result = FileUtil.readFileAsByteArray(file); - assertNotNull(result); - assertTrue(result instanceof byte[]); - assertTrue(TEST_FILE_CONTENT.equals(new String(result))); - } - - - /** - * Run the String readFileAsString(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - - @Test(expected=GlusterRuntimeException.class) - public void testReadFileAsString_1() - throws Exception { - File file = new File(""); - - FileUtil.readFileAsString(file); - } - - - /** - * Run the String readFileAsString(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testReadFileAsString_2() - throws Exception { - File file = new File(TEST_FILE_PATH); - String result = FileUtil.readFileAsString(file); - - assertNotNull(result); - assertTrue(result instanceof String); - assertTrue(result.equals(TEST_FILE_CONTENT)); - } - - /** - * Run the void recursiveDelete(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testRecursiveDelete_1() - throws Exception { - - //Delete empty directories recursively - File fileOrDir = new File(FileUtil.getTempDirName() + "/rd"); - - FileUtil.recursiveDelete(fileOrDir); - assertTrue(!fileOrDir.exists()); - } - - /** - * Run the void recursiveDelete(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - - @Test(expected=GlusterRuntimeException.class) - public void testRecursiveDelete_2() - throws Exception { - //Delete directories recursively (with some files) - File fileOrDir = new File(FileUtil.getTempDirName() + "/rdx"); - - FileUtil.recursiveDelete(fileOrDir); - assertTrue(!fileOrDir.exists()); - } - - /** - * Run the void recursiveDelete(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testRecursiveDelete_3() - throws Exception { - File fileOrDir = new File(FileUtil.getTempDirName() + "/rd"); - FileUtil.recursiveDelete(fileOrDir); - assertTrue(!fileOrDir.exists()); - } - - /** - * Run the void recursiveDelete(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testRecursiveDelete_4() - throws Exception { - File file = new File(FileUtil.getTempDirName() + "/rd/b/bc/mydoc.txt"); - assertTrue(!file.exists()); - - file = new File(FileUtil.getTempDirName() + "/rd//b/bc"); - assertTrue(!file.exists()); - } - - /** - * Run the void recursiveDelete(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test(expected=GlusterRuntimeException.class) - public void testRecursiveDelete_5() - throws Exception { - File fileOrDir = new File(FileUtil.getTempDirName() + "/rd/*"); //Wild cards - FileUtil.recursiveDelete(fileOrDir); - } - - - /** - * Run the void recursiveDelete(File) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test(expected=GlusterRuntimeException.class) - public void testRecursiveDelete_6() - throws Exception { - File fileOrDir = new File(FileUtil.getTempDirName() + "/abcxyz"); - FileUtil.recursiveDelete(fileOrDir); - } - - /** - * Run the void renameFile(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - - @Test(expected=GlusterRuntimeException.class) - public void testRenameFile_1() - throws Exception { - String fromPath = FileUtil.getTempDirName() + "/test.txt"; - new File(fromPath).createNewFile(); - String toPath = "~/abc.txt"; // Relative path - - FileUtil.renameFile(fromPath, toPath); - assertTrue(!new File(fromPath).exists()); - assertTrue(new File(toPath).exists()); - } - - /** - * Run the void renameFile(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Test - public void testRenameFile_2() - throws Exception { - String fromPath = FileUtil.getTempDirName() + "/test.txt"; - new File(fromPath).createNewFile(); - - String toPath = FileUtil.getTempDirName() + "/abc.txt"; // Absolute path example - FileUtil.renameFile(fromPath, toPath); - assertTrue(!new File(fromPath).exists()); - assertTrue(new File(toPath).exists()); - } - - @Test - public void testRenameFile_3() - throws Exception { - String fromPath = FileUtil.getTempDirName() + "/test.txt"; - new File(fromPath).createNewFile(); - - String toPath = FileUtil.getTempDirName() + "/renamefile.txt"; - FileUtil.renameFile(fromPath, toPath); - assertTrue(!new File(fromPath).exists()); - assertTrue(new File(toPath).exists()); - } - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @Before - public void setUp() - throws Exception { - - // testReadFileAsByteArray_2() - if (!writeToFile(TEST_FILE_PATH, TEST_FILE_CONTENT)) { - fail("Setup: Text file creation error!"); - } - - // testRecursiveDelete_1() - if (!createNestedDir(FileUtil.getTempDirName() + "/rd/b/c/d")) { - createEmptyFile(FileUtil.getTempDirName() + "/rd/b/mydoc.txt"); - createEmptyFile(FileUtil.getTempDirName() + "/rd/b/songs.mp3"); - createEmptyFile(FileUtil.getTempDirName() + "/rd/b/mysetup.cfg"); - - createEmptyFile(FileUtil.getTempDirName() + "/rd/b/bc/mydoc.txt"); - createEmptyFile(FileUtil.getTempDirName() + "/rd/songs.mp3"); - createEmptyFile(FileUtil.getTempDirName() + "/rd/b/bc/mysetup.cfg"); - - createEmptyFile(FileUtil.getTempDirName() + "/rd//b/mydoc.txt"); - createEmptyFile(FileUtil.getTempDirName() + "/rd/b/bc/songs.mp3"); - - } - - if (! createEmptyFile(FileUtil.getTempDirName() + "/renamefile.txt") ) { - fail("Failed to create file [/renamefile.txt]"); - } - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - @After - public void tearDown() - throws Exception { - File file = new File(TEST_FILE_PATH); - file.delete(); - file = new File(FileUtil.getTempDirName() + "/rd/b/c/d"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/rd/b/c"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/rd/b/mydoc.txt"); - if (file.exists()) { - file.delete(); - } - file = new File(FileUtil.getTempDirName() + "/rd/b/songs.mp3"); - if (file.exists()) { - file.delete(); - } - file = new File(FileUtil.getTempDirName() + "/rd/b/mysetup.cfg"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/rd/b/bc/mydoc.txt"); - if (file.exists()) { - file.delete(); - } - file = new File(FileUtil.getTempDirName() + "/rd/b/bc/mysetup.cfg"); - if (file.exists()) { - file.delete(); - } - file = new File(FileUtil.getTempDirName() + "/rd/b/bc/songs.mp3"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/rd/b/bc"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/rd/b"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/rd"); - if (file.exists()) { - file.delete(); - } - - file = new File(FileUtil.getTempDirName() + "/abc.txt"); - if (file.exists()) { - file.delete(); - } - file = new File("~/abc.txt"); - if (file.exists()) { - file.delete(); - } - file = new File(FileUtil.getTempDirName() + "/test.txt"); - if (file.exists()) { - file.delete(); - } - file = new File(FileUtil.getTempDirName() + "/renamefile.txt"); - if (file.exists()) { - file.delete(); - } - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 9/29/11 2:39 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(FileUtilTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java deleted file mode 100644 index dc8c6c80..00000000 --- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java +++ /dev/null @@ -1,309 +0,0 @@ -package com.gluster.storage.management.core.utils; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - - -/** - * The class <code>StringUtilTest</code> contains tests for the class <code>{@link StringUtil}</code>. - * - * @generatedBy CodePro at 21/9/11 4:53 PM - * @author root - * @version $Revision: 1.0 $ - */ -public class StringUtilTest { - public enum Season { WINTER, SPRING, SUMMER, FALL }; - /** - * Run the String collectionToString(Collection<? extends Object>,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testCollectionToString_1() - throws Exception { - List<String> string = new ArrayList<String>(); - string.add("test string"); - String delimiter = ""; - - String result = StringUtil.collectionToString(string, delimiter); - assertEquals("test string", result); - } - - /** - * Run the String collectionToString(Collection<? extends Object>,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testCollectionToString_2() - throws Exception { - List<String> string = new ArrayList<String>(); - string.add("test string"); - string.add("welcome to world"); - String delimiter = "::"; - - String result = StringUtil.collectionToString(string, delimiter); - - assertEquals("test string::welcome to world", result); - } - - /** - * Run the String collectionToString(Collection<? extends Object>,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testCollectionToString_3() - throws Exception { - List<String> string = new ArrayList<String>(); - string.add("test ## string"); - string.add("java world"); - String delimiter = "##"; - - String result = StringUtil.collectionToString(string, delimiter); - assertEquals("test ## string##java world", result); - } - - /** - * Run the String collectionToString(Collection<? extends Object>,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testCollectionToString_4() - throws Exception { - List<String> string = new ArrayList<String>(); - String delimiter = ""; - - String result = StringUtil.collectionToString(string, delimiter); - assertEquals("", result); - } - - /** - * Run the List<String> enumToArray(T[]) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testEnumToArray_1() - throws Exception { - - String[] expected = new String[] {"WINTER", "SPRING", "SUMMER", "FALL"}; - List<String> result = StringUtil.enumToArray(Season.values()); - - assertNotNull(result); - assertEquals(4, result.size()); - } - - /** - * Run the List<String> extractList(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testExtractList_1() - throws Exception { - String input = "This is test message"; - String delim = " "; - - List<String> result = StringUtil.extractList(input, delim); - - assertNotNull(result); - assertEquals(4, result.size()); - } - - /** - * Run the List<String> extractList(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testExtractList_2() - throws Exception { - String input = "welcome#to#java#world"; - String delim = "#"; - - List<String> result = StringUtil.extractList(input, delim); - - assertNotNull(result); - assertEquals(4, result.size()); - } - - /** - * Run the List<String> extractList(String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testExtractList_3() - throws Exception { - String input = "list$to%string"; - String delim = "%"; - - List<String> result = StringUtil.extractList(input, delim); - - assertNotNull(result); - assertEquals(2, result.size()); - } - - /** - * Run the Map<String, String> extractMap(String,String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testExtractMap_1() - throws Exception { - String input = "k1=v1,k2=v2,k3=v3"; - String majorDelim = ","; - String minorDelim = "="; - - Map<String, String> result = StringUtil.extractMap(input, majorDelim, minorDelim); - - // add additional test code here - assertNotNull(result); - assertEquals(3, result.size()); - } - - /** - * Run the Map<String, String> extractMap(String,String,String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testExtractMap_2() - throws Exception { - String input = "k1=>v1&k2=>v2&k3=>v3"; - String majorDelim = "&"; - String minorDelim = "=>"; - - Map<String, String> result = StringUtil.extractMap(input, majorDelim, minorDelim); - - // add additional test code here - assertNotNull(result); - assertEquals(3, result.size()); - } - - /** - * Run the boolean filterString(String,String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testFilterString_1() - throws Exception { - String sourceString = "This is java program"; - String filterString = "Java"; - boolean caseSensitive = true; - - boolean result = StringUtil.filterString(sourceString, filterString, caseSensitive); - - assertEquals(false, result); - } - - /** - * Run the boolean filterString(String,String,boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testFilterString_2() - throws Exception { - String sourceString = "This is java program"; - String filterString = "Java"; - boolean caseSensitive = false; - - boolean result = StringUtil.filterString(sourceString, filterString, caseSensitive); - - assertEquals(true, result); - } - - /** - * Run the String removeSpaces(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Test - public void testRemoveSpaces_1() - throws Exception { - String str = "this is test string"; - - String result = StringUtil.removeSpaces(str); - - // add additional test code here - assertEquals("thisisteststring", result); - } - - /** - * Perform pre-test initialization. - * - * @throws Exception - * if the initialization fails for some reason - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @Before - public void setUp() - throws Exception { - // add additional set up code here - } - - /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - @After - public void tearDown() - throws Exception { - // Add additional tear down code here - } - - /** - * Launch the test. - * - * @param args the command line arguments - * - * @generatedBy CodePro at 21/9/11 4:53 PM - */ - public static void main(String[] args) { - new org.junit.runner.JUnitCore().run(StringUtilTest.class); - } -}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.core/junit/core.junit.launch b/src/com.gluster.storage.management.core/junit/core.junit.launch deleted file mode 100644 index 0bf6dc30..00000000 --- a/src/com.gluster.storage.management.core/junit/core.junit.launch +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.jdt.junit.launchconfig"> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/com.gluster.storage.management.core"/> -</listAttribute> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> -<listEntry value="4"/> -</listAttribute> -<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.gluster.storage.management.core"/> -<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> -<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> -<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> -<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/> -<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.gluster.storage.management.core"/> -</launchConfiguration> diff --git a/src/com.gluster.storage.management.core/junit/test/test.txt b/src/com.gluster.storage.management.core/junit/test/test.txt deleted file mode 100644 index 267ce144..00000000 --- a/src/com.gluster.storage.management.core/junit/test/test.txt +++ /dev/null @@ -1 +0,0 @@ -Test Resource
\ No newline at end of file |
