156 Commits

Author SHA1 Message Date
Laszlo Hornyak
d1dd85a4c4 ReflectUtil: test for getAllFieldsForClass
- code comment turned to javadoc
- added braces to if and for statements to make it look more like the rest
- tests added

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-10-09 20:39:41 +02:00
Laszlo Hornyak
826c69fd29 ConstantTimeBackoff test and cleanup
- javadoc changed - the old one was copy-pasted from AgentShell
- start and stop method removed - they did the same as the overridden methods
- _counter removed as it was only written, but never read
- remove from _asleep map was moved to a finally block, to make sure it is removed even in case of the thread gets interrupted
- Tests created for the above scenarios.

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-10-04 11:24:43 -07:00
Laszlo Hornyak
b44bc9db02 NumbersUtil cleanup
- removed methods that were not used
- parseLong, parseInt and parseFloat replaced with the commons-lang NumberUtils call
- Test for the remaining methods

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
2013-10-02 10:55:00 +02:00
Darren Shepherd
cba8e40e4b Add license headers to fix build 2013-09-30 09:51:45 -07:00
Laszlo Hornyak
13e7a7308b Test for URLEncoder
- test added
- source formatted

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-09-30 15:03:12 +02:00
Daan Hoogland
5338aaa39f use locale when formatting numbers 2013-09-24 15:53:32 +02:00
Hugo Trippaers
5ada5e88f3 This test appears to be locale sensitive, so fix the locale in the test 2013-09-24 18:30:00 +08:00
Hugo Trippaers
8b6dcf8b6e Clean out a few warnings on potential resource leakage 2013-09-21 15:32:52 +08:00
Wei Zhou
eb59c3c601 CLOUDSTACK-4314: fix dir error in ProcessUtil.pidCheck and Revert commit 9375aa9467c3855f28c6753d1eb4932a6f1a0e6f 2013-08-14 09:41:13 +02:00
Wei Zhou
9375aa9467 fix build failure with master branch for ProcessUtilTest 2013-08-13 23:22:21 +02:00
Hugo Trippaers
d57796b94f Fix XML validation errors 2013-08-13 08:25:45 +02:00
frank
ed97a03762 add license header to ProcessUtilTest.java 2013-08-12 18:08:20 -07:00
Laszlo Hornyak
f081092b80 ProcessUtil cleanup
- possible resource leak closed
- file content read uses now commons-lang FileUtils
- Added unit tests
2013-08-12 14:50:09 -07:00
John Burwell
1ae682de78 - CLOUDSTACK-3229: Properly serialize the https property to the s3Xen
plugin
  - Extracts the duplicated serializeProperties methods to
    ReflectUtils#flattenProperties
  - Adds unit tests for ReflectUtils#flattenProperties
2013-08-01 00:14:43 -04:00
Alex Huang
f5e5b39c9b Moved the DB layer code into framework-db and change only the necessary projects to refer to it. Cut down on the dependencies introduced with all the code in utils. 2013-07-26 15:02:10 -07:00
Prasanna Santhanam
2c5388afac For some reason cat is under /bin on some linuses
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit b8129d6a8e6634f6a101e09d8f0a9620a2379d67)
2013-07-25 19:18:21 +05:30
Laszlo Hornyak
76e283687f test for Script
a unit test for the most frequently used methods in the Script class

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-07-25 16:46:10 +05:30
Min Chen
d423a755f5 CLOUDSTACK-3274: API Refactoring: secretkey and accesskey of the backing
store is found in plaintext in the logs.

