X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fmessagebus-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmessagebus%2Fapp%2Fimpl%2FUtilTest.java;h=a88c609a263317deb9ed4906893150f52390a219;hp=2ff4654155402231c43e1722374ee7fa0088b452;hb=08631886ab131bdd74a8364c894792a9ef7253e8;hpb=e631dc96f0461b2270377dc072b9f969a875667a diff --git a/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/UtilTest.java b/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/UtilTest.java index 2ff4654155..a88c609a26 100644 --- a/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/UtilTest.java +++ b/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/UtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -19,32 +19,12 @@ import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.model.api.SchemaPath; - +/** + * @author ppalmar + * + */ public class UtilTest { - @Test - public void testMD5Hash() throws Exception { - // empty string - createAndAssertHash("", "d41d8cd98f00b204e9800998ecf8427e"); - - // non-empty string - createAndAssertHash("The Guardian", "69b929ae473ed732d5fb8e0a55a8dc8d"); - - // the same hash for the same string - createAndAssertHash("The Independent", "db793706d70c37dcc16454fa8eb21b1c"); - createAndAssertHash("The Independent", "db793706d70c37dcc16454fa8eb21b1c"); // one more time - - // different strings must have different hashes - createAndAssertHash("orange", "fe01d67a002dfa0f3ac084298142eccd"); - createAndAssertHash("yellow", "d487dd0b55dfcacdd920ccbdaeafa351"); - } - - //TODO: IllegalArgumentException would be better - @Test(expected = RuntimeException.class) - public void testMD5HashInvalidInput() throws Exception { - Util.md5String(null); - } - @Test public void testWildcardToRegex() throws Exception { // empty wildcard string @@ -73,14 +53,14 @@ public class UtilTest { public void testResultFor() throws Exception { { final String expectedResult = "dummy string"; - RpcResult rpcResult = Util.resultFor(expectedResult).get(); + RpcResult rpcResult = Util.resultRpcSuccessFor(expectedResult).get(); assertEquals(expectedResult, rpcResult.getResult()); assertTrue(rpcResult.isSuccessful()); assertTrue(rpcResult.getErrors().isEmpty()); } { final Integer expectedResult = 42; - RpcResult rpcResult = Util.resultFor(expectedResult).get(); + RpcResult rpcResult = Util.resultRpcSuccessFor(expectedResult).get(); assertEquals(expectedResult, rpcResult.getResult()); assertTrue(rpcResult.isSuccessful()); assertTrue(rpcResult.getErrors().isEmpty()); @@ -125,10 +105,6 @@ public class UtilTest { } } - private static void createAndAssertHash(final String inString, final String expectedHash) { - assertEquals("Incorrect hash.", expectedHash, Util.md5String(inString)); - } - private static void createAndAssertRegex(final String wildcardStr, final String expectedRegex) { assertEquals("Incorrect regex string.", expectedRegex, Util.wildcardToRegex(wildcardStr)); }