You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2013/07/17 19:35:24 UTC

[25/50] [abbrv] be able to upload template into swift

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/async/CleanupDelegate.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/async/CleanupDelegate.java b/server/test/com/cloud/async/CleanupDelegate.java
deleted file mode 100644
index 385e4cb..0000000
--- a/server/test/com/cloud/async/CleanupDelegate.java
+++ /dev/null
@@ -1,29 +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.
-package com.cloud.async;
-
-import org.apache.log4j.Logger;
-
-public class CleanupDelegate implements com.cloud.utils.CleanupDelegate<String, Object> {
-    private static final Logger s_logger = Logger.getLogger(CleanupDelegate.class);
-
-	@Override
-	public boolean cleanup(String param, Object managerContext) {
-		s_logger.info("Action called with param: " + param);
-		return true;
-	}
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/async/TestAsync.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/async/TestAsync.java b/server/test/com/cloud/async/TestAsync.java
deleted file mode 100644
index 6f67fe2..0000000
--- a/server/test/com/cloud/async/TestAsync.java
+++ /dev/null
@@ -1,281 +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.
-package com.cloud.async;
-
-
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.cluster.CheckPointVO;
-import com.cloud.cluster.dao.StackMaidDao;
-import com.cloud.cluster.dao.StackMaidDaoImpl;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.testcase.Log4jEnabledTestCase;
-
-
-public class TestAsync extends Log4jEnabledTestCase {
-    private static final Logger s_logger = Logger.getLogger(TestAsync.class);
-
-    /*
-	public static class SampleAsyncResult {
-		@Param(name="name", propName="name")
-		private final String _name;
-
-		@Param
-		private final int count;
-
-		public SampleAsyncResult(String name, int count) {
-			_name = name;
-			this.count = count;
-		}
-
-		public String getName() { return _name; }
-		public int getCount() { return count; }
-	}
-
-	public void testDao() {
-		AsyncJobDao dao = new AsyncJobDaoImpl();
-		AsyncJobVO job = new AsyncJobVO(1, 1, "TestCmd", null);
-		job.setInstanceType("user_vm");
-		job.setInstanceId(1000L);
-
-		char[] buf = new char[1024];
-		for(int i = 0; i < 1024; i++)
-			buf[i] = 'a';
-
-		job.setResult(new String(buf));
-		dao.persist(job);
-
-		AsyncJobVO jobVerify = dao.findById(job.getId());
-
-		Assert.assertTrue(jobVerify.getCmd().equals(job.getCmd()));
-		Assert.assertTrue(jobVerify.getUserId() == 1);
-		Assert.assertTrue(jobVerify.getAccountId() == 1);
-
-		String result = jobVerify.getResult();
-		for(int i = 0; i < 1024; i++)
-			Assert.assertTrue(result.charAt(i) == 'a');
-
-		jobVerify = dao.findInstancePendingAsyncJob("user_vm", 1000L);
-		Assert.assertTrue(jobVerify != null);
-		Assert.assertTrue(jobVerify.getCmd().equals(job.getCmd()));
-		Assert.assertTrue(jobVerify.getUserId() == 1);
-		Assert.assertTrue(jobVerify.getAccountId() == 1);
-	}
-
-	public void testSerialization() {
-		List<Pair<String, Object>> l;
-		int value = 1;
-		l = SerializerHelper.toPairList(value, "result");
-		Assert.assertTrue(l.size() == 1);
-		Assert.assertTrue(l.get(0).first().equals("result"));
-		Assert.assertTrue(l.get(0).second().equals("1"));
-		l.clear();
-
-		SampleAsyncResult result = new SampleAsyncResult("vmops", 1);
-		l = SerializerHelper.toPairList(result, "result");
-
-		Assert.assertTrue(l.size() == 2);
-		Assert.assertTrue(l.get(0).first().equals("name"));
-		Assert.assertTrue(l.get(0).second().equals("vmops"));
-		Assert.assertTrue(l.get(1).first().equals("count"));
-		Assert.assertTrue(l.get(1).second().equals("1"));
-	}
-
-	public void testAsyncResult() {
-		AsyncJobResult result = new AsyncJobResult(1);
-
-		result.setResultObject(100);
-		Assert.assertTrue(result.getResult().equals("java.lang.Integer/100"));
-
-		Object obj = result.getResultObject();
-		Assert.assertTrue(obj instanceof Integer);
-		Assert.assertTrue(((Integer)obj).intValue() == 100);
-	}
-
-	public void testTransaction() {
-		Transaction txn = Transaction.open("testTransaction");
-		try {
-			txn.start();
-
-			AsyncJobDao dao = new AsyncJobDaoImpl();
-			AsyncJobVO job = new AsyncJobVO(1, 1, "TestCmd", null);
-			job.setInstanceType("user_vm");
-			job.setInstanceId(1000L);
-			job.setResult("");
-			dao.persist(job);
-			txn.rollback();
-		} finally {
-			txn.close();
-		}
-	}
-
-	public void testMorevingian() {
-		int threadCount = 10;
-		final int testCount = 10;
-
-		Thread[] threads = new Thread[threadCount];
-		for(int i = 0; i < threadCount; i++) {
-			final int threadNum = i + 1;
-			threads[i] = new Thread(new Runnable() {
-				public void run() {
-					for(int i = 0; i < testCount; i++) {
-						Transaction txn = Transaction.open(Transaction.CLOUD_DB);
-						try {
-							AsyncJobDao dao = new AsyncJobDaoImpl();
-
-							s_logger.info("Thread " + threadNum + " acquiring lock");
-							AsyncJobVO job = dao.acquire(1L, 30);
-							if(job != null) {
-								s_logger.info("Thread " + threadNum + " acquired lock");
-
-								try {
-									Thread.sleep(Log4jEnabledTestCase.getRandomMilliseconds(1000, 3000));
-								} catch (InterruptedException e) {
-								}
-
-								s_logger.info("Thread " + threadNum + " acquiring lock nestly");
-								AsyncJobVO job2 = dao.acquire(1L, 30);
-								if(job2 != null) {
-									s_logger.info("Thread " + threadNum + " acquired lock nestly");
-
-									try {
-										Thread.sleep(Log4jEnabledTestCase.getRandomMilliseconds(1000, 3000));
-									} catch (InterruptedException e) {
-									}
-
-									s_logger.info("Thread " + threadNum + " releasing lock (nestly acquired)");
-									dao.release(1L);
-									s_logger.info("Thread " + threadNum + " released lock (nestly acquired)");
-
-								} else {
-									s_logger.info("Thread " + threadNum + " was unable to acquire lock nestly");
-								}
-
-								s_logger.info("Thread " + threadNum + " releasing lock");
-								dao.release(1L);
-								s_logger.info("Thread " + threadNum + " released lock");
-							} else {
-								s_logger.info("Thread " + threadNum + " was unable to acquire lock");
-							}
-						} finally {
-							txn.close();
-						}
-
-						try {
-							Thread.sleep(Log4jEnabledTestCase.getRandomMilliseconds(1000, 10000));
-						} catch (InterruptedException e) {
-						}
-					}
-				}
-			});
-		}
-
-		for(int i = 0; i < threadCount; i++) {
-			threads[i].start();
-		}
-
-		for(int i = 0; i < threadCount; i++) {
-			try {
-				threads[i].join();
-			} catch (InterruptedException e) {
-			}
-		}
-	}
-     */
-
-    public void testMaid() {
-        Transaction txn = Transaction.open(Transaction.CLOUD_DB);
-
-        StackMaidDao dao = new StackMaidDaoImpl();
-        dao.pushCleanupDelegate(1L, 0, "delegate1", "Hello, world");
-        dao.pushCleanupDelegate(1L, 1, "delegate2", new Long(100));
-        dao.pushCleanupDelegate(1L, 2, "delegate3", null);
-
-        CheckPointVO item = dao.popCleanupDelegate(1L);
-        Assert.assertTrue(item.getDelegate().equals("delegate3"));
-        Assert.assertTrue(item.getContext() == null);
-
-        item = dao.popCleanupDelegate(1L);
-        Assert.assertTrue(item.getDelegate().equals("delegate2"));
-        s_logger.info(item.getContext());
-
-        item = dao.popCleanupDelegate(1L);
-        Assert.assertTrue(item.getDelegate().equals("delegate1"));
-        s_logger.info(item.getContext());
-
-        txn.close();
-    }
-
-    public void testMaidClear() {
-        Transaction txn = Transaction.open(Transaction.CLOUD_DB);
-
-        StackMaidDao dao = new StackMaidDaoImpl();
-        dao.pushCleanupDelegate(1L, 0, "delegate1", "Hello, world");
-        dao.pushCleanupDelegate(1L, 1, "delegate2", new Long(100));
-        dao.pushCleanupDelegate(1L, 2, "delegate3", null);
-
-        dao.clearStack(1L);
-        Assert.assertTrue(dao.popCleanupDelegate(1L) == null);
-        txn.close();
-    }
-
-
-    public void testMaidLeftovers() {
-
-        Thread[] threads = new Thread[3];
-        for(int i = 0; i < 3; i++) {
-            final int threadNum = i+1;
-            threads[i] = new Thread(new Runnable() {
-                @Override
-                public void run() {
-                    Transaction txn = Transaction.open(Transaction.CLOUD_DB);
-
-                    StackMaidDao dao = new StackMaidDaoImpl();
-                    dao.pushCleanupDelegate(1L, 0, "delegate-" + threadNum, "Hello, world");
-                    dao.pushCleanupDelegate(1L, 1, "delegate-" + threadNum, new Long(100));
-                    dao.pushCleanupDelegate(1L, 2, "delegate-" + threadNum, null);
-
-                    txn.close();
-                }
-            });
-
-            threads[i].start();
-        }
-
-        for(int i = 0; i < 3; i++) {
-            try {
-                threads[i].join();
-            } catch (InterruptedException e) {
-            }
-        }
-
-
-        Transaction txn = Transaction.open(Transaction.CLOUD_DB);
-
-        StackMaidDao dao = new StackMaidDaoImpl();
-        List<CheckPointVO> l = dao.listLeftoversByMsid(1L);
-        for(CheckPointVO maid : l) {
-            s_logger.info("" + maid.getThreadId() + " " + maid.getDelegate() + " " + maid.getContext());
-        }
-
-        txn.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/async/TestAsyncJobManager.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/async/TestAsyncJobManager.java b/server/test/com/cloud/async/TestAsyncJobManager.java
deleted file mode 100644
index e323393..0000000
--- a/server/test/com/cloud/async/TestAsyncJobManager.java
+++ /dev/null
@@ -1,252 +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.
-package com.cloud.async;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.domain.DomainVO;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.domain.dao.DomainDaoImpl;
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
-import com.cloud.host.dao.HostDaoImpl;
-import com.cloud.utils.db.Transaction;
-
-public class TestAsyncJobManager extends TestCase {
-    public static final Logger s_logger = Logger.getLogger(TestAsyncJobManager.class.getName());
-
-    volatile long s_count = 0;
-
-    @Inject AsyncJobManager asyncMgr;
-
-    public void asyncCall() {
-//		long jobId = mgr.rebootVirtualMachineAsync(1, 1);
-        long jobId = 0L;
-        s_logger.info("Async-call job id: " + jobId);
-
-        while(true) {
-            AsyncJobResult result;
-            try {
-                result = asyncMgr.queryAsyncJobResult(jobId);
-
-                if(result.getJobStatus() != AsyncJobResult.STATUS_IN_PROGRESS) {
-                    s_logger.info("Async-call completed, result: " + result.toString());
-                    break;
-                }
-                s_logger.info("Async-call is in progress, progress: " + result.toString());
-
-            } catch (PermissionDeniedException e1) {
-            }
-
-            try {
-                Thread.sleep(1000);
-            } catch (InterruptedException e) {
-            }
-        }
-    }
-
-    public void sequence() {
-        final HostDao hostDao = new HostDaoImpl();
-        long seq = hostDao.getNextSequence(1);
-        s_logger.info("******* seq : " + seq + " ********");
-
-        HashMap<Long, Long> hashMap = new HashMap<Long, Long>();
-        final Map<Long, Long> map = Collections.synchronizedMap(hashMap);
-
-        s_count = 0;
-        final long maxCount = 1000000;	// test one million times
-
-        Thread t1 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                while(s_count < maxCount) {
-                    s_count++;
-                    long seq = hostDao.getNextSequence(1);
-                    Assert.assertTrue(map.put(seq, seq) == null);
-                }
-            }
-        });
-
-        Thread t2 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                while(s_count < maxCount) {
-                    s_count++;
-                    long seq = hostDao.getNextSequence(1);
-                    Assert.assertTrue(map.put(seq, seq) == null);
-                }
-            }
-        });
-
-        t1.start();
-        t2.start();
-
-        try {
-            t1.join();
-            t2.join();
-        } catch (InterruptedException e) {
-        }
-    }
-
-    /*
-	public void ipAssignment() {
-		final IPAddressDao ipAddressDao = new IPAddressDaoImpl();
-
-		final ConcurrentHashMap<String, IPAddressVO> map = new ConcurrentHashMap<String, IPAddressVO>();
-		//final Map<String, String> map = Collections.synchronizedMap(hashMap);
-
-		s_count = 0;
-		final long maxCount = 1000000;	// test one million times
-
-		Thread t1 = new Thread(new Runnable() {
-			public void run() {
-				while(s_count < maxCount) {
-					s_count++;
-
-					Transaction txn = Transaction.open("Alex1");
-					try {
-						IPAddressVO addr = ipAddressDao.assignIpAddress(1, 0, 1, false);
-						IPAddressVO returnStr = map.put(addr.getAddress(), addr);
-						if(returnStr != null) {
-							System.out.println("addr : " + addr.getAddress());
-						}
-						Assert.assertTrue(returnStr == null);
-					} finally {
-						txn.close();
-					}
-				}
-			}
-		});
-
-		Thread t2 = new Thread(new Runnable() {
-			public void run() {
-				while(s_count < maxCount) {
-					s_count++;
-
-					Transaction txn = Transaction.open("Alex2");
-					try {
-						IPAddressVO addr = ipAddressDao.assignIpAddress(1, 0, 1, false);
-						Assert.assertTrue(map.put(addr.getAddress(), addr) == null);
-					} finally {
-						txn.close();
-					}
-				}
-			}
-		});
-
-		t1.start();
-		t2.start();
-
-		try {
-			t1.join();
-			t2.join();
-		} catch (InterruptedException e) {
-		}
-	}
-     */
-
-    private long getRandomLockId() {
-        return 1L;
-
-        /*
-         *  will use in the future test cases
-		int i = new Random().nextInt();
-		if(i % 2 == 0)
-			return 1L;
-		return 2L;
-         */
-    }
-
-    public void tstLocking() {
-
-        int testThreads = 20;
-        Thread[] threads = new Thread[testThreads];
-
-        for(int i = 0; i < testThreads; i++) {
-            final int current = i;
-            threads[i] = new Thread(new Runnable() {
-                @Override
-                public void run() {
-
-                    final HostDao hostDao = new HostDaoImpl();
-                    while(true) {
-                        Transaction txn = Transaction.currentTxn();
-                        try {
-                            HostVO host = hostDao.acquireInLockTable(getRandomLockId(), 10);
-                            if(host != null) {
-                                s_logger.info("Thread " + (current + 1) + " acquired lock");
-
-                                try { Thread.sleep(1000); } catch (InterruptedException e) {}
-
-                                s_logger.info("Thread " + (current + 1) + " released lock");
-                                hostDao.releaseFromLockTable(host.getId());
-
-                                try { Thread.sleep(1000); } catch (InterruptedException e) {}
-                            } else {
-                                s_logger.info("Thread " + (current + 1) + " is not able to acquire lock");
-                            }
-                        } finally {
-                            txn.close();
-                        }
-                    }
-                }
-            });
-            threads[i].start();
-        }
-
-        try {
-            for(int i = 0; i < testThreads; i++)
-                threads[i].join();
-        } catch(InterruptedException e) {
-        }
-    }
-
-    public void testDomain() {
-        DomainDao domainDao = new DomainDaoImpl();
-
-		DomainVO domain1 = new DomainVO("d1", 2L, 1L, null, 1);
-        domainDao.create(domain1);
-
-		DomainVO domain2 = new DomainVO("d2", 2L, 1L, null, 1);
-        domainDao.create(domain2);
-
-		DomainVO domain3 = new DomainVO("d3", 2L, 1L, null, 1);
-        domainDao.create(domain3);
-
-		DomainVO domain11 = new DomainVO("d11", 2L, domain1.getId(), null, 1);
-        domainDao.create(domain11);
-
-        domainDao.remove(domain11.getId());
-
-		DomainVO domain12 = new DomainVO("d12", 2L, domain1.getId(), null, 1);
-        domainDao.create(domain12);
-
-        domainDao.remove(domain3.getId());
-		DomainVO domain4 = new DomainVO("d4", 2L, 1L, null, 1);
-        domainDao.create(domain4);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/async/TestSyncQueueManager.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/async/TestSyncQueueManager.java b/server/test/com/cloud/async/TestSyncQueueManager.java
deleted file mode 100644
index 59afb11..0000000
--- a/server/test/com/cloud/async/TestSyncQueueManager.java
+++ /dev/null
@@ -1,208 +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.
-package com.cloud.async;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-
-
-public class TestSyncQueueManager extends TestCase {
-    public static final Logger s_logger = Logger.getLogger(TestSyncQueueManager.class.getName());
-
-    private volatile int count = 0;
-    private volatile long expectingCurrent = 1;
-    @Inject SyncQueueManager mgr;
-
-    public void leftOverItems() {
-
-        List<SyncQueueItemVO> l = mgr.getActiveQueueItems(1L, false);
-        if(l != null && l.size() > 0) {
-            for(SyncQueueItemVO item : l) {
-                s_logger.info("Left over item: " + item.toString());
-                mgr.purgeItem(item.getId());
-            }
-        }
-    }
-
-    public void dequeueFromOneQueue() {
-        final int totalRuns = 5000;
-        final SyncQueueVO queue = mgr.queue("vm_instance", 1L, "Async-job", 1, 1);
-        for(int i = 1; i < totalRuns; i++)
-            mgr.queue("vm_instance", 1L, "Async-job", i+1, 1);
-
-        count = 0;
-        expectingCurrent = 1;
-        Thread thread1 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                while(count < totalRuns) {
-                    SyncQueueItemVO item = mgr.dequeueFromOne(queue.getId(), 1L);
-                    if(item != null) {
-                        s_logger.info("Thread 1 process item: " + item.toString());
-
-                        Assert.assertEquals(expectingCurrent, item.getContentId().longValue());
-                        expectingCurrent++;
-                        count++;
-
-                        mgr.purgeItem(item.getId());
-                    }
-                    try {
-                        Thread.sleep(100);
-                    } catch (InterruptedException e) {
-                    }
-                }
-            }
-        }
-                );
-
-        Thread thread2 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                while(count < totalRuns) {
-                    SyncQueueItemVO item = mgr.dequeueFromOne(queue.getId(), 1L);
-                    if(item != null) {
-                        s_logger.info("Thread 2 process item: " + item.toString());
-
-                        Assert.assertEquals(expectingCurrent, item.getContentId().longValue());
-                        expectingCurrent++;
-                        count++;
-                        mgr.purgeItem(item.getId());
-                    }
-
-                    try {
-                        Thread.sleep(100);
-                    } catch (InterruptedException e) {
-                    }
-                }
-            }
-        }
-                );
-
-        thread1.start();
-        thread2.start();
-        try {
-            thread1.join();
-        } catch (InterruptedException e) {
-        }
-        try {
-            thread2.join();
-        } catch (InterruptedException e) {
-        }
-
-        Assert.assertEquals(totalRuns, count);
-    }
-
-    public void dequeueFromAnyQueue() {
-        // simulate 30 queues
-        final int queues = 30;
-        final int totalRuns = 100;
-        final int itemsPerRun = 20;
-        for(int q = 1; q <= queues; q++)
-            for(int i = 0; i < totalRuns; i++)
-                mgr.queue("vm_instance", q, "Async-job", i+1, 1);
-
-        count = 0;
-        Thread thread1 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                while(count < totalRuns*queues) {
-                    List<SyncQueueItemVO> l = mgr.dequeueFromAny(1L, itemsPerRun);
-                    if(l != null && l.size() > 0) {
-                        s_logger.info("Thread 1 get " + l.size() + " dequeued items");
-
-                        for(SyncQueueItemVO item : l) {
-                            s_logger.info("Thread 1 process item: " + item.toString());
-                            count++;
-
-                            mgr.purgeItem(item.getId());
-                        }
-                    }
-                    try {
-                        Thread.sleep(100);
-                    } catch (InterruptedException e) {
-                    }
-                }
-            }
-        }
-                );
-
-        Thread thread2 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                while(count < totalRuns*queues) {
-                    List<SyncQueueItemVO> l = mgr.dequeueFromAny(1L, itemsPerRun);
-                    if(l != null && l.size() > 0) {
-                        s_logger.info("Thread 2 get " + l.size() + " dequeued items");
-
-                        for(SyncQueueItemVO item : l) {
-                            s_logger.info("Thread 2 process item: " + item.toString());
-                            count++;
-                            mgr.purgeItem(item.getId());
-                        }
-                    }
-
-                    try {
-                        Thread.sleep(100);
-                    } catch (InterruptedException e) {
-                    }
-                }
-            }
-        }
-                );
-
-        thread1.start();
-        thread2.start();
-        try {
-            thread1.join();
-        } catch (InterruptedException e) {
-        }
-        try {
-            thread2.join();
-        } catch (InterruptedException e) {
-        }
-        Assert.assertEquals(queues*totalRuns, count);
-    }
-
-    public void testPopulateQueueData() {
-        final int queues = 30000;
-        final int totalRuns = 100;
-
-        for(int q = 1; q <= queues; q++)
-            for(int i = 0; i < totalRuns; i++)
-                mgr.queue("vm_instance", q, "Async-job", i+1, 1);
-    }
-
-    public void testSyncQueue() {
-
-        mgr.queue("vm_instance", 1, "Async-job", 1, 1);
-        mgr.queue("vm_instance", 1, "Async-job", 2, 1);
-        mgr.queue("vm_instance", 1, "Async-job", 3, 1);
-        mgr.dequeueFromAny(100L, 1);
-
-        List<SyncQueueItemVO> l = mgr.getBlockedQueueItems(100000, false);
-        for(SyncQueueItemVO item : l) {
-            System.out.println("Blocked item. " + item.getContentType() + "-" + item.getContentId());
-            mgr.purgeItem(item.getId());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/AdvanceZone217To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/AdvanceZone217To224UpgradeTest.java b/server/test/com/cloud/upgrade/AdvanceZone217To224UpgradeTest.java
deleted file mode 100644
index 532a62f..0000000
--- a/server/test/com/cloud/upgrade/AdvanceZone217To224UpgradeTest.java
+++ /dev/null
@@ -1,117 +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.
-package com.cloud.upgrade;
-
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class AdvanceZone217To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(AdvanceZone217To224UpgradeTest.class);
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-    
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-    
-    public void test217to22Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.1.7");
-        DbTestUtils.executeScript("fake.sql", false, true);
-        
-        Connection conn;
-        PreparedStatement pstmt;
-        
-        String version = dao.getCurrentVersion();
-        assert version.equals("2.1.7") : "Version returned is not 2.1.7 but " + version;
-        
-        checker.upgrade("2.1.7", "2.2.4");
-        
-        conn = Transaction.getStandaloneConnection();
-        try {
-            pstmt = conn.prepareStatement("SELECT version FROM version ORDER BY id DESC LIMIT 1");
-            ResultSet rs = pstmt.executeQuery();
-            assert rs.next() : "No version selected";
-            assert rs.getString(1).equals("2.2.4") : "VERSION stored is not 2.2.4: " + rs.getString(1);
-            rs.close();
-            pstmt.close();
-            
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM network_offerings");
-            rs = pstmt.executeQuery();
-            assert rs.next() : "Unable to get the count of network offerings.";
-            assert (rs.getInt(1) == 7) : "Didn't find 7 network offerings but found " + rs.getInt(1);
-            rs.close();
-            pstmt.close();
-            
-            pstmt = conn.prepareStatement("SELECT DISTINCT networktype FROM data_center");
-            rs = pstmt.executeQuery();
-            assert rs.next()  && rs.getString(1).equals("Advanced") : "Network type is not advanced? " + rs.getString(1);
-            assert !rs.next() : "Why do we have another one? " + rs.getString(1);
-            rs.close();
-            pstmt.close();
-            
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM disk_offering WHERE removed IS NULL AND system_use=1 AND type='Service' AND recreatable=1");
-            rs = pstmt.executeQuery();
-            assert (rs.next() && rs.getInt(1) == 3) : "DiskOffering for system VMs are incorrect.  Expecting 3 but got " + rs.getInt(1);
-            rs.close();
-            pstmt.close();
-            
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM op_dc_link_local_ip_address_alloc WHERE nic_id IS NOT NULL");
-            rs = pstmt.executeQuery();
-            rs.next();
-            int controlNics = rs.getInt(1);
-            rs.close();
-            pstmt.close();
-            
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM nics WHERE reserver_name='ControlNetworkGuru' and ip4_address is NOT NULL");
-            rs = pstmt.executeQuery();
-            assert (rs.next() && controlNics == rs.getInt(1)) : "Allocated nics should have been " + controlNics + " but it is " + rs.getInt(1);
-            rs.close();
-            pstmt.close();
-            
-            
-        } finally {
-            try {
-                conn.close();
-            } catch (SQLException e) {
-            }
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/AdvanceZone223To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/AdvanceZone223To224UpgradeTest.java b/server/test/com/cloud/upgrade/AdvanceZone223To224UpgradeTest.java
deleted file mode 100644
index 519ae70..0000000
--- a/server/test/com/cloud/upgrade/AdvanceZone223To224UpgradeTest.java
+++ /dev/null
@@ -1,57 +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.
-package com.cloud.upgrade;
-
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-
-public class AdvanceZone223To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(AdvanceZone223To224UpgradeTest.class);
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-//        DbTestUtils.executeScript("PreviousDatabaseSchema/clean-db.sql", false, true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test223to224Upgrade() throws SQLException {
-
-
-        String version = dao.getCurrentVersion();
-        assert version.equals("2.2.3") : "Version returned is not 2.2.3 but " + version;
-
-        checker.upgrade("2.2.3", "2.2.4");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/BasicZone218To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/BasicZone218To224UpgradeTest.java b/server/test/com/cloud/upgrade/BasicZone218To224UpgradeTest.java
deleted file mode 100644
index 8bd9f06..0000000
--- a/server/test/com/cloud/upgrade/BasicZone218To224UpgradeTest.java
+++ /dev/null
@@ -1,211 +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.
-package com.cloud.upgrade;
-
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class BasicZone218To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(BasicZone218To224UpgradeTest.class);
-    
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-    
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-    
-    public void test217to22Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.1.8");
-        DbTestUtils.executeScript("fake.sql", false, true);
-        
-        Connection conn = Transaction.getStandaloneConnection();
-        PreparedStatement pstmt;
-        
-        String version = dao.getCurrentVersion();
-        
-        if (!version.equals("2.1.8")) {
-            s_logger.error("Version returned is not 2.1.8 but " + version);
-        } else {
-            s_logger.debug("Basic zone test version is " + version);
-        }
-        
-        checker.upgrade("2.1.8", "2.2.4");
-        
-        conn = Transaction.getStandaloneConnection();
-        try {
-            
-            s_logger.debug("Starting tesing upgrade from 2.1.8 to 2.2.4 for Basic zone...");
-            
-            //Version check
-            pstmt = conn.prepareStatement(" SELECT version FROM version ORDER BY id DESC LIMIT 1");
-            ResultSet rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.4")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.4: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-            
-            //Check that default network offerings are present
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM network_offerings");
-            rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("ERROR: Unable to get the count of network offerings.");
-            } else if (rs.getInt(1) != 7) {
-                s_logger.error("ERROR: Didn't find 7 network offerings but found " + rs.getInt(1));
-            } else {
-                s_logger.debug("Network offerings test passed");
-            }
-
-            rs.close();
-            pstmt.close();
-            
-            
-            //Zone network type check
-            pstmt = conn.prepareStatement("SELECT DISTINCT networktype FROM data_center");
-            rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("No zone exists after upgrade");
-            } else if (!rs.getString(1).equals("Basic")) {
-                s_logger.error("ERROR: Zone type is not Basic");
-            } else if (rs.next()) {
-                s_logger.error("ERROR: Why do we have more than 1 zone with different types??");
-                System.exit(2);
-            } else {
-                s_logger.debug("Test passed. Zone was updated properly with type Basic");
-            }
-            rs.close();
-            pstmt.close();
-            
-            //Check that vnet/cidr were set to NULL for basic zone
-            pstmt = conn.prepareStatement("SELECT vnet, guest_network_cidr FROM data_center");
-            rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("ERROR: vnet field is missing for the zone");
-            } else if (rs.getString(1) != null || rs.getString(2) != null) {
-                s_logger.error("ERROR: vnet/guestCidr should be NULL for basic zone; instead it's " + rs.getString(1));
-            } else {
-                s_logger.debug("Test passed. Vnet and cidr are set to NULL for the basic zone");
-            }
-            
-            rs.close();
-            pstmt.close();
-            
-            //Verify that default Direct guest network got created, and it's Shared and Default
-            pstmt = conn.prepareStatement("SELECT traffic_type, guest_type, shared, is_default, id FROM networks WHERE name LIKE '%BasicZoneDirectNetwork%'");
-            rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("Direct network is missing for the Basic zone");
-            } else if (!rs.getString(1).equalsIgnoreCase("Guest") || !rs.getString(2).equalsIgnoreCase("Direct") || !rs.getBoolean(3) || !rs.getBoolean(4)) {
-                s_logger.error("Direct network for basic zone has incorrect setting");
-            } else {
-                s_logger.debug("Test passed. Default Direct Basic zone network parameters were set correctly");
-            }
-            
-            long defaultDirectNetworkId = rs.getInt(5);
-            rs.close();
-            pstmt.close();
-            
-            //Verify that all vlans in the zone belong to default Direct network
-            pstmt = conn.prepareStatement("SELECT network_id FROM vlan");
-            rs = pstmt.executeQuery();
-            
-            while (rs.next()) {
-                if (rs.getInt(1) != defaultDirectNetworkId) {
-                    s_logger.error("ERROR: network_id is set incorrectly for public untagged vlans in Basic zone");
-                    System.exit(2);
-                }
-            }
-            
-            s_logger.debug("Test passed for vlan table in Basic zone");
-            
-            rs.close();
-            pstmt.close();
-            
-            //Verify user_ip_address table
-            pstmt = conn.prepareStatement("SELECT source_network_id FROM user_ip_address");
-            rs = pstmt.executeQuery();
-            
-            while (rs.next()) {
-                if (rs.getInt(1) != defaultDirectNetworkId) {
-                    s_logger.error("ERROR: network_id is set incorrectly for public Ip addresses (user_ip_address table) in Basic zone");
-                    System.exit(2);
-                }
-            }
-            
-            s_logger.debug("Test passed for user_ip_address table in Basic zone");
-            
-            rs.close();
-            pstmt.close();
-            
-            //Verify domain_router table
-            pstmt = conn.prepareStatement("SELECT network_id FROM domain_router");
-            rs = pstmt.executeQuery();
-            
-            while (rs.next()) {
-                if (rs.getInt(1) != defaultDirectNetworkId) {
-                    s_logger.error("ERROR: network_id is set incorrectly for domain routers (domain_router table) in Basic zone");
-                    System.exit(2);
-                }
-            }
-            
-            s_logger.debug("Test passed for domain_router table in Basic zone");
-            
-            rs.close();
-            pstmt.close();
-            
-            s_logger.debug("Basic zone test is finished");
-            
-        } finally {
-            try {
-                conn.close();
-            } catch (SQLException e) {
-            }
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/DbUpgrade22Test.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/DbUpgrade22Test.java b/server/test/com/cloud/upgrade/DbUpgrade22Test.java
deleted file mode 100644
index e0db82d..0000000
--- a/server/test/com/cloud/upgrade/DbUpgrade22Test.java
+++ /dev/null
@@ -1,29 +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.
-package com.cloud.upgrade;
-
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({ AdvanceZone217To224UpgradeTest.class, AdvanceZone223To224UpgradeTest.class, PortForwarding218To224UpgradeTest.class, InstanceGroup218To224UpgradeTest.class,
-        BasicZone218To224UpgradeTest.class, UsageEvents218To224UpgradeTest.class })
-@Ignore("maven-sure-fire discovered")
-public class DbUpgrade22Test {
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/HostCapacity218to22Test.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/HostCapacity218to22Test.java b/server/test/com/cloud/upgrade/HostCapacity218to22Test.java
deleted file mode 100644
index 76ad12e..0000000
--- a/server/test/com/cloud/upgrade/HostCapacity218to22Test.java
+++ /dev/null
@@ -1,66 +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.
-package com.cloud.upgrade;
-
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-
-public class HostCapacity218to22Test extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(HostCapacity218to22Test.class);
-
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-	
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-    
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test218to22Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.1.8");
-        DbTestUtils.executeScript("fake.sql", false, true);
-        
-        String version = dao.getCurrentVersion();
-        
-        if (!version.equals("2.1.8")) {
-            s_logger.error("Version returned is not 2.1.8 but " + version);
-        } else {
-            s_logger.debug("Instance group test version is " + version);
-        }
-        
-        checker.upgrade("2.1.8", "2.2.4");
-        
-        // manually check into database for now to verify
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/InstanceGroup218To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/InstanceGroup218To224UpgradeTest.java b/server/test/com/cloud/upgrade/InstanceGroup218To224UpgradeTest.java
deleted file mode 100644
index 41f334d..0000000
--- a/server/test/com/cloud/upgrade/InstanceGroup218To224UpgradeTest.java
+++ /dev/null
@@ -1,216 +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.
-package com.cloud.upgrade;
-
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class InstanceGroup218To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(InstanceGroup218To224UpgradeTest.class);
-
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-    
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-    
-    public void test217to22Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.1.8");
-        DbTestUtils.executeScript("fake.sql", false, true);
-        
-        PreparedStatement pstmt;
-        ResultSet rs;
-        
-        String version = dao.getCurrentVersion();
-        
-        if (!version.equals("2.1.8")) {
-            s_logger.error("Version returned is not 2.1.8 but " + version);
-        } else {
-            s_logger.debug("Instance group test version is " + version);
-        }
-        
-        Long groupNumberVmInstance = 0L;
-        ArrayList<Object[]> groups = new ArrayList<Object[]>();
-        Connection conn = Transaction.getStandaloneConnection();
-        ArrayList<Object[]> groupVmMaps = new ArrayList<Object[]>();
-        
-        try {
-            //Check that correct number of instance groups were created
-            pstmt = conn.prepareStatement("SELECT DISTINCT v.group, u.account_id from vm_instance v, user_vm u where v.group is not null and v.id=u.id");
-            s_logger.debug("Query is" + pstmt);
-            rs = pstmt.executeQuery();
-            
-            while (rs.next()) {
-                groupNumberVmInstance++;
-            }
-
-            rs.close();
-            pstmt.close();
-            //For each instance group from vm_instance table check that 1) entry was created in the instance_group table 2) vm to group map exists in instance_group_vm_map table
-            //Check 1)
-            pstmt = conn.prepareStatement("SELECT DISTINCT v.group, u.account_id from vm_instance v, user_vm u where v.group is not null and v.id=u.id");
-            s_logger.debug("Query is" + pstmt);
-            rs = pstmt.executeQuery();
-            while (rs.next()) {
-                Object[] group = new Object[10];
-                group[0] = rs.getString(1); // group name
-                group[1] = rs.getLong(2);  // accountId
-                groups.add(group);
-            }
-            rs.close();
-            pstmt.close();
-            
-           
-        } finally {
-            conn.close();
-        }
-        
-        checker.upgrade("2.1.8", "2.2.4");
-        
-        conn = Transaction.getStandaloneConnection();
-        try {
-            
-            s_logger.debug("Starting tesing upgrade from 2.1.8 to 2.2.4 for Instance groups...");
-            
-            //Version check
-            pstmt = conn.prepareStatement("SELECT version FROM version");
-            rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.4")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.4: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-            
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM instance_group");
-            rs = pstmt.executeQuery();
-            
-            Long groupNumber = 0L;
-            if (rs.next()) {
-                groupNumber = rs.getLong(1);
-            }
-
-            rs.close();
-            pstmt.close();
-            
-            if (groupNumber != groupNumberVmInstance) {
-                s_logger.error("ERROR: instance groups were updated incorrectly. Have " + groupNumberVmInstance + " groups in vm_instance table, and " + groupNumber + " where created in instance_group table. Stopping the test");
-                System.exit(2);
-            }
-            
-            for (Object[] group : groups) {
-                String groupName = (String)group[0];
-                Long accountId = (Long)group[1];
-                if (!checkInstanceGroup(conn, groupName, accountId)) {
-                    s_logger.error("ERROR: Unable to find group with name " + groupName + " for account id=" + accountId + ", stopping the test");
-                    System.exit(2);
-                }
-            } 
-            
-            rs.close();
-            pstmt.close();
-            
-            //Check 2)
-//            pstmt = conn.prepareStatement("SELECT v.id from vm_instance v, instance_group g WHERE g.account_id=v.account_id and v.group=?");
-//            s_logger.debug("Query is" + pstmt);
-//            rs = pstmt.executeQuery();
-//            
-//            while (rs.next()) {
-//                Object[] groupMaps = new Object[10];
-//                groupMaps[0] = rs.getLong(1); // vmId
-//                groupMaps[1] = rs.getLong(2);  // groupId
-//                groupVmMaps.add(groupMaps);
-//            }
-//            rs.close();
-//            pstmt.close();
-//            
-//            for (Object[] groupMap : groupVmMaps) {
-//                Long groupId = (Long)groupMap[0];
-//                Long instanceId = (Long)groupMap[1];
-//                if (!checkInstanceGroupVmMap(conn, groupId, instanceId)) {
-//                    s_logger.error("ERROR: unable to find instanceGroupVMMap for vm id=" + instanceId + " and group id=" + groupId + ", stopping the test");
-//                    System.exit(2);
-//                }
-//            }  
-//            
-//            rs.close();
-//            pstmt.close();
-            
-            s_logger.debug("Instance group upgrade test is passed");
-            
-        } finally {
-            conn.close();
-        }
-    }
-    
-    protected boolean checkInstanceGroup(Connection conn, String groupName, long accountId) throws SQLException{
-        
-        PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM  instance_group WHERE name = ? and account_id = ?");
-        pstmt.setString(1, groupName);
-        pstmt.setLong(2, accountId);
-        ResultSet rs = pstmt.executeQuery();
-        
-        if (!rs.next()) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-    
-    protected boolean checkInstanceGroupVmMap(Connection conn, long groupId, long vmId) throws SQLException{
-        
-        PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM  instance_group_vm_map WHERE group_id = ? and instance_id = ?");
-        pstmt.setLong(1, groupId);
-        pstmt.setLong(2, vmId);
-        ResultSet rs = pstmt.executeQuery();
-        
-        if (!rs.next()) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-    
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/PortForwarding218To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/PortForwarding218To224UpgradeTest.java b/server/test/com/cloud/upgrade/PortForwarding218To224UpgradeTest.java
deleted file mode 100644
index a9cb51f..0000000
--- a/server/test/com/cloud/upgrade/PortForwarding218To224UpgradeTest.java
+++ /dev/null
@@ -1,132 +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.
-package com.cloud.upgrade;
-
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class PortForwarding218To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(PortForwarding218To224UpgradeTest.class);
-    
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-    
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-    
-    public void test217to22Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.1.8");
-        DbTestUtils.executeScript("fake.sql", false, true);
-        
-        Connection conn;
-        PreparedStatement pstmt;
-        ResultSet rs;
-        
-        String version = dao.getCurrentVersion();
-        
-        if (!version.equals("2.1.8")) {
-            s_logger.error("Version returned is not 2.1.8 but " + version);
-        } else {
-            s_logger.debug("Port forwarding test version is " + version);
-        }
-       
-        
-        Long count21 = 0L;
-        conn = Transaction.getStandaloneConnection();
-        try {
-            //Check that correct number of port forwarding rules were created
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM ip_forwarding WHERE forwarding=1");
-            rs = pstmt.executeQuery();
-            
-            while (rs.next()) {
-                count21 = rs.getLong(1);
-            }
-    
-            rs.close();
-            pstmt.close();
-        } finally {
-            conn.close();
-        }
-        
-        checker.upgrade("2.1.8", "2.2.4");
-        
-        conn = Transaction.getStandaloneConnection();
-        try {
-            s_logger.debug("Starting tesing upgrade from 2.1.8 to 2.2.4 for Port forwarding rules...");
-            
-            //Version check
-            pstmt = conn.prepareStatement("SELECT version FROM version");
-            rs = pstmt.executeQuery();
-            
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.4")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.4: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-            
-            
-            Long count22 = 0L;
-            pstmt = conn.prepareStatement("SELECT COUNT(*) FROM port_forwarding_rules");
-            rs = pstmt.executeQuery();
-            
-            if (rs.next()) {
-                count22 = rs.getLong(1);
-            }
-
-            rs.close();
-            pstmt.close();
-            
-            if (count21.longValue() != count22.longValue()) {
-                s_logger.error("ERROR: port forwarding rules were updated incorrectly. Have " + count21 + " rulrs in ip_forwarding table branch 21, and " + count22 + " in port_forwarding_rules table branch 22. Stopping the test");
-                System.exit(2);
-            }
-            
-            s_logger.debug("Port forwarding rules test is passed");
-            
-        } finally {
-            conn.close();
-        }
-    }
-    
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/Sanity220To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/Sanity220To224UpgradeTest.java b/server/test/com/cloud/upgrade/Sanity220To224UpgradeTest.java
deleted file mode 100644
index d33192f..0000000
--- a/server/test/com/cloud/upgrade/Sanity220To224UpgradeTest.java
+++ /dev/null
@@ -1,95 +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.
-package com.cloud.upgrade;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class Sanity220To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(Sanity220To224UpgradeTest.class);
-
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test217to22Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.2.1");
-        DbTestUtils.executeScript("fake.sql", false, true);
-
-        Connection conn;
-        PreparedStatement pstmt;
-        ResultSet rs;
-
-        String version = dao.getCurrentVersion();
-
-        if (!version.equals("2.2.1")) {
-            s_logger.error("Version returned is not 2.2.1 but " + version);
-        } else {
-            s_logger.debug("Sanity 2.2.1 to 2.2.4 test version is " + version);
-        }
-
-        checker.upgrade("2.2.1", "2.2.4");
-
-        conn = Transaction.getStandaloneConnection();
-        try {
-            s_logger.debug("Starting tesing upgrade from 2.2.1 to 2.2.4...");
-
-            // Version check
-            pstmt = conn.prepareStatement("SELECT version FROM version");
-            rs = pstmt.executeQuery();
-
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.4")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.4: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-
-            s_logger.debug("Sanity 2.2.1 to 2.2.4 DB upgrade test passed");
-
-        } finally {
-            conn.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/Sanity222To224UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/Sanity222To224UpgradeTest.java b/server/test/com/cloud/upgrade/Sanity222To224UpgradeTest.java
deleted file mode 100644
index 108eca9..0000000
--- a/server/test/com/cloud/upgrade/Sanity222To224UpgradeTest.java
+++ /dev/null
@@ -1,96 +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.
-package com.cloud.upgrade;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class Sanity222To224UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(Sanity222To224UpgradeTest.class);
-
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test222to224Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.2.2");
-        DbTestUtils.executeScript("fake.sql", false, true);
-
-        Connection conn;
-        PreparedStatement pstmt;
-        ResultSet rs;
-
-
-        String version = dao.getCurrentVersion();
-
-        if (!version.equals("2.2.2")) {
-            s_logger.error("Version returned is not 2.2.2 but " + version);
-        } else {
-            s_logger.debug("Sanity 2.2.2 to 2.2.4 test version is " + version);
-        }
-
-        checker.upgrade("2.2.2", "2.2.4");
-
-        conn = Transaction.getStandaloneConnection();
-        try {
-            s_logger.debug("Starting tesing upgrade from 2.2.2 to 2.2.4...");
-
-            // Version check
-            pstmt = conn.prepareStatement("SELECT version FROM version");
-            rs = pstmt.executeQuery();
-
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.4")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.4: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-
-            s_logger.debug("Sanity 2.2.2 to 2.2.4 DB upgrade test passed");
-
-        } finally {
-            conn.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/Sanity223To225UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/Sanity223To225UpgradeTest.java b/server/test/com/cloud/upgrade/Sanity223To225UpgradeTest.java
deleted file mode 100644
index fd0b219..0000000
--- a/server/test/com/cloud/upgrade/Sanity223To225UpgradeTest.java
+++ /dev/null
@@ -1,94 +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.
-package com.cloud.upgrade;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.Transaction;
-
-public class Sanity223To225UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(Sanity223To225UpgradeTest.class);
-
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        //DbTestUtils.executeScript("PreviousDatabaseSchema/clean-db.sql", false, true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test224to225Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.2.3");
-        //DbTestUtils.executeScript("/home/alena/Downloads/mac/160511preprod.bak", false, true);
-
-        Connection conn;
-        PreparedStatement pstmt;
-        ResultSet rs;
-
-        String version = dao.getCurrentVersion();
-
-        if (!version.equals("2.2.3")) {
-            s_logger.error("Version returned is not 2.2.3 but " + version);
-        } else {
-            s_logger.debug("Sanity 2.2.3 to 2.2.5 test version is " + version);
-        }
-
-        checker.upgrade("2.2.3", "2.2.5");
-
-        conn = Transaction.getStandaloneConnection();
-        try {
-            s_logger.debug("Starting tesing upgrade from 2.2.3 to 2.2.5...");
-
-            // Version check
-            pstmt = conn.prepareStatement("SELECT version FROM version");
-            rs = pstmt.executeQuery();
-
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.5")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.5: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-
-            s_logger.debug("Sanity 2.2.3 to 2.2.5 DB upgrade test passed");
-
-        } finally {
-            conn.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/Sanity224To225UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/Sanity224To225UpgradeTest.java b/server/test/com/cloud/upgrade/Sanity224To225UpgradeTest.java
deleted file mode 100644
index 775a62e..0000000
--- a/server/test/com/cloud/upgrade/Sanity224To225UpgradeTest.java
+++ /dev/null
@@ -1,95 +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.
-package com.cloud.upgrade;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-import com.cloud.upgrade.dao.VersionDaoImpl;
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-
-public class Sanity224To225UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger.getLogger(Sanity224To225UpgradeTest.class);
-
-    @Inject VersionDaoImpl dao;
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false, true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test224to225Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.2.4");
-        DbTestUtils.executeScript("fake.sql", false, true);
-
-        Connection conn;
-        PreparedStatement pstmt;
-        ResultSet rs;
-
-        String version = dao.getCurrentVersion();
-
-        if (!version.equals("2.2.4")) {
-            s_logger.error("Version returned is not 2.2.4 but " + version);
-        } else {
-            s_logger.debug("Sanity 2.2.4 to 2.2.5 test version is " + version);
-        }
-
-        checker.upgrade("2.2.4", "2.2.5");
-
-        conn = Transaction.getStandaloneConnection();
-        try {
-            s_logger.debug("Starting tesing upgrade from 2.2.4 to 2.2.5...");
-
-            // Version check
-            pstmt = conn.prepareStatement("SELECT version FROM version");
-            rs = pstmt.executeQuery();
-
-            if (!rs.next()) {
-                s_logger.error("ERROR: No version selected");
-            } else if (!rs.getString(1).equals("2.2.5")) {
-                s_logger.error("ERROR: VERSION stored is not 2.2.5: " + rs.getString(1));
-            }
-            rs.close();
-            pstmt.close();
-
-            s_logger.debug("Sanity 2.2.4 to 2.2.5 DB upgrade test passed");
-
-        } finally {
-            conn.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/Template2214To30UpgradeTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/Template2214To30UpgradeTest.java b/server/test/com/cloud/upgrade/Template2214To30UpgradeTest.java
deleted file mode 100644
index 06835b5..0000000
--- a/server/test/com/cloud/upgrade/Template2214To30UpgradeTest.java
+++ /dev/null
@@ -1,123 +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.
-package com.cloud.upgrade;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class Template2214To30UpgradeTest extends TestCase {
-    private static final Logger s_logger = Logger
-            .getLogger(Template2214To30UpgradeTest.class);
-    @Inject DatabaseUpgradeChecker checker;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false,
-                true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test2214to30Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.2.14");
-        DbTestUtils.executeScript(
-                "fake.sql", false,
-                true);
-
-
-        checker.upgrade("2.2.14", "3.0.0");
-
-        Connection conn = Transaction.getStandaloneConnection();
-
-        try {
-            checkSystemVm(conn);
-        } finally {
-            try {
-                conn.close();
-            } catch (SQLException e) {
-            }
-        }
-    }
-
-    protected void checkSystemVm(Connection conn) throws SQLException {
-        PreparedStatement pstmt;
-
-        pstmt = conn
-                .prepareStatement("SELECT version FROM `cloud`.`version` ORDER BY id DESC LIMIT 1");
-        ResultSet rs = pstmt.executeQuery();
-        assert rs.next() : "No version selected";
-        assert rs.getString(1).equals("3.0.0") : "VERSION stored is not 3.0.0: "
-                + rs.getString(1);
-        rs.close();
-        pstmt.close();
-
-        pstmt = conn.prepareStatement("select id from vm_template where name='systemvm-xenserver-3.0.0' and removed is null");
-        rs = pstmt.executeQuery();
-        long templateId1 = rs.getLong(1);
-        rs.close();
-        pstmt.close();
-        
-        pstmt = conn.prepareStatement("select distinct(vm_template_id) from vm_instance where type <> 'USER' and hypervisor_type = 'XenServer'");
-        rs = pstmt.executeQuery();
-        long templateId = rs.getLong(1);
-        rs.close();
-        pstmt.close();
-
-        assert (templateId ==  templateId1) : "XenServer System Vms not using 3.0.0 template";
-        rs.close();
-        pstmt.close();
-        
-        pstmt = conn.prepareStatement("select id from vm_template where name='systemvm-kvm-3.0.0' and removed is null");
-        rs = pstmt.executeQuery();
-        long templateId3 = rs.getLong(1);
-        rs.close();
-        pstmt.close();
-        
-        pstmt = conn.prepareStatement("select distinct(vm_template_id) from vm_instance where type <> 'USER' and hypervisor_type = 'KVM'");
-        rs = pstmt.executeQuery();
-        long templateId4 = rs.getLong(1);
-        rs.close();
-        pstmt.close();
-
-        assert (templateId3 ==  templateId4) : "KVM System Vms not using 3.0.0 template";
-        rs.close();
-        pstmt.close();
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf32776f/server/test/com/cloud/upgrade/Test2214To30DBUpgrade.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/upgrade/Test2214To30DBUpgrade.java b/server/test/com/cloud/upgrade/Test2214To30DBUpgrade.java
deleted file mode 100644
index ff44803..0000000
--- a/server/test/com/cloud/upgrade/Test2214To30DBUpgrade.java
+++ /dev/null
@@ -1,199 +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.
-package com.cloud.upgrade;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
-
-import com.cloud.utils.db.DbTestUtils;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-
-public class Test2214To30DBUpgrade extends TestCase {
-    private static final Logger s_logger = Logger
-            .getLogger(Test2214To30DBUpgrade.class);
-
-    @Inject DatabaseUpgradeChecker checker;
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        DbTestUtils.executeScript("cleanup.sql", false,
-                true);
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    public void test2214to30Upgrade() throws SQLException {
-        s_logger.debug("Finding sample data from 2.2.14");
-        DbTestUtils.executeScript(
-                "fake.sql", false,
-                true);
-
-        checker.upgrade("2.2.14", "3.0.0");
-
-        Connection conn = Transaction.getStandaloneConnection();
-
-        try {
-            checkPhysicalNetworks(conn);
-            checkNetworkOfferings(conn);
-            checkNetworks(conn);
-        } finally {
-            try {
-                conn.close();
-            } catch (SQLException e) {
-            }
-        }
-    }
-
-    protected void checkPhysicalNetworks(Connection conn) throws SQLException {
-        PreparedStatement pstmt;
-
-        pstmt = conn
-                .prepareStatement("SELECT version FROM `cloud`.`version` ORDER BY id DESC LIMIT 1");
-        ResultSet rs = pstmt.executeQuery();
-        assert rs.next() : "No version selected";
-        assert rs.getString(1).equals("3.0.0") : "VERSION stored is not 3.0.0: "
-                + rs.getString(1);
-        rs.close();
-        pstmt.close();
-
-        pstmt = conn.prepareStatement("SELECT COUNT(*) FROM `cloud`.`physical_network`");
-        rs = pstmt.executeQuery();
-        assert rs.next() : "No physical networks setup.";
-        rs.close();
-        pstmt.close();
-
-    }
-
-    protected void checkNetworkOfferings(Connection conn) throws SQLException {
-        // 1) verify that all fields are present
-        List<String> fields = new ArrayList<String>();
-        fields.add("id");
-        fields.add("name");
-        fields.add("unique_name");
-        fields.add("display_text");
-        fields.add("nw_rate");
-        fields.add("mc_rate");
-        fields.add("traffic_type");
-        fields.add("specify_vlan");
-        fields.add("system_only");
-        fields.add("service_offering_id");
-        fields.add("tags");
-        fields.add("default");
-        fields.add("availability");
-        fields.add("state");
-        fields.add("removed");
-        fields.add("created");
-        fields.add("guest_type");
-        fields.add("dedicated_lb_service");
-        fields.add("shared_source_nat_service");
-        fields.add("specify_ip_ranges");
-        fields.add("sort_key");
-        fields.add("uuid");
-        fields.add("redundant_router_service");
-        fields.add("conserve_mode");
-        fields.add("elastic_ip_service");
-        fields.add("elastic_lb_service");
-
-        PreparedStatement pstmt;
-        for (String field : fields) {
-            pstmt = conn
-                    .prepareStatement("SHOW COLUMNS FROM `cloud`.`network_offerings` LIKE ?");
-            pstmt.setString(1, field);
-            ResultSet rs = pstmt.executeQuery();
-            if (!rs.next()) {
-                throw new CloudRuntimeException("Field " + field
-                        + " is missing in upgraded network_offerings table");
-            }
-            rs.close();
-            pstmt.close();
-
-        }
-
-        // 2) compare default network offerings
-    }
-
-    protected void checkNetworks(Connection conn) throws SQLException {
-
-        // 1) verify that all fields are present
-        List<String> fields = new ArrayList<String>();
-        fields.add("id");
-        fields.add("name");
-
-        fields.add("mode");
-        fields.add("broadcast_domain_type");
-        fields.add("traffic_type");
-        fields.add("display_text");
-        fields.add("broadcast_uri");
-        fields.add("gateway");
-        fields.add("cidr");
-        fields.add("network_offering_id");
-        fields.add("physical_network_id");
-        fields.add("data_center_id");
-        fields.add("related");
-        fields.add("guru_name");
-        fields.add("state");
-        fields.add("dns1");
-        fields.add("domain_id");
-        fields.add("account_id");
-        fields.add("set_fields");
-        fields.add("guru_data");
-        fields.add("dns2");
-        fields.add("network_domain");
-        fields.add("created");
-        fields.add("removed");
-        fields.add("reservation_id");
-        fields.add("uuid");
-        fields.add("guest_type");
-        fields.add("restart_required");
-        fields.add("specify_ip_ranges");
-        fields.add("acl_type");
-
-        PreparedStatement pstmt;
-        for (String field : fields) {
-            pstmt = conn.prepareStatement("SHOW COLUMNS FROM `cloud`.`networks` LIKE ?");
-            pstmt.setString(1, field);
-            ResultSet rs = pstmt.executeQuery();
-            if (!rs.next()) {
-                throw new CloudRuntimeException("Field " + field
-                        + " is missing in upgraded networks table");
-            }
-            rs.close();
-            pstmt.close();
-
-        }
-
-    }
-}