AT&T 2.0.19 Code drop, stage 4
[aaf/authz.git] / authz-core / src / test / java / org / onap / aaf / cssa / rserv / test / JU_Content.java
diff --git a/authz-core/src/test/java/org/onap/aaf/cssa/rserv/test/JU_Content.java b/authz-core/src/test/java/org/onap/aaf/cssa/rserv/test/JU_Content.java
deleted file mode 100644 (file)
index 4fba0a3..0000000
+++ /dev/null
@@ -1,132 +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.cssa.rserv.test;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertNotNull;\r
-import static org.junit.Assert.assertNull;\r
-\r
-import java.io.IOException;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.junit.Test;\r
-import org.onap.aaf.cssa.rserv.HttpCode;\r
-import org.onap.aaf.cssa.rserv.TypedCode;\r
-\r
-import org.onap.aaf.inno.env.TransJAXB;\r
-import org.onap.aaf.inno.env.impl.EnvFactory;\r
-\r
-\r
-/**\r
- * Test the functioning of the "Content" class, which holds, and routes to the right code based on Accept values\r
- */\r
-public class JU_Content {\r
-       \r
-\r
-       @Test\r
-       public void test() throws Exception {\r
-               final String BOOL = "Boolean";\r
-               final String XML = "XML";\r
-               TransJAXB trans = EnvFactory.newTrans();\r
-               try {\r
-               HttpCode<TransJAXB, String> cBool = new HttpCode<TransJAXB,String>(BOOL,"Standard String") {\r
-                       @Override\r
-                       public void handle(TransJAXB trans, HttpServletRequest req, HttpServletResponse resp) {\r
-                               try {\r
-                                       resp.getOutputStream().write(context.getBytes());\r
-                               } catch (IOException e) {\r
-                               }\r
-                       }\r
-               };\r
-\r
-               HttpCode<TransJAXB,String> cXML = new HttpCode<TransJAXB,String>(XML, "Standard String") {\r
-                       @Override\r
-                       public void handle(TransJAXB trans, HttpServletRequest req, HttpServletResponse resp) {\r
-                               try {\r
-                                       resp.getOutputStream().write(context.getBytes());\r
-                               } catch (IOException e) {\r
-                               }\r
-                       }\r
-               };\r
-\r
-               TypedCode<TransJAXB> ct = new TypedCode<TransJAXB>()\r
-                               .add(cBool,"application/" + Boolean.class.getName()+"+xml;charset=utf8;version=1.1")\r
-                               .add(cXML,"application/xml;q=.9");\r
-               String expected = "application/java.lang.Boolean+xml;charset=utf8;version=1.1,application/xml;q=0.9";\r
-               assertEquals(expected,ct.toString());\r
-\r
-               //BogusReq req = new BogusReq();\r
-               //expected = (expected);\r
-               //HttpServletResponse resp = new BogusResp();\r
-               \r
-               assertNotNull("Same Content String and Accept String",ct.prep(trans,expected));\r
-\r
-               //expects Null (not run)\r
-               // A Boolean xml that must have charset utf8 and match version 1.2 or greater\r
-               expected = ("application/java.lang.Boolean+xml;charset=utf8;version=1.2");\r
-               assertNull("Accept Minor Version greater than Content Minor Version",ct.prep(trans,expected));\r
-\r
-               // Same with (too many) spaces\r
-               expected = (" application/java.lang.Boolean+xml ; charset = utf8 ; version = 1.2   ");\r
-               assertNull("Accept Minor Version greater than Content Minor Version",ct.prep(trans,expected));\r
-\r
-               //expects Null (not run)\r
-               expected = ("application/java.lang.Boolean+xml;charset=utf8;version=2.1");\r
-               assertNull("Major Versions not the same",ct.prep(trans,expected));\r
-\r
-               expected = ("application/java.lang.Boolean+xml;charset=utf8;version=1.0");\r
-               assertNotNull("Content Minor Version is greater than Accept Minor Version",ct.prep(trans,expected));\r
-\r
-               expected = "application/java.lang.Squid+xml;charset=utf8;version=1.0,application/xml;q=.9";\r
-               assertNotNull("2nd one will have to do...",ct.prep(trans,expected));\r
-\r
-               expected = "application/java.lang.Boolean+xml;charset=UTF8;version=1.0";\r
-               assertNotNull("Minor Charset in Caps acceptable",ct.prep(trans,expected));\r
-\r
-               // expects no run \r
-               expected="application/java.lang.Boolean+xml;charset=MyType;version=1.0";\r
-               assertNull("Unknown Minor Charset",ct.prep(trans,expected));\r
-\r
-               expected="";\r
-               assertNotNull("Blank Acceptance",ct.prep(trans,expected));\r
-               \r
-               expected=null;\r
-               assertNotNull("Null Acceptance",ct.prep(trans,expected));       \r
-\r
-               expected = ("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");\r
-               assertNotNull("Matches application/xml, and other content not known",ct.prep(trans,expected));\r
-               \r
-               // No SemiColon\r
-               expected = ("i/am/bogus,application/xml");\r
-               assertNotNull("Match second entry, with no Semis",ct.prep(trans,expected));\r
-\r
-               } finally {     \r
-                       StringBuilder sb = new StringBuilder();\r
-                       trans.auditTrail(0, sb);\r
-                       System.out.println(sb);\r
-               }\r
-       }\r
-\r
-}\r