http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
----------------------------------------------------------------------
diff --git a/utils/src/test/java/com/cloud/utils/testcase/NioTest.java 
b/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
new file mode 100644
index 0000000..fc16684
--- /dev/null
+++ b/utils/src/test/java/com/cloud/utils/testcase/NioTest.java
@@ -0,0 +1,216 @@
+//
+// 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.utils.testcase;
+
+import java.nio.channels.ClosedChannelException;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+
+import com.cloud.utils.nio.HandlerFactory;
+import com.cloud.utils.nio.Link;
+import com.cloud.utils.nio.NioClient;
+import com.cloud.utils.nio.NioServer;
+import com.cloud.utils.nio.Task;
+import com.cloud.utils.nio.Task.Type;
+
+/**
+ *
+ *
+ *
+ *
+ */
+
+public class NioTest extends TestCase {
+
+    private static final Logger s_logger = Logger.getLogger(NioTest.class);
+
+    private NioServer _server;
+    private NioClient _client;
+
+    private Link _clientLink;
+
+    private int _testCount;
+    private int _completedCount;
+
+    private boolean isTestsDone() {
+        boolean result;
+        synchronized (this) {
+            result = (_testCount == _completedCount);
+        }
+        return result;
+    }
+
+    private void getOneMoreTest() {
+        synchronized (this) {
+            _testCount++;
+        }
+    }
+
+    private void oneMoreTestDone() {
+        synchronized (this) {
+            _completedCount++;
+        }
+    }
+
+    @Override
+    public void setUp() {
+        s_logger.info("Test");
+
+        _testCount = 0;
+        _completedCount = 0;
+
+        _server = new NioServer("NioTestServer", 7777, 5, new NioTestServer());
+        _server.start();
+
+        _client = new NioClient("NioTestServer", "127.0.0.1", 7777, 5, new 
NioTestClient());
+        _client.start();
+
+        while (_clientLink == null) {
+            try {
+                s_logger.debug("Link is not up! Waiting ...");
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @Override
+    public void tearDown() {
+        while (!isTestsDone()) {
+            try {
+                s_logger.debug(this._completedCount + "/" + this._testCount + 
" tests done. Waiting for completion");
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+        stopClient();
+        stopServer();
+    }
+
+    protected void stopClient() {
+        _client.stop();
+        s_logger.info("Client stopped.");
+    }
+
+    protected void stopServer() {
+        _server.stop();
+        s_logger.info("Server stopped.");
+    }
+
+    protected void setClientLink(Link link) {
+        _clientLink = link;
+    }
+
+    Random randomGenerator = new Random();
+
+    byte[] _testBytes;
+
+    public void testConnection() {
+        _testBytes = new byte[1000000];
+        randomGenerator.nextBytes(_testBytes);
+        try {
+            getOneMoreTest();
+            _clientLink.send(_testBytes);
+            s_logger.info("Client: Data sent");
+            getOneMoreTest();
+            _clientLink.send(_testBytes);
+            s_logger.info("Client: Data sent");
+        } catch (ClosedChannelException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    protected void doServerProcess(byte[] data) {
+        oneMoreTestDone();
+        Assert.assertArrayEquals(_testBytes, data);
+        s_logger.info("Verify done.");
+    }
+
+    public class NioTestClient implements HandlerFactory {
+
+        @Override
+        public Task create(Type type, Link link, byte[] data) {
+            return new NioTestClientHandler(type, link, data);
+        }
+
+        public class NioTestClientHandler extends Task {
+
+            public NioTestClientHandler(Type type, Link link, byte[] data) {
+                super(type, link, data);
+            }
+
+            @Override
+            public void doTask(final Task task) {
+                if (task.getType() == Task.Type.CONNECT) {
+                    s_logger.info("Client: Received CONNECT task");
+                    setClientLink(task.getLink());
+                } else if (task.getType() == Task.Type.DATA) {
+                    s_logger.info("Client: Received DATA task");
+                } else if (task.getType() == Task.Type.DISCONNECT) {
+                    s_logger.info("Client: Received DISCONNECT task");
+                    stopClient();
+                } else if (task.getType() == Task.Type.OTHER) {
+                    s_logger.info("Client: Received OTHER task");
+                }
+            }
+
+        }
+    }
+
+    public class NioTestServer implements HandlerFactory {
+
+        @Override
+        public Task create(Type type, Link link, byte[] data) {
+            return new NioTestServerHandler(type, link, data);
+        }
+
+        public class NioTestServerHandler extends Task {
+
+            public NioTestServerHandler(Type type, Link link, byte[] data) {
+                super(type, link, data);
+            }
+
+            @Override
+            public void doTask(final Task task) {
+                if (task.getType() == Task.Type.CONNECT) {
+                    s_logger.info("Server: Received CONNECT task");
+                } else if (task.getType() == Task.Type.DATA) {
+                    s_logger.info("Server: Received DATA task");
+                    doServerProcess(task.getData());
+                } else if (task.getType() == Task.Type.DISCONNECT) {
+                    s_logger.info("Server: Received DISCONNECT task");
+                    stopServer();
+                } else if (task.getType() == Task.Type.OTHER) {
+                    s_logger.info("Server: Received OTHER task");
+                }
+            }
+
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject.java
----------------------------------------------------------------------
diff --git a/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject.java 
b/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject.java
new file mode 100644
index 0000000..faaf980
--- /dev/null
+++ b/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject.java
@@ -0,0 +1,53 @@
+//
+// 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.utils.xmlobject;
+
+import org.junit.Test;
+
+public class TestXmlObject {
+
+    void p(String str) {
+        System.out.println(str);
+    }
+
+    @Test
+    public void test() {
+
+        // deprecated, since we no longer use component.xml.in any more
+        /*
+            XmlObject xo = 
XmlObjectParser.parseFromFile("z:/components.xml.in");
+            p(xo.getTag());
+            p((String) xo.get("system-integrity-checker.checker").toString());
+            List<XmlObject> lst = xo.get("management-server.adapters");
+            for (XmlObject x : lst) {
+                List<XmlObject> lst1 = x.getAsList("adapter");
+                for (XmlObject y : lst1) {
+                    p(y.toString());
+                }
+            }
+            */
+
+        XmlObject xml = new XmlObject("vlan").putElement("vlan-id", 
String.valueOf(19)).putElement("tagged",
+                new XmlObject("teng").putElement("name", "0/0")
+        ).putElement("shutdown", "false");
+        System.out.println(xml.toString());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject2.java
----------------------------------------------------------------------
diff --git a/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject2.java 
b/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject2.java
new file mode 100644
index 0000000..9a27ca1
--- /dev/null
+++ b/utils/src/test/java/com/cloud/utils/xmlobject/TestXmlObject2.java
@@ -0,0 +1,54 @@
+//
+// 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.utils.xmlobject;
+
+import org.junit.Test;
+
+public class TestXmlObject2 {
+    void p(String str) {
+        System.out.println(str);
+    }
+
+    XmlObject xo(String name) {
+        return new XmlObject(name);
+    }
+
+    @Test
+    public void test() {
+        XmlObject root = new XmlObject("test");
+        root.putElement("key1", "value1").putElement("key2", "value2");
+        p(root.dump());
+
+        XmlObject c1 = new XmlObject("child1");
+        XmlObject c2 = new XmlObject("child2");
+        c2.putElement("ckey1", "value1");
+        c1.putElement(c2.getTag(), c2);
+        root.putElement(c1.getTag(), c1);
+        p(root.dump());
+
+        root =
+            xo("test2").putElement("key1", "value1")
+                .putElement("child1", xo("child1").setText("yyy"))
+                .putElement("child1", xo("child1").putElement("child2", 
xo("child2").putElement("child3", xo("child3").putElement("key3", 
"value3").setText("xxxxx"))));
+
+        p(root.dump());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtilTest.java
----------------------------------------------------------------------
diff --git 
a/utils/src/test/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtilTest.java
 
b/utils/src/test/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtilTest.java
new file mode 100644
index 0000000..ace765a
--- /dev/null
+++ 
b/utils/src/test/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtilTest.java
@@ -0,0 +1,54 @@
+// 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 org.apache.cloudstack.utils.imagestore;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ImageStoreUtilTest {
+
+    @Test
+    public void testgeneratePostUploadUrl() throws MalformedURLException {
+        String ssvmdomain = "*.realhostip.com";
+        String ipAddress = "10.147.28.14";
+        String uuid = UUID.randomUUID().toString();
+
+        //ssvm domain is not set
+        String url = ImageStoreUtil.generatePostUploadUrl(null, ipAddress, 
uuid);
+        assertPostUploadUrl(url, ipAddress, uuid);
+
+        //ssvm domain is set to empty value
+        url = ImageStoreUtil.generatePostUploadUrl("", ipAddress, uuid);
+        assertPostUploadUrl(url, ipAddress, uuid);
+
+        //ssvm domain is set to a valid value
+        url = ImageStoreUtil.generatePostUploadUrl(ssvmdomain, ipAddress, 
uuid);
+        assertPostUploadUrl(url, ipAddress.replace(".", "-") + 
ssvmdomain.substring(1), uuid);
+    }
+
+    private void assertPostUploadUrl(String urlStr, String domain, String 
uuid) throws MalformedURLException {
+        URL url = new URL(urlStr);
+        Assert.assertNotNull(url);
+        Assert.assertEquals(url.getHost(), domain);
+        Assert.assertEquals(url.getPath(), "/upload/" + uuid);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/resources/com/cloud/utils/QualifierTestContext.xml
----------------------------------------------------------------------
diff --git a/utils/src/test/resources/com/cloud/utils/QualifierTestContext.xml 
b/utils/src/test/resources/com/cloud/utils/QualifierTestContext.xml
new file mode 100644
index 0000000..39f494b
--- /dev/null
+++ b/utils/src/test/resources/com/cloud/utils/QualifierTestContext.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
+  xmlns:context="http://www.springframework.org/schema/context";
+  xmlns:tx="http://www.springframework.org/schema/tx"; 
+  xmlns:aop="http://www.springframework.org/schema/aop";
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/tx 
+                      
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+                      http://www.springframework.org/schema/aop
+                      
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      
http://www.springframework.org/schema/context/spring-context-3.0.xsd";>          
           
+  <context:annotation-config />
+  <context:component-scan base-package="org.apache.cloudstack, com.cloud" />
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/resources/com/cloud/utils/db/transactionContextBuilderTest.xml
----------------------------------------------------------------------
diff --git 
a/utils/src/test/resources/com/cloud/utils/db/transactionContextBuilderTest.xml 
b/utils/src/test/resources/com/cloud/utils/db/transactionContextBuilderTest.xml
new file mode 100644
index 0000000..81ca058
--- /dev/null
+++ 
b/utils/src/test/resources/com/cloud/utils/db/transactionContextBuilderTest.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
+  xmlns:context="http://www.springframework.org/schema/context";
+  xmlns:tx="http://www.springframework.org/schema/tx"; 
+  xmlns:aop="http://www.springframework.org/schema/aop";
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/tx 
+                      
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+                      http://www.springframework.org/schema/aop
+                      
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      
http://www.springframework.org/schema/context/spring-context-3.0.xsd";>          
           
+  <context:annotation-config />
+  <context:component-scan base-package="org.apache.cloudstack, com.cloud" />
+
+  <aop:config proxy-target-class="true">
+    <aop:aspect id="dbContextBuilder" ref="transactionContextBuilder">
+    <aop:pointcut id="captureAnyMethod"
+      expression="execution(* *(..))" />
+      <aop:around pointcut-ref="captureAnyMethod" method="AroundAnyMethod"/> 
+    </aop:aspect>
+  </aop:config>
+
+  <bean id="transactionContextBuilder" 
class="com.cloud.utils.db.TransactionContextBuilder" />
+  
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/utils/src/test/resources/log4j.xml 
b/utils/src/test/resources/log4j.xml
new file mode 100755
index 0000000..cdae2fa
--- /dev/null
+++ b/utils/src/test/resources/log4j.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"; 
debug="false">
+
+       <throwableRenderer class="com.cloud.utils.log.CglibThrowableRenderer"/>
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A regular appender FIXME implement code that will close/reopen logs on 
SIGHUP by logrotate FIXME make the paths configurable using the build system -->
+<!--   <appender name="FILE" 
class="org.apache.log4j.rolling.RollingFileAppender">
+      <param name="Append" value="true"/>
+      <param name="Threshold" value="TRACE"/>
+      <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
+        <param name="FileNamePattern" value="@MSLOG@.%d{yyyy-MM-dd}.gz"/>
+        <param name="ActiveFileName" value="@MSLOG@"/>
+      </rollingPolicy>
+      <layout class="org.apache.log4j.EnhancedPatternLayout">
+         <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{3}] 
(%t:%x) %m%n"/>
+      </layout>
+   </appender>
+   -->
+  <!-- 
+   <appender name="APISERVER" 
class="org.apache.log4j.rolling.RollingFileAppender">
+      <param name="Append" value="true"/>
+      <param name="Threshold" value="TRACE"/>
+      <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
+        <param name="FileNamePattern" 
value="@APISERVERLOG@.%d{yyyy-MM-dd}.gz"/>
+        <param name="ActiveFileName" value="@APISERVERLOG@"/>
+      </rollingPolicy>
+      <layout class="org.apache.log4j.EnhancedPatternLayout">
+         <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{3}] 
(%t:%x) %m%n"/>
+      </layout>
+   </appender>
+   -->
+   
+   
+   <!-- ============================== -->
+   <!-- Append warnings+ to the syslog if it is listening on UDP port FIXME 
make sysloghost configurable! -->
+   <!-- ============================== -->
+<!--
+   <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
+      <param name="Threshold" value="WARN"/>
+      <param name="SyslogHost" value="localhost"/>
+      <param name="Facility" value="LOCAL6"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%-5p [%c{3}] (%t:%x) %m%n"/>
+      </layout>
+   </appender>
+-->
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="TRACE"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{3}] 
(%t:%x) %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="com.cloud">
+     <priority value="DEBUG"/>
+   </category>
+   
+   <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
+   <category name="org.apache">
+      <priority value="INFO"/>
+   </category>
+
+   <category name="org">
+      <priority value="INFO"/>
+   </category>
+   
+   <category name="net">
+     <priority value="INFO"/>
+   </category>
+
+   <category name="apiserver.com.cloud">
+     <priority value="DEBUG"/>
+   </category>
+
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <level value="INFO"/>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/resources/testContext.xml
----------------------------------------------------------------------
diff --git a/utils/src/test/resources/testContext.xml 
b/utils/src/test/resources/testContext.xml
new file mode 100644
index 0000000..cb5b9b8
--- /dev/null
+++ b/utils/src/test/resources/testContext.xml
@@ -0,0 +1,52 @@
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
+  xmlns:context="http://www.springframework.org/schema/context";
+  xmlns:tx="http://www.springframework.org/schema/tx"; 
+  xmlns:aop="http://www.springframework.org/schema/aop";
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/tx 
+                      
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+                      http://www.springframework.org/schema/aop
+                      
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      
http://www.springframework.org/schema/context/spring-context-3.0.xsd";>          
           
+
+  <context:annotation-config />
+
+  <context:component-scan base-package="org.apache.cloudstack, com.cloud" />
+
+  <!--
+    @DB support
+  -->
+  <bean id="transactionContextBuilder" 
class="com.cloud.utils.db.TransactionContextBuilder" />
+
+  <bean id="instantiatePostProcessor" 
class="com.cloud.utils.component.ComponentInstantiationPostProcessor">
+    <property name="Interceptors">
+        <list>
+            <ref bean="transactionContextBuilder" />
+        </list>
+    </property>
+  </bean>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/DateUtilTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/DateUtilTest.java 
b/utils/test/com/cloud/utils/DateUtilTest.java
deleted file mode 100644
index ba88505..0000000
--- a/utils/test/com/cloud/utils/DateUtilTest.java
+++ /dev/null
@@ -1,60 +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.utils;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-import com.cloud.utils.DateUtil.IntervalType;
-
-
-public class DateUtilTest {
-
-    // command line test tool
-    public static void main(String[] args) {
-        TimeZone localTimezone = Calendar.getInstance().getTimeZone();
-        TimeZone gmtTimezone = TimeZone.getTimeZone("GMT");
-        TimeZone estTimezone = TimeZone.getTimeZone("EST");
-
-        Date time = new Date();
-        System.out.println("local time :" + 
DateUtil.getDateDisplayString(localTimezone, time));
-        System.out.println("GMT time   :" + 
DateUtil.getDateDisplayString(gmtTimezone, time));
-        System.out.println("EST time   :" + 
DateUtil.getDateDisplayString(estTimezone, time));
-        //Test next run time. Expects interval and schedule as arguments
-        if (args.length == 2) {
-            System.out.println("Next run time: " + 
DateUtil.getNextRunTime(IntervalType.getIntervalType(args[0]), args[1], "GMT", 
time).toString());
-        }
-
-        time = new Date();
-        DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'Z");
-        String str = dfDate.format(time);
-        System.out.println("Formated TZ time string : " + str);
-        try {
-            Date dtParsed = DateUtil.parseTZDateString(str);
-            System.out.println("Parsed TZ time string : " + 
dtParsed.toString());
-        } catch (ParseException e) {
-            System.err.println("Parsing failed\n string : " + str + 
"\nexception :" + e.getLocalizedMessage());
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/DummyImpl.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/DummyImpl.java 
b/utils/test/com/cloud/utils/DummyImpl.java
deleted file mode 100644
index e2360c0..0000000
--- a/utils/test/com/cloud/utils/DummyImpl.java
+++ /dev/null
@@ -1,31 +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.utils;
-
-import org.springframework.stereotype.Component;
-
-@Component
-public class DummyImpl implements DummyInterface {
-
-    @Override
-    public void foo() {
-        System.out.println("Basic foo implementation");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/DummyInterface.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/DummyInterface.java 
b/utils/test/com/cloud/utils/DummyInterface.java
deleted file mode 100644
index 4f6a777..0000000
--- a/utils/test/com/cloud/utils/DummyInterface.java
+++ /dev/null
@@ -1,24 +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.utils;
-
-public interface DummyInterface {
-    void foo();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/DummyPremiumImpl.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/DummyPremiumImpl.java 
b/utils/test/com/cloud/utils/DummyPremiumImpl.java
deleted file mode 100644
index 9c71368..0000000
--- a/utils/test/com/cloud/utils/DummyPremiumImpl.java
+++ /dev/null
@@ -1,28 +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.utils;
-
-public class DummyPremiumImpl implements DummyInterface {
-
-    @Override
-    public void foo() {
-        System.out.println("Premium foo implementation");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/HttpUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/HttpUtilsTest.java 
b/utils/test/com/cloud/utils/HttpUtilsTest.java
deleted file mode 100644
index e10a5a3..0000000
--- a/utils/test/com/cloud/utils/HttpUtilsTest.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.utils;
-
-import org.junit.Test;
-import org.springframework.mock.web.MockHttpSession;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpSession;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class HttpUtilsTest {
-
-    @Test
-    public void findCookieTest() {
-        Cookie[] cookies = null;
-        String cookieName = null;
-
-        // null test
-        assertNull(HttpUtils.findCookie(cookies, cookieName));
-        cookieName = "";
-        assertNull(HttpUtils.findCookie(cookies, cookieName));
-
-        // value test
-        cookieName = "daakuBandar";
-        cookies = new Cookie[]{new Cookie(cookieName, "someValue")};
-        assertNull(HttpUtils.findCookie(cookies, "aalasiLangur"));
-        assertNotNull(HttpUtils.findCookie(cookies, cookieName));
-    }
-
-    @Test
-    public void validateSessionKeyTest() {
-        HttpSession session = null;
-        Map<String, Object[]> params = null;
-        String sessionKeyString = null;
-        Cookie[] cookies = null;
-        final String sessionKeyValue = "randomUniqueSessionID";
-
-        // session and sessionKeyString null test
-        assertFalse(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-        sessionKeyString =  "sessionkey";
-        assertFalse(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-
-        // param and cookie null test
-        session = new MockHttpSession();
-        session.setAttribute(sessionKeyString, sessionKeyValue);
-        assertFalse(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-
-        // param null, cookies not null test
-        params = null;
-        cookies = new Cookie[]{new Cookie(sessionKeyString, sessionKeyValue)};
-        assertFalse(HttpUtils.validateSessionKey(session, params, cookies, 
"randomString"));
-        assertTrue(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-
-        // param not null, cookies null test
-        params = new HashMap<String, Object[]>();
-        params.put(sessionKeyString, new String[]{"randomString"});
-        cookies = null;
-        assertFalse(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-        params.put(sessionKeyString, new String[]{sessionKeyValue});
-        assertTrue(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-
-        // both param and cookies not null test
-        params = new HashMap<String, Object[]>();
-        cookies = new Cookie[]{new Cookie(sessionKeyString, sessionKeyValue)};
-        params.put(sessionKeyString, new String[]{"incorrectValue"});
-        assertFalse(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-        params.put(sessionKeyString, new String[]{sessionKeyValue});
-        assertTrue(HttpUtils.validateSessionKey(session, params, cookies, 
sessionKeyString));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/NumbersUtilTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/NumbersUtilTest.java 
b/utils/test/com/cloud/utils/NumbersUtilTest.java
deleted file mode 100644
index 82b2305..0000000
--- a/utils/test/com/cloud/utils/NumbersUtilTest.java
+++ /dev/null
@@ -1,47 +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.utils;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Locale;
-
-import org.junit.Test;
-
-public class NumbersUtilTest {
-
-    @Test
-    public void toReadableSize() {
-        Locale.setDefault(Locale.US); // Fixed locale for the test
-        assertEquals("1.0000 TB", NumbersUtil.toReadableSize((1024l * 1024l * 
1024l * 1024l)));
-        assertEquals("1.00 GB", NumbersUtil.toReadableSize(1024 * 1024 * 
1024));
-        assertEquals("1.00 MB", NumbersUtil.toReadableSize(1024 * 1024));
-        assertEquals("1.00 KB", NumbersUtil.toReadableSize((1024)));
-        assertEquals("1023 bytes", NumbersUtil.toReadableSize((1023)));
-    }
-
-    @Test
-    public void bytesToLong() {
-        assertEquals(0, NumbersUtil.bytesToLong(new byte[] {0, 0, 0, 0, 0, 0, 
0, 0}));
-        assertEquals(1, NumbersUtil.bytesToLong(new byte[] {0, 0, 0, 0, 0, 0, 
0, 1}));
-        assertEquals(257, NumbersUtil.bytesToLong(new byte[] {0, 0, 0, 0, 0, 
0, 1, 1}));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/PasswordGeneratorTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/PasswordGeneratorTest.java 
b/utils/test/com/cloud/utils/PasswordGeneratorTest.java
deleted file mode 100644
index 413b866..0000000
--- a/utils/test/com/cloud/utils/PasswordGeneratorTest.java
+++ /dev/null
@@ -1,42 +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.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class PasswordGeneratorTest {
-    @Test
-    public void generateRandomPassword() {
-        // actual length is requested length, minimum length is 3
-        Assert.assertTrue(PasswordGenerator.generateRandomPassword(0).length() 
== 3);
-        Assert.assertTrue(PasswordGenerator.generateRandomPassword(1).length() 
== 3);
-        Assert.assertTrue(PasswordGenerator.generateRandomPassword(5).length() 
== 5);
-        String password = PasswordGenerator.generateRandomPassword(8);
-        // TODO: this might give more help to bruteforcing than desired
-        // the actual behavior is that the first character is a random 
lowercase
-        // char
-        Assert.assertTrue(Character.isLowerCase(password.charAt(0)));
-        // the second character is a random upper case char
-        Assert.assertTrue(Character.isUpperCase(password.charAt(1)));
-        // and the third is a digit
-        Assert.assertTrue(Character.isDigit(password.charAt(2)));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/ProcessUtilTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/ProcessUtilTest.java 
b/utils/test/com/cloud/utils/ProcessUtilTest.java
deleted file mode 100644
index 38e25a3..0000000
--- a/utils/test/com/cloud/utils/ProcessUtilTest.java
+++ /dev/null
@@ -1,76 +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.utils;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.naming.ConfigurationException;
-
-import junit.framework.Assert;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.SystemUtils;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ProcessUtilTest {
-
-    File pidFile;
-
-    @Before
-    public void setup() throws IOException {
-        pidFile = File.createTempFile("test", ".pid");
-    }
-
-    @After
-    public void cleanup() {
-        FileUtils.deleteQuietly(pidFile);
-    }
-
-    @Test
-    public void pidCheck() throws ConfigurationException, IOException {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        FileUtils.writeStringToFile(pidFile, "123456\n");
-        ProcessUtil.pidCheck(pidFile.getParent(), pidFile.getName());
-        String pidStr = FileUtils.readFileToString(pidFile);
-        Assert.assertFalse("pid can not be blank", pidStr.isEmpty());
-        int pid = Integer.parseInt(pidStr.trim());
-        int maxPid = Integer.parseInt(FileUtils.readFileToString(new 
File("/proc/sys/kernel/pid_max")).trim());
-        Assert.assertTrue(pid <= maxPid);
-    }
-
-    @Test(expected = ConfigurationException.class)
-    public void pidCheckBadPid() throws ConfigurationException, IOException {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        FileUtils.writeStringToFile(pidFile, "intentionally not number");
-        ProcessUtil.pidCheck(pidFile.getParent(), pidFile.getName());
-    }
-
-    @Test(expected = ConfigurationException.class)
-    public void pidCheckEmptyPid() throws ConfigurationException, IOException {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        FileUtils.writeStringToFile(pidFile, "intentionally not number");
-        ProcessUtil.pidCheck(pidFile.getParent(), pidFile.getName());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/PropertiesUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/PropertiesUtilsTest.java 
b/utils/test/com/cloud/utils/PropertiesUtilsTest.java
deleted file mode 100644
index e20d7bf..0000000
--- a/utils/test/com/cloud/utils/PropertiesUtilsTest.java
+++ /dev/null
@@ -1,64 +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.utils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class PropertiesUtilsTest {
-    @Test
-    public void findConfigFile() {
-        File configFile = PropertiesUtil.findConfigFile("notexistingresource");
-        Assert.assertNull(configFile);
-    }
-
-    @Test
-    public void loadFromFile() throws IOException {
-        File file = File.createTempFile("test", ".properties");
-        FileUtils.writeStringToFile(file, "a=b\nc=d\n");
-        Properties properties = new Properties();
-        PropertiesUtil.loadFromFile(properties, file);
-        Assert.assertEquals("b", properties.get("a"));
-    }
-
-    @Test
-    public void loadPropertiesFromFile() throws IOException {
-        File file = File.createTempFile("test", ".properties");
-        FileUtils.writeStringToFile(file, "a=b\nc=d\n");
-        Properties properties = PropertiesUtil.loadFromFile(file);
-        Assert.assertEquals("b", properties.get("a"));
-    }
-
-    @Test
-    public void processConfigFile() throws IOException {
-        File tempFile = File.createTempFile("temp", ".properties");
-        FileUtils.writeStringToFile(tempFile, "a=b\nc=d\n");
-        Map<String, String> config = PropertiesUtil.processConfigFile(new 
String[] {tempFile.getAbsolutePath()});
-        Assert.assertEquals("b", config.get("a"));
-        Assert.assertEquals("d", config.get("c"));
-        tempFile.delete();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/ReflectUtilTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/ReflectUtilTest.java 
b/utils/test/com/cloud/utils/ReflectUtilTest.java
deleted file mode 100644
index c024a2e..0000000
--- a/utils/test/com/cloud/utils/ReflectUtilTest.java
+++ /dev/null
@@ -1,148 +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.utils;
-
-import static com.cloud.utils.ReflectUtil.flattenProperties;
-import static com.google.common.collect.Lists.newArrayList;
-import static java.lang.Boolean.TRUE;
-import static java.util.Collections.emptyList;
-import static org.junit.Assert.assertEquals;
-
-import java.lang.reflect.Field;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public final class ReflectUtilTest {
-
-    @Test
-    public void testFlattenNonNullProperties() throws Exception {
-
-        final List<String> expectedResult = newArrayList("booleanProperty", 
TRUE.toString(), "intProperty", "1", "stringProperty", "foo");
-
-        final Bean bean = new Bean(1, true, "foo");
-
-        assertEquals(expectedResult, flattenProperties(bean, Bean.class));
-
-    }
-
-    @Test
-    public void testFlattenNullProperties() throws Exception {
-
-        final List<String> expectedResult = newArrayList("booleanProperty", 
TRUE.toString(), "intProperty", "1", "stringProperty", "null");
-
-        final Bean bean = new Bean(1, true, null);
-
-        assertEquals(expectedResult, flattenProperties(bean, Bean.class));
-
-    }
-
-    @Test
-    public void testFlattenPropertiesNullTarget() throws Exception {
-        assertEquals(emptyList(), flattenProperties(null, Bean.class));
-    }
-
-    public static final class Bean {
-
-        private final int intProperty;
-        private final boolean booleanProperty;
-        private final String stringProperty;
-
-        private Bean(final int intProperty, final boolean booleanProperty, 
final String stringProperty) {
-
-            super();
-
-            this.intProperty = intProperty;
-            this.booleanProperty = booleanProperty;
-            this.stringProperty = stringProperty;
-
-        }
-
-        public int getIntProperty() {
-            return intProperty;
-        }
-
-        public boolean isBooleanProperty() {
-            return booleanProperty;
-        }
-
-        public String getStringProperty() {
-            return stringProperty;
-        }
-
-    }
-
-    static class Empty {
-    }
-
-    static class Foo {
-        String fooField;
-        int fooIntField;
-    }
-
-    static class Bar extends Foo {
-        String barField;
-        int barIntField;
-    }
-
-    static class Baz extends Foo {
-        String bazField;
-        int bazIntField;
-    }
-
-    @Test
-    public void getAllFieldsForClassWithFoo() throws NoSuchFieldException, 
SecurityException {
-        Set<Field> fooFields = ReflectUtil.getAllFieldsForClass(Foo.class, new 
Class<?>[] {});
-        Assert.assertNotNull(fooFields);
-        
Assert.assertTrue(fooFields.contains(Foo.class.getDeclaredField("fooField")));
-        
Assert.assertTrue(fooFields.contains(Foo.class.getDeclaredField("fooIntField")));
-    }
-
-    @Test
-    public void getAllFieldsForClassWithBar() throws NoSuchFieldException, 
SecurityException {
-        Set<Field> barFields = ReflectUtil.getAllFieldsForClass(Bar.class, new 
Class<?>[] {});
-        Assert.assertNotNull(barFields);
-        
Assert.assertTrue(barFields.contains(Foo.class.getDeclaredField("fooField")));
-        
Assert.assertTrue(barFields.contains(Foo.class.getDeclaredField("fooIntField")));
-        
Assert.assertTrue(barFields.contains(Bar.class.getDeclaredField("barField")));
-        
Assert.assertTrue(barFields.contains(Bar.class.getDeclaredField("barIntField")));
-    }
-
-    @Test
-    public void getAllFieldsForClassWithBarWithoutFoo() throws 
NoSuchFieldException, SecurityException {
-        Set<Field> barFields = ReflectUtil.getAllFieldsForClass(Bar.class, new 
Class<?>[] {Foo.class});
-        Assert.assertNotNull(barFields);
-        
Assert.assertTrue(barFields.contains(Bar.class.getDeclaredField("barField")));
-        
Assert.assertTrue(barFields.contains(Bar.class.getDeclaredField("barIntField")));
-    }
-
-    @Test
-    public void getAllFieldsForClassWithBazWithoutBar() throws 
NoSuchFieldException, SecurityException {
-        Set<Field> bazFields = ReflectUtil.getAllFieldsForClass(Baz.class, new 
Class<?>[] {Bar.class});
-        Assert.assertNotNull(bazFields);
-        
Assert.assertTrue(bazFields.contains(Foo.class.getDeclaredField("fooField")));
-        
Assert.assertTrue(bazFields.contains(Foo.class.getDeclaredField("fooIntField")));
-        
Assert.assertTrue(bazFields.contains(Baz.class.getDeclaredField("bazField")));
-        
Assert.assertTrue(bazFields.contains(Baz.class.getDeclaredField("bazIntField")));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/ScriptTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/ScriptTest.java 
b/utils/test/com/cloud/utils/ScriptTest.java
deleted file mode 100644
index 99059bf..0000000
--- a/utils/test/com/cloud/utils/ScriptTest.java
+++ /dev/null
@@ -1,135 +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.utils;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-
-import org.apache.commons.lang.SystemUtils;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-
-import com.cloud.utils.script.OutputInterpreter;
-import com.cloud.utils.script.Script;
-
-public class ScriptTest {
-    @Test
-    public void testEcho() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Script script = new Script("/bin/echo");
-        script.add("bar");
-        OutputInterpreter.AllLinesParser resultParser = new 
OutputInterpreter.AllLinesParser();
-        String result = script.execute(resultParser);
-        // With allLinesParser, result is not comming from the return value
-        Assert.assertNull(result);
-        Assert.assertEquals("bar\n", resultParser.getLines());
-    }
-
-    @Test
-    public void testLogger() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Logger mock = Mockito.mock(Logger.class);
-        Mockito.doNothing().when(mock).debug(Matchers.any());
-        Script script = new Script("/bin/echo", mock);
-        script.execute();
-    }
-
-    @Test
-    public void testToString() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Script script = new Script("/bin/echo");
-        script.add("foo");
-        Assert.assertEquals("/bin/echo foo ", script.toString());
-    }
-
-    @Test
-    public void testSet() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Script script = new Script("/bin/echo");
-        script.add("foo");
-        script.add("bar", "baz");
-        script.set("blah", "blah");
-        Assert.assertEquals("/bin/echo foo bar baz blah blah ",
-                script.toString());
-    }
-
-    @Test
-    @Ignore
-    public void testExecute() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Logger mock = Mockito.mock(Logger.class);
-        Mockito.doNothing().when(mock).debug(Matchers.any());
-        for (int i = 0; i < 100000; i++) {
-            Script script = new Script("/bin/false", mock);
-            script.execute();
-        }
-    }
-
-    @Test
-    public void testRunSimpleBashScript() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Assert.assertEquals("hello world!",
-                Script.runSimpleBashScript("echo 'hello world!'"));
-    }
-
-    @Test
-    public void executeWithOutputInterpreter() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Script script = new Script("/bin/bash");
-        script.add("-c");
-        script.add("echo 'hello world!'");
-        String value = script.execute(new OutputInterpreter() {
-
-            @Override
-            public String interpret(BufferedReader reader) throws IOException {
-                throw new IllegalArgumentException();
-            }
-        });
-        // it is a stack trace in this case as string
-        Assert.assertNotNull(value);
-    }
-
-    @Test
-    public void runSimpleBashScriptNotExisting() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        String output = Script.runSimpleBashScript("/not/existing/scripts/"
-                + System.currentTimeMillis());
-        Assert.assertNull(output);
-    }
-
-    @Test
-    public void testRunSimpleBashScriptWithTimeout() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        Assert.assertEquals("hello world!",
-                Script.runSimpleBashScript("echo 'hello world!'", 1000));
-    }
-
-    @Test
-    public void testFindScript() {
-        Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
-        String script = Script.findScript("/bin", "pwd");
-        Assert.assertNotNull("/bin/pwd shoud be there on linux", script);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/StringUtilsTest.java 
b/utils/test/com/cloud/utils/StringUtilsTest.java
deleted file mode 100644
index 3619ede..0000000
--- a/utils/test/com/cloud/utils/StringUtilsTest.java
+++ /dev/null
@@ -1,253 +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.utils;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.junit.Test;
-
-public class StringUtilsTest {
-
-    @Test
-    public void testGetPreferredCharset() {
-        final boolean ifUtf8Supported = StringUtils.isUtf8Supported();
-        if (ifUtf8Supported) {
-            assertEquals(StringUtils.getPreferredCharset(), 
Charset.forName("UTF-8"));
-        } else {
-            assertNotEquals(StringUtils.getPreferredCharset(), 
Charset.forName("UTF-8"));
-        }
-    }
-
-    @Test
-    public void testGetDefaultCharset() {
-        // Is this test irrelevant? Is wrapping the Charset.defaultCharset() 
too much?
-        // This test was added in order to cover the new 
StringUtils.getDefaultCharset().
-        // One cannot be sure that StringUtils.getPreferredCharset() will 
always be
-        // equals to Charset.defaultCharset()
-        assertEquals(StringUtils.getDefaultCharset(), 
Charset.defaultCharset());
-    }
-
-    @Test
-    public void testCleanPasswordFromJsonObjectAtEnd() {
-        final String input = "{\"foo\":\"bar\",\"password\":\"test\"}";
-        //TODO: It would be nice to clean up the regex in question to not
-        //have to return the trailing comma in the expected string below
-        final String expected = "{\"foo\":\"bar\",}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromJsonObjectInMiddle() {
-        final String input = 
"{\"foo\":\"bar\",\"password\":\"test\",\"test\":\"blah\"}";
-        final String expected = "{\"foo\":\"bar\",\"test\":\"blah\"}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromJsonObjectAlone() {
-        final String input = "{\"password\":\"test\"}";
-        final String expected = "{}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromJsonObjectAtStart() {
-        final String input = "{\"password\":\"test\",\"test\":\"blah\"}";
-        final String expected = "{\"test\":\"blah\"}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromJsonObjectWithMultiplePasswords() {
-        final String input = 
"{\"description\":\"foo\"}],\"password\":\"bar\",\"nic\":[{\"password\":\"bar2\",\"id\":\"1\"}]}";
-        final String expected = 
"{\"description\":\"foo\"}],\"nic\":[{\"id\":\"1\"}]}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromRequestString() {
-        final String input = "username=foo&password=bar&url=foobar";
-        final String expected = "username=foo&url=foobar";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromEncodedRequestString() {
-        final String input = 
"name=SS1&provider=SMB&zoneid=5a60af2b-3025-4f2a-9ecc-8e33bf2b94e3&url=cifs%3A%2F%2F10.102.192.150%2FSMB-Share%2Fsowmya%2Fsecondary%3Fuser%3Dsowmya%26password%3DXXXXX%40123%26domain%3DBLR";
-        final String expected = 
"name=SS1&provider=SMB&zoneid=5a60af2b-3025-4f2a-9ecc-8e33bf2b94e3&url=cifs%3A%2F%2F10.102.192.150%2FSMB-Share%2Fsowmya%2Fsecondary%3Fuser%3Dsowmya%26domain%3DBLR";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromRequestStringWithMultiplePasswords() {
-        final String input = 
"username=foo&password=bar&url=foobar&password=bar2&test=4";
-        final String expected = "username=foo&url=foobar&test=4";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromRequestStringMatchedAtEndSingleQuote() {
-        final String input = "'username=foo&password=bar'";
-        final String expected = "'username=foo'";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromRequestStringMatchedAtEndDoubleQuote() {
-        final String input = "\"username=foo&password=bar\"";
-        final String expected = "\"username=foo\"";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanPasswordFromRequestStringMatchedAtMiddleDoubleQuote() 
{
-        final String input = "\"username=foo&password=bar&goo=sdf\"";
-        final String expected = "\"username=foo&goo=sdf\"";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testJoin() {
-        assertEquals("a-b-c", StringUtils.join("-", "a", "b", "c"));
-        assertEquals("", StringUtils.join("-"));
-    }
-
-    @Test
-    public void testCleanSecretkeyFromJsonObjectAtEnd() {
-        final String input = "{\"foo\":\"bar\",\"secretkey\":\"test\"}";
-        // TODO: It would be nice to clean up the regex in question to not
-        // have to return the trailing comma in the expected string below
-        final String expected = "{\"foo\":\"bar\",}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanSecretkeyFromJsonObjectInMiddle() {
-        final String input = 
"{\"foo\":\"bar\",\"secretkey\":\"test\",\"test\":\"blah\"}";
-        final String expected = "{\"foo\":\"bar\",\"test\":\"blah\"}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanSecretkeyFromJsonObjectAlone() {
-        final String input = "{\"secretkey\":\"test\"}";
-        final String expected = "{}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanSecretkeyFromJsonObjectAtStart() {
-        final String input = "{\"secretkey\":\"test\",\"test\":\"blah\"}";
-        final String expected = "{\"test\":\"blah\"}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanSecretkeyFromJsonObjectWithMultiplePasswords() {
-        final String input = 
"{\"description\":\"foo\"}],\"secretkey\":\"bar\",\"nic\":[{\"secretkey\":\"bar2\",\"id\":\"1\"}]}";
-        final String expected = 
"{\"description\":\"foo\"}],\"nic\":[{\"id\":\"1\"}]}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanAccesskeyFromJsonObjectAtEnd() {
-        final String input = "{\"foo\":\"bar\",\"accesskey\":\"test\"}";
-        // TODO: It would be nice to clean up the regex in question to not
-        // have to return the trailing comma in the expected string below
-        final String expected = "{\"foo\":\"bar\",}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanAccesskeyFromJsonObjectInMiddle() {
-        final String input = 
"{\"foo\":\"bar\",\"accesskey\":\"test\",\"test\":\"blah\"}";
-        final String expected = "{\"foo\":\"bar\",\"test\":\"blah\"}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanAccesskeyFromJsonObjectAlone() {
-        final String input = "{\"accesskey\":\"test\"}";
-        final String expected = "{}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanAccesskeyFromJsonObjectAtStart() {
-        final String input = "{\"accesskey\":\"test\",\"test\":\"blah\"}";
-        final String expected = "{\"test\":\"blah\"}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanAccesskeyFromJsonObjectWithMultiplePasswords() {
-        final String input = 
"{\"description\":\"foo\"}],\"accesskey\":\"bar\",\"nic\":[{\"accesskey\":\"bar2\",\"id\":\"1\"}]}";
-        final String expected = 
"{\"description\":\"foo\"}],\"nic\":[{\"id\":\"1\"}]}";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanAccesskeyFromRequestString() {
-        final String input = "username=foo&accesskey=bar&url=foobar";
-        final String expected = "username=foo&url=foobar";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void testCleanSecretkeyFromRequestString() {
-        final String input = "username=foo&secretkey=bar&url=foobar";
-        final String expected = "username=foo&url=foobar";
-        final String result = StringUtils.cleanString(input);
-        assertEquals(result, expected);
-    }
-
-    @Test
-    public void listToCsvTags() {
-        assertEquals("a,b,c", StringUtils.listToCsvTags(Arrays.asList("a","b", 
"c")));
-        assertEquals("", StringUtils.listToCsvTags(new ArrayList<String>()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/TernaryTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/TernaryTest.java 
b/utils/test/com/cloud/utils/TernaryTest.java
deleted file mode 100644
index cacbecb..0000000
--- a/utils/test/com/cloud/utils/TernaryTest.java
+++ /dev/null
@@ -1,34 +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.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TernaryTest {
-    @Test
-    public void testEquals() {
-        Assert.assertEquals(new Ternary<String, String, String>("a", "b", 
"c"), new Ternary<String, String, String>("a", "b", "c"));
-        Assert.assertFalse(new Ternary<String, String, String>("a", "b", 
"c").equals(new Ternary<String, String, String>("a", "b", "d")));
-        Assert.assertFalse(new Ternary<String, String, String>("a", "b", 
"c").equals(""));
-        Assert.assertFalse(new Ternary<String, String, String>("a", "b", 
"c").equals(null));
-        Assert.assertFalse(new Ternary<String, String, String>("a", "b", 
"c").equals(new Pair<String, String>("a", "b")));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/TestProfiler.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/TestProfiler.java 
b/utils/test/com/cloud/utils/TestProfiler.java
deleted file mode 100644
index 2306cd7..0000000
--- a/utils/test/com/cloud/utils/TestProfiler.java
+++ /dev/null
@@ -1,116 +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.utils;
-
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.cloud.utils.testcase.Log4jEnabledTestCase;
-
-public class TestProfiler extends Log4jEnabledTestCase {
-    protected final static Logger s_logger = 
Logger.getLogger(TestProfiler.class);
-
-    private static final long ONE_SECOND = 1000l;
-    private static final long MILLIS_FACTOR = 1000l;
-    private static final int MARGIN = 100;
-    private static final double EXPONENT = 3d;
-
-    @Test
-    public void testProfilerInMillis() {
-        s_logger.info("testProfiler() started");
-
-        final Profiler pf = new Profiler();
-        pf.start();
-        try {
-            Thread.sleep(ONE_SECOND);
-        } catch (final InterruptedException e) {
-        }
-        pf.stop();
-
-        final long durationInMillis = pf.getDurationInMillis();
-        s_logger.info("Duration in Millis: " + durationInMillis);
-
-        // An error margin in order to cover the time taken by the star/stop 
calls.
-        // 100 milliseconds margin seems too much, but it will avoid assertion 
error
-        // and also fail in case a duration in nanoseconds is used instead.
-        Assert.assertTrue(durationInMillis >= MILLIS_FACTOR  &&  
durationInMillis <= MILLIS_FACTOR + MARGIN);
-
-        s_logger.info("testProfiler() stopped");
-    }
-
-    @Test
-    public void testProfilerInNano() {
-        final Profiler pf = new Profiler();
-        pf.start();
-        try {
-            Thread.sleep(ONE_SECOND);
-        } catch (final InterruptedException e) {
-        }
-        pf.stop();
-
-        final long duration = pf.getDuration();
-        s_logger.info("Duration in Nano: " + duration);
-        Assert.assertTrue(duration >= Math.pow(MILLIS_FACTOR, EXPONENT));
-    }
-
-    @Test
-    public void testProfilerNoStart() {
-        final Profiler pf = new Profiler();
-        try {
-            Thread.sleep(20);
-        } catch (final InterruptedException e) {
-        }
-        pf.stop();
-
-        Assert.assertTrue(pf.getDurationInMillis() == -1);
-        Assert.assertFalse(pf.isStarted());
-    }
-
-    @Test
-    public void testProfilerNoStop() {
-        final Profiler pf = new Profiler();
-        pf.start();
-        try {
-            Thread.sleep(20);
-        } catch (final InterruptedException e) {
-        }
-
-        Assert.assertTrue(pf.getDurationInMillis() == -1);
-        Assert.assertFalse(pf.isStopped());
-    }
-
-    @Test
-    public void testResolution() {
-        long nanoTime1 = 0l;
-        long nanoTime2 = 0l;
-        nanoTime1 = System.nanoTime();
-        nanoTime2 = System.nanoTime();
-
-        // Using sysout here because is faster than the logger and we don't 
want to
-        // waste time.
-        System.out.println("Nano time 1: " + nanoTime1);
-        System.out.println("Nano time 2: " + nanoTime2);
-
-        // We are measuring the elapsed time in 2 consecutive calls of 
System.nanoTime()
-        // That's the same as 0.002 milliseconds or 2000 nanoseconds.
-        Assert.assertTrue("Expected exactly 2 but it took more than 3 
microseconds between 2 consecutive calls to System.nanoTime().", nanoTime2 - 
nanoTime1 <= 3000);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/UriUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/UriUtilsTest.java 
b/utils/test/com/cloud/utils/UriUtilsTest.java
deleted file mode 100644
index d2fd997..0000000
--- a/utils/test/com/cloud/utils/UriUtilsTest.java
+++ /dev/null
@@ -1,60 +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.utils;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-public class UriUtilsTest {
-    @Test
-    public void encodeURIComponent() {
-        Assert.assertEquals("http://localhost";,
-                UriUtils.encodeURIComponent("http://localhost";));
-        Assert.assertEquals("http://localhost/";,
-                UriUtils.encodeURIComponent("http://localhost/";));
-        Assert.assertEquals("http://localhost/foo/bar";,
-                UriUtils.encodeURIComponent("http://localhost/foo/bar";));
-    }
-
-    @Test
-    public void getUpdateUri() {
-        // no password param, no request for encryption
-        Assert.assertEquals("http://localhost/foo/bar?param=true";, UriUtils
-                .getUpdateUri("http://localhost/foo/bar?param=true";, false));
-        // there is password param but still no request for encryption, should
-        // be unchanged
-        Assert.assertEquals("http://localhost/foo/bar?password=1234";, UriUtils
-                .getUpdateUri("http://localhost/foo/bar?password=1234";, 
false));
-        // if there is password param and encryption is requested then it may 
or
-        // may not be changed depending on how the EncrytionUtils is setup, but
-        // at least it needs to start with the same url
-        Assert.assertTrue(UriUtils.getUpdateUri(
-                "http://localhost/foo/bar?password=1234";, true).startsWith(
-                "http://localhost/foo/bar";));
-
-        //just to see if it is still ok with multiple parameters
-        
Assert.assertEquals("http://localhost/foo/bar?param1=true&param2=12345";, 
UriUtils
-                
.getUpdateUri("http://localhost/foo/bar?param1=true&param2=12345";, false));
-
-        //XXX: Interesting cases not covered:
-        // * port is ignored and left out from the return value
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/UuidUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/UuidUtilsTest.java 
b/utils/test/com/cloud/utils/UuidUtilsTest.java
deleted file mode 100644
index 2ef6bbd..0000000
--- a/utils/test/com/cloud/utils/UuidUtilsTest.java
+++ /dev/null
@@ -1,42 +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.utils;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class UuidUtilsTest {
-
-    @Test
-    public void testValidateUUIDPass() throws Exception {
-        String serviceUuid = "f81a9aa3-1f7d-466f-b04b-f2b101486bae";
-
-        assertTrue(UuidUtils.validateUUID(serviceUuid));
-    }
-
-    @Test
-    public void testValidateUUIDFail() throws Exception {
-        String serviceUuid = "6fc6ce7-d503-4f95-9e68-c9cd281b13df";
-
-        assertFalse(UuidUtils.validateUUID(serviceUuid));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/backoff/impl/ConstantTimeBackoffTest.java
----------------------------------------------------------------------
diff --git 
a/utils/test/com/cloud/utils/backoff/impl/ConstantTimeBackoffTest.java 
b/utils/test/com/cloud/utils/backoff/impl/ConstantTimeBackoffTest.java
deleted file mode 100644
index d397511..0000000
--- a/utils/test/com/cloud/utils/backoff/impl/ConstantTimeBackoffTest.java
+++ /dev/null
@@ -1,112 +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.utils.backoff.impl;
-
-import java.util.HashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class ConstantTimeBackoffTest {
-    final static private Log LOG = 
LogFactory.getLog(ConstantTimeBackoffTest.class);
-
-    @Test
-    public void waitBeforeRetryWithInterrupt() throws InterruptedException {
-        final ConstantTimeBackoff backoff = new ConstantTimeBackoff();
-        backoff.setTimeToWait(10);
-        Assert.assertTrue(backoff.getWaiters().isEmpty());
-        Thread waitThread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                backoff.waitBeforeRetry();
-            }
-        });
-        waitThread.start();
-        Thread.sleep(100);
-        Assert.assertFalse(backoff.getWaiters().isEmpty());
-        waitThread.interrupt();
-        Thread.sleep(100);
-        Assert.assertTrue(backoff.getWaiters().isEmpty());
-    }
-
-    @Test
-    public void waitBeforeRetry() throws InterruptedException {
-        final ConstantTimeBackoff backoff = new ConstantTimeBackoff();
-        // let's not wait too much in a test
-        backoff.setTimeToWait(0);
-        // check if the list of waiters is empty
-        Assert.assertTrue(backoff.getWaiters().isEmpty());
-        // call the waitBeforeRetry which will wait 0 ms and return
-        backoff.waitBeforeRetry();
-        // on normal exit the list of waiters should be cleared
-        Assert.assertTrue(backoff.getWaiters().isEmpty());
-    }
-
-    @Test
-    public void configureEmpty() {
-        // at this point this is the only way rhe configure method gets 
invoked,
-        // therefore have to make sure it works correctly
-        final ConstantTimeBackoff backoff = new ConstantTimeBackoff();
-        backoff.configure("foo", new HashMap<String, Object>());
-        Assert.assertEquals(5000, backoff.getTimeToWait());
-    }
-
-    @Test
-    public void configureWithValue() {
-        final ConstantTimeBackoff backoff = new ConstantTimeBackoff();
-        HashMap<String, Object> params = new HashMap<String, Object>();
-        params.put("seconds", "100");
-        backoff.configure("foo", params);
-        Assert.assertEquals(100000, backoff.getTimeToWait());
-    }
-
-    /**
-     * Test that wakeup returns false when trying to wake a non existing 
thread.
-     */
-    @Test
-    public void wakeupNotExisting() {
-        final ConstantTimeBackoff backoff = new ConstantTimeBackoff();
-        Assert.assertFalse(backoff.wakeup("NOT EXISTING THREAD"));
-    }
-
-    /**
-     * Test that wakeup will return true if the thread is waiting.
-     */
-    @Test
-    public void wakeupExisting() throws InterruptedException {
-        final ConstantTimeBackoff backoff = new ConstantTimeBackoff();
-        backoff.setTimeToWait(10);
-        Thread thread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                LOG.debug("before");
-                backoff.waitBeforeRetry();
-                LOG.debug("after");
-            }
-        });
-        thread.start();
-        LOG.debug("thread started");
-        Thread.sleep(100);
-        LOG.debug("testing wakeup");
-        Assert.assertTrue(backoff.wakeup(thread.getName()));
-    }
-}

Reply via email to