Conflicts:
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/api/ApiServlet.java
2013-07-20 18:01:49 -07:00
Alex Huang
b18c72626b Moved the SprintUtils which is for testing only to be in test directory. Changed pom.xml for different projects to use the utils test-jar. Removed some @Component annotations. Moved majority of the dependencies from cloudstack pom to utils pom 2013-07-18 21:53:51 -07:00
Prasanna Santhanam
168fb29d69 add some logging to NioTest
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-06-19 09:28:16 +05:30
Laszlo Hornyak
c88d8fb3a2 use commons-lang StringUtils
commons-lang is already a transitive dependency of the utils project, which allows removing some duplicated functionality.
This patch replaces StringUtils.join(String, Object...) with it's commons-lang counterpart.
It also replaces calls to String join(Iterable<? extends Object>, String) in cases where an array is already exist and it is only wrapped into a List.

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-06-17 19:17:22 +01:00
Laszlo Hornyak
564013bec0 String instantiation is not needed
Removed a String instntiation, test case added

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-06-17 19:17:22 +01:00
Hugo Trippaers
b0ea02e65a Allow DSA public keys.
DSA can't be used for encryption with the bouncycastle library, so make
sure this situation is properly handled.
2013-06-17 10:04:59 -07:00
Sheng Yang
fbe6b273e3 CLOUDSTACK-1170: Redundant Router: Ensure MACs are same on other than first public nic 2013-06-13 16:05:15 -07:00
Chiradeep Vittal
971c40d98e Fix RAT check broken by a1a68ed0c4b722 2013-06-10 20:38:24 -07:00
Alex Huang
a1a68ed0c4 Review 11752 applied 2013-06-10 16:07:05 -07:00
Saksham Srivastava
5dc7387d3b CLOUDSTACK-1647: IP Reservation should not happen if the guest-vm cidr and network cidr is not same but their start ip and end ip are same.
Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>
2013-06-07 16:54:40 +05:30
Sheng Yang
9c9e2ec9cc PVLAN: Add pvlan in createNetworkCommand 2013-05-01 13:23:08 -07:00
Brian Spindler
469c4dd139 Removing ^M's from code.
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-04-04 00:53:20 +05:30
Kelven Yang
3ab744d100 CLOUDSTACK-1795: implement custom AOP to fully support legacy CloudStack AOP semantcis
Signed-off-by: Chip Childers <chip.childers@gmail.com>
2013-03-29 11:12:36 -07:00
Kelven Yang
0b84958a66 Fix an out-dated unit test assertion 2013-03-05 19:47:37 -05:00
Sheng Yang
a0762bc4a7 CLOUDSTACK-1303: Fix NPE when extend vlan with ipv4 only 2013-02-21 18:02:50 -08:00
Min Chen
5147fb16ac CLOUDSTACK-1253: Remove @author tag. 2013-02-15 10:42:06 -08:00
Sheng Yang
fda8ec3c59 IPv6: CLOUDSTACK-1153: Fix integer overflow on IPv6 address calcuation
Use BigInteger, which is 128 bits long.
2013-02-05 17:41:37 -08:00
Sheng Yang
f89dd9050c IPv6: CLOUDSTACK-1113: Fix the mechanism to find the usable IP in the IPv6
The new policy is:
1. Generate a random IP.
2. Find the next available IP, start from the generated IP.
3. If we cannot find an available IP after certain times(10000 by default,
network.ipv6.search.retry.max) retry, give up.
2013-02-05 14:31:12 -08:00
Sheng Yang
2e236a8322 IPv6: Fix ip address in range check 2013-02-05 14:31:06 -08:00
Rohit Yadav
c9e764818b rat: Fix license headers on ucs plugin etc.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-02 08:57:16 -08:00
Kelven Yang
7bd8bec68a Sync javelin with master up to 894cb8f7d9fc8b5561754a9fa541fef8f235148a 2013-01-31 17:20:19 -08:00
frank
8416d81b99 Merge branch 'ucs' into javelin
Conflicts:
	api/src/org/apache/cloudstack/api/ApiConstants.java
	plugins/pom.xml
	utils/src/com/cloud/utils/exception/CloudRuntimeException.java
	utils/src/com/cloud/utils/exception/RuntimeCloudException.java
2013-01-31 14:44:07 -08:00
Sheng Yang
f9a68e7f15 IPv6: Add vlan overlap checking 2013-01-29 22:01:38 -08:00
Sheng Yang
0b62fc4c17 IPv6: Verify if requested IPv4/IPv6 addresses are valid
Also rename NetUtils.isValidIPv6() to NetUtils.isValidIpv6()
2013-01-29 19:08:09 -08:00
Sheng Yang
fa00ddf07e IPv6: Fix getIp6FromRange() 2013-01-27 19:07:44 -08:00
Sheng Yang
bd4bc025d1 IPv6: Accept IPv6 parameter for createNetworkCmd
Also ass public_ipv6_address for ipv6 address management.

