diff options
author | tian.ming@huawei.com <tian.ming@huawei.com> | 2016-09-10 12:41:16 +0800 |
---|---|---|
committer | tian.ming@huawei.com <tian.ming@huawei.com> | 2016-09-10 15:46:25 +0800 |
commit | 7476493080d6c7dc895f1eeda7d4781c8295b03f (patch) | |
tree | dcbbaa7f416fa7e2da285f60085bbb8dcbb331d2 /common-util/src/test/java | |
parent | fd23b5c6940b86e1f98742ea0537917d4266f0c9 (diff) |
Modify license information.
JIRA:https://jira.open-o.org/browse/OCS-46
Change-Id: Iff62c4f5a9f29e20ab6f54772f60b1ab7ea65b1a
Signed-off-by: tian.ming@huawei.com <tian.ming@huawei.com>
fix the build error.
Change-Id: Iecab881eaad2442d48da9a162f2207f742e6982c
Signed-off-by: tian.ming@huawei.com <tian.ming@huawei.com>
fix the build error.
Change-Id: Iecab881eaad2442d48da9a162f2207f742e6982c
Signed-off-by: tian.ming@huawei.com <tian.ming@huawei.com>
Diffstat (limited to 'common-util/src/test/java')
6 files changed, 151 insertions, 25 deletions
diff --git a/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java b/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java new file mode 100644 index 0000000..88f5ddd --- /dev/null +++ b/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java @@ -0,0 +1,66 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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.openo.baseservice.bus.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import javax.ws.rs.core.Response; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openo.baseservice.util.impl.SystemEnvVariablesDefImpl; + +import junit.framework.Assert; +import mockit.Mock; +import mockit.MockUp; + +public class TestRegisterService { + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + + } + + @Test + public void testregisterServce() throws IOException { + + File file = new File(""); + Response res = null; + + final String path = file.getAbsolutePath(); + + new MockUp<SystemEnvVariablesDefImpl>() { + @Mock + public String getAppRoot() { + return path; + } + }; + + try { + res = RegisterService.registerService(path, true); + } catch(Exception e) { + Assert.assertNotNull(e); + } + + } +} + diff --git a/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java b/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java new file mode 100644 index 0000000..429d986 --- /dev/null +++ b/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java @@ -0,0 +1,60 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * Licensed 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.openo.baseservice.bus.util; + +import java.io.File; + +import javax.servlet.ServletContextEvent; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import mockit.Mock; +import mockit.MockUp; + +public class TestRegisterServiceListener { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + + } + + @Test + public void testRegisterServiceListener() { + + RegisterServiceListener impl = new RegisterServiceListener(); + + ServletContextEvent sce = null; + + new MockUp<File>() { + @Mock + public File[] listFiles() { + File file = new File(""); + File[] filelist = new File[]{file}; + return filelist; + } + + }; + + impl.contextInitialized(sce); + } + +} diff --git a/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java b/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java index 3241b14..c66e36a 100644 --- a/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java +++ b/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * Copyright 2016 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ import mockit.NonStrictExpectations; * </p> * * @author - * @version SDNO 0.5 02-Jun-2016 + * @version 02-Jun-2016 */ public class AesCipherTest { @@ -47,7 +47,7 @@ public class AesCipherTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -58,7 +58,7 @@ public class AesCipherTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @AfterClass public static void tearDownAfterClass() throws Exception { @@ -68,7 +68,7 @@ public class AesCipherTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @Before public void setUp() throws Exception { @@ -78,7 +78,7 @@ public class AesCipherTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @After public void tearDown() throws Exception { @@ -157,7 +157,7 @@ public class AesCipherTest { /** * <br/> * - * @since SDNO 0.5 + * @since */ @Test public void testCipherManagerImplStringDiffKey() { @@ -185,7 +185,7 @@ public class AesCipherTest { final AbstractCipher cipherManager = CipherCreator.instance().create("secret-key"); final String encrypted = cipherManager.encrypt("test-encrypt"); - Assert.assertEquals(encrypted, encrypted); + Assert.assertEquals(encrypted, null); } diff --git a/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java b/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java index 30a640e..f7eaf23 100644 --- a/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java +++ b/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * Copyright 2016 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ import mockit.integration.junit4.JMockit; * </p> * * @author - * @version SDNO 0.5 03-Jun-2016 + * @version 03-Jun-2016 */ @RunWith(JMockit.class) public class Sha256Test { @@ -51,7 +51,7 @@ public class Sha256Test { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -61,7 +61,7 @@ public class Sha256Test { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @AfterClass public static void tearDownAfterClass() throws Exception { @@ -71,7 +71,7 @@ public class Sha256Test { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @Before public void setUp() throws Exception { @@ -81,7 +81,7 @@ public class Sha256Test { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @After public void tearDown() throws Exception { diff --git a/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java b/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java index 2cf0589..56b6eee 100644 --- a/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java +++ b/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * Copyright 2016 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ import mockit.integration.junit4.JMockit; * </p> * * @author - * @version SDNO 0.5 08-Jun-2016 + * @version 08-Jun-2016 */ @RunWith(JMockit.class) public class RestUtilsTest { @@ -51,7 +51,7 @@ public class RestUtilsTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -61,7 +61,7 @@ public class RestUtilsTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @AfterClass public static void tearDownAfterClass() throws Exception { @@ -71,7 +71,7 @@ public class RestUtilsTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @Before public void setUp() throws Exception { @@ -81,7 +81,7 @@ public class RestUtilsTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @After public void tearDown() throws Exception { diff --git a/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java b/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java index 97a8d11..83414a2 100644 --- a/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java +++ b/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Huawei Technologies Co., Ltd. + * Copyright 2016 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ import net.jcip.annotations.NotThreadSafe; * </p> * * @author - * @version SDNO 0.5 08-Jun-2016 + * @version 08-Jun-2016 */ @RunWith(JMockit.class) @NotThreadSafe @@ -47,7 +47,7 @@ public class SystemEnvVariablesDefImplTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -57,7 +57,7 @@ public class SystemEnvVariablesDefImplTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @AfterClass public static void tearDownAfterClass() throws Exception { @@ -67,7 +67,7 @@ public class SystemEnvVariablesDefImplTest { * <br/> * * @throws java.lang.Exception - * @since SDNO 0.5 + * @since */ @Before public void setUp() throws Exception { |