AT&T 2.0.19 Code drop, stage 4
[aaf/authz.git] / authz-cmd / src / test / java / org / onap / aaf / cmd / JU_AAFCli.java
diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java
deleted file mode 100644 (file)
index f005738..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- *  * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cmd;\r
-\r
-import static org.junit.Assert.assertFalse;\r
-import static org.junit.Assert.assertTrue;\r
-import static org.mockito.Mockito.mock;\r
-\r
-import java.io.IOException;\r
-import java.io.OutputStreamWriter;\r
-import java.net.HttpURLConnection;\r
-import java.security.GeneralSecurityException;\r
-\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-import org.onap.aaf.authz.env.AuthzEnv;\r
-import org.onap.aaf.cmd.AAFcli;\r
-import org.onap.aaf.cadi.CadiException;\r
-import org.onap.aaf.cadi.Locator;\r
-import org.onap.aaf.cadi.LocatorException;\r
-import org.onap.aaf.cadi.client.PropertyLocator;\r
-import org.onap.aaf.cadi.config.Config;\r
-import org.onap.aaf.cadi.config.SecurityInfo;\r
-import org.onap.aaf.cadi.http.HBasicAuthSS;\r
-import org.onap.aaf.cadi.http.HMangr;\r
-import org.onap.aaf.inno.env.APIException;\r
-\r
-@RunWith(MockitoJUnitRunner.class)\r
-public class JU_AAFCli {\r
-\r
-       private static AAFcli cli;\r
-       private static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF);\r
-\r
-       @BeforeClass\r
-       public static void setUp() throws Exception, Exception {\r
-               cli = getAAfCli();\r
-       }\r
-\r
-       @Test\r
-       public void eval() throws Exception {\r
-               assertTrue(cli.eval("#startswith"));\r
-       }\r
-\r
-       @Test\r
-       public void eval_empty() throws Exception {\r
-               assertTrue(cli.eval(""));\r
-       }\r
-\r
-       @Test\r
-       public void eval1() throws Exception {\r
-               assertTrue(cli.eval("@[123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval2() throws Exception {\r
-               assertFalse(cli.eval("as @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval3() throws Exception {\r
-               try {\r
-                       cli.eval("expect @[ 123");\r
-               } catch (Exception e) {\r
-                       // TODO Auto-generated catch block\r
-                       assertTrue(e instanceof CadiException);\r
-               }\r
-       }\r
-\r
-       public void eval31() throws Exception {\r
-               try {\r
-                       cli.eval("expect 1 @[ 123");\r
-               } catch (Exception e) {\r
-                       // TODO Auto-generated catch block\r
-                       assertTrue(e instanceof CadiException);\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void eval4() throws Exception {\r
-               try {\r
-                       cli.eval("sleep @[ 123");\r
-               } catch (Exception e) {\r
-                       assertTrue(e instanceof NumberFormatException);\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void eval41() throws Exception {\r
-               assertTrue(cli.eval("sleep 1 @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval5() throws Exception {\r
-               try {\r
-                       cli.eval("delay @[ 123");\r
-               } catch (Exception e) {\r
-                       assertTrue(e instanceof NumberFormatException);\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void eval51() throws Exception {\r
-               assertTrue(cli.eval("delay 1 @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval7() throws Exception {\r
-               assertFalse(cli.eval("exit @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval8() throws Exception {\r
-               assertTrue(cli.eval("REQUEST @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval9() throws Exception {\r
-               assertTrue(cli.eval("FORCE @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void eval10() throws Exception {\r
-               assertTrue(cli.eval("set @[ 123"));\r
-       }\r
-\r
-       @Test\r
-       public void keyboardHelp() throws Exception {\r
-               boolean noError=true;\r
-               try {\r
-                       cli.keyboardHelp();\r
-               } catch (Exception e) {\r
-                       noError=false;\r
-               }\r
-               assertTrue(noError);\r
-       }\r
-       \r
-\r
-       \r
-       @Test\r
-       public void setProp() throws Exception {\r
-               boolean noError=true;\r
-               try {\r
-                       cli.keyboardHelp();\r
-               } catch (Exception e) {\r
-                       noError=false;\r
-               }\r
-               assertTrue(noError);\r
-       }\r
-       \r
-       @Test\r
-       public void eval_randomString() throws Exception {\r
-               assertTrue(cli.eval("Some random string @#&*& to check complete 100 coverage"));\r
-       }\r
-\r
-       public static AAFcli getAAfCli() throws APIException, LocatorException, GeneralSecurityException, IOException {\r
-               final AuthzEnv env = new AuthzEnv(System.getProperties());\r
-               String aafUrl = "https://DME2RESOLVE";\r
-               SecurityInfo si = new SecurityInfo(env);\r
-               env.loadToSystemPropsStartsWith("AAF", "DME2");\r
-               Locator loc;\r
-               loc = new PropertyLocator(aafUrl);\r
-               TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));\r
-               HMangr hman = new HMangr(env, loc).readTimeout(TIMEOUT).apiVersion("2.0");\r
-\r
-               // TODO: Consider requiring a default in properties\r
-               env.setProperty(Config.AAF_DEFAULT_REALM,\r
-                               System.getProperty(Config.AAF_DEFAULT_REALM, Config.getDefaultRealm()));\r
-               HBasicAuthSS ss = mock(HBasicAuthSS.class);\r
-               return new AAFcli(env, new OutputStreamWriter(System.out), hman, si, ss);\r
-       }\r
-}\r