Extend nics and vlans for ipv6 address.

Add dependency to com.googlecode.ipv6(java-ipv6).

Modify dhcpcommand for ipv6.
2013-01-26 23:14:15 -08:00
Alex Huang
1567a112fa unit test works again 2013-01-24 14:36:44 -08:00
Kelven Yang
2c5859dbd4 Bring javelin back to the status of being able to start System VMs after another round of master branch merge 2013-01-18 19:15:32 -08:00
frank
fb050894f5 CloudStack CLOUDSTACK-723
Enhanced baremetal servers support on Cisco UCS

able to dump xmlobject
2013-01-17 16:11:15 -08:00
Alex Huang
cbb7ff1c32 added missing files 2013-01-17 06:50:59 -08:00
Alex Huang
9759ad57f2 Commit the current changes to unit tests 2013-01-17 06:50:11 -08:00
frank
53473c07b9 CloudStack CLOUDSTACK-723
Enhanced baremetal servers support on Cisco UCS

introduce an python etree like xml helper.
Ok, this is not a new wheel. Frankly speaking, all Java XML API just suc**.
there are two popular types of XML API in java, one class is for data binding, JAXB,
XStream fall into this category. Another class is tree based, like JDOM, XOM ...

for XML api call, data binding library is painful as you have to specify the schema
that how xml stream converts to java object, which means you have to pre-define all
schemas(xsd file for JAXB, java object for XStream ...). This is not productive, because you
must add new schema when XML document grows.

Tree based library shines in this case, for it's able to dynamically create an object tree
from xml stream without any knowledge of its structure. However, all tree based
XML API library fall into below convention:

Element e = root.getChildElement("child1").getChildElement("child2").getChildElement("child3")...getChildElement("childN")

anything wrong with it???

the sadness is if there is no "child2", you will get a NPE with above code, which means you have to judge
before getting.

And, why so verbose?? why not:

Element e = root.child1.child2.child3...childN ???

Ok I am joking, it's impossible in Java the world knows Java is a static language.

but you can actually do:

Element e = root.get("child1.child2.child3");

or

List<Element> e = root.getAsList("child1.child2.child3")

this is known as XPath style(though XPATH use '/'), python etree has supported it.

so I did this toy for my UCS xml api call, it's quite like etree which is easy to use, for example:

<components.xml>
    <system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
        <checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
        <checker name="EncryptionSecretKeyChecker" class="com.cloud.utils.crypt.EncryptionSecretKeyChecker"/>
        <checker name="DatabaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker"/>
        <checker name="DatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
    </system-integrity-checker>
</components.xml>

XmlObject xo = XmlObjectParser.parseFromFile("~/components.xml.in");
List<XmlObject> checkers = xo.getAsList("system-integrity-checker.checker");

then you get a list of XmlObject which represent each 'checker' element:

XmlObject firstChecker = checkers.get(0);
// firstChecker.get("name") == "ManagementServerNode"
// firstChecker.get("class") == "com.cloud.cluster.ManagementServerNode"
// firstChecker.getTag() == "checker"
// firstChecker.getText() == "" if it's <checker/>xxx</checker>, then getText() == "xxx"

example 2:
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
    <system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
        <checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
    </system-integrity-checker>
</components.xml>

yout can do:

XmlObject xo = XmlObjectParser.parseFromFile("~/components.xml.in");
XmlObject checker = xo.get("system-integrity-checker.checker");

then it returns a single object as we only have one "checker" in xml stream,

or you still do

List<XmlObject> checkers = xo.getAsList("system-integrity-checker.checker");

it returns a list which only contains one element of "checker"

if you do:

XmlObject checker = xo.get("system-integrity-checker.checker.this_middle_element_doesnt_exist.some_element");

it returns a null without any exception, so you don't have to worry if a parent element is missing when getting a leaf element

again it's not a new wheel, I just hate JAVA xml api
2013-01-16 16:27:21 -08:00
Rohit Yadav
ea3f5ecb54 Fix license for xml files in javelin
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-12 06:31:47 -08:00