aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-fe/src/test/java
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-05-07 19:58:23 +0300
committerMichael Lando <ml636r@att.com>2018-05-10 08:59:21 +0000
commitaa1ce0df9b42a352406112825642d68b27d17ea0 (patch)
tree920ce9bd0f341043504f490c6105251043cb89ad /catalog-fe/src/test/java
parentf8694841d586cfb44c69a602d76bf19d1491e65a (diff)
Raise JUnit coverage catalog-fe
Change-Id: I88f1f16259660c0ded48b93ca729d220d18cda6b Issue-ID: SDC-1306 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-fe/src/test/java')
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/HttpRequestInfoTest.java436
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/ImportMetadataTest.java110
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/mdc/MdcDataTest.java60
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/utils/BeProtocolTest.java20
4 files changed, 626 insertions, 0 deletions
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/HttpRequestInfoTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/HttpRequestInfoTest.java
new file mode 100644
index 0000000000..dd03cf6091
--- /dev/null
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/HttpRequestInfoTest.java
@@ -0,0 +1,436 @@
+package org.openecomp.sdc.fe.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.junit.Test;
+
+public class HttpRequestInfoTest {
+
+ private HttpRequestInfo createTestSubject() {
+ return new HttpRequestInfo(new HttpServletRequestTest(), null, "");
+ }
+
+ @Test
+ public void testGetHeaders() throws Exception {
+ HttpRequestInfo testSubject;
+ Map<String, String> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getHeaders();
+ }
+
+ @Test
+ public void testSetHeaders() throws Exception {
+ HttpRequestInfo testSubject;
+ Map<String, String> headers = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setHeaders(headers);
+ }
+
+ @Test
+ public void testGetRequestURL() throws Exception {
+ HttpRequestInfo testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRequestURL();
+ }
+
+ @Test
+ public void testSetRequestURL() throws Exception {
+ HttpRequestInfo testSubject;
+ String requestURL = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setRequestURL(requestURL);
+ }
+
+ @Test
+ public void testGetRequestData() throws Exception {
+ HttpRequestInfo testSubject;
+ InputStream result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRequestData();
+ }
+
+ @Test
+ public void testSetRequestData() throws Exception {
+ HttpRequestInfo testSubject;
+ InputStream requestData = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setRequestData(requestData);
+ }
+
+ @Test
+ public void testGetOriginServletContext() throws Exception {
+ HttpRequestInfo testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOriginServletContext();
+ }
+
+ @Test
+ public void testSetOriginServletContext() throws Exception {
+ HttpRequestInfo testSubject;
+ String originServletContext = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOriginServletContext(originServletContext);
+ }
+
+ private class HttpServletRequestTest implements HttpServletRequest{
+
+ private HttpServletRequestTest() {
+
+ }
+ @Override
+ public Object getAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getAttributeNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getContentLength() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getContentType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getParameter(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getParameterNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map getParameterMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getProtocol() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getScheme() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServerName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getServerPort() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public BufferedReader getReader() throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRemoteAddr() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRemoteHost() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String name, Object o) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Locale getLocale() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getLocales() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isSecure() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public RequestDispatcher getRequestDispatcher(String path) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRealPath(String path) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getRemotePort() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getLocalName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getLocalAddr() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getLocalPort() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getAuthType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Cookie[] getCookies() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getDateHeader(String name) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getHeader(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaders(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Enumeration getHeaderNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getIntHeader(String name) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getMethod() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getPathInfo() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getPathTranslated() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getContextPath() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getQueryString() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRemoteUser() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isUserInRole(String role) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Principal getUserPrincipal() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRequestedSessionId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getRequestURI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public StringBuffer getRequestURL() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServletPath() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession(boolean create) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HttpSession getSession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdValid() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromCookie() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromURL() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRequestedSessionIdFromUrl() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/ImportMetadataTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/ImportMetadataTest.java
new file mode 100644
index 0000000000..54e0392c75
--- /dev/null
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/impl/ImportMetadataTest.java
@@ -0,0 +1,110 @@
+package org.openecomp.sdc.fe.impl;
+
+import org.junit.Test;
+
+public class ImportMetadataTest {
+
+ private ImportMetadata createTestSubject() {
+ return new ImportMetadata("", 1234567, "", "", "");
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ ImportMetadata testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getName();
+ }
+
+ @Test
+ public void testSetName() throws Exception {
+ ImportMetadata testSubject;
+ String name = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setName(name);
+ }
+
+ @Test
+ public void testGetSize() throws Exception {
+ ImportMetadata testSubject;
+ long result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getSize();
+ }
+
+ @Test
+ public void testSetSize() throws Exception {
+ ImportMetadata testSubject;
+ long size = 1234567;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setSize(size);
+ }
+
+ @Test
+ public void testGetMime() throws Exception {
+ ImportMetadata testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getMime();
+ }
+
+ @Test
+ public void testSetMime() throws Exception {
+ ImportMetadata testSubject;
+ String mime = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setMime(mime);
+ }
+
+ @Test
+ public void testGetCreator() throws Exception {
+ ImportMetadata testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getCreator();
+ }
+
+ @Test
+ public void testSetCreator() throws Exception {
+ ImportMetadata testSubject;
+ String creator = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setCreator(creator);
+ }
+
+ @Test
+ public void testGetMd5Checksum() throws Exception {
+ ImportMetadata testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getMd5Checksum();
+ }
+
+ @Test
+ public void testSetMd5Checksum() throws Exception {
+ ImportMetadata testSubject;
+ String md5Checksum = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setMd5Checksum(md5Checksum);
+ }
+} \ No newline at end of file
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/mdc/MdcDataTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/mdc/MdcDataTest.java
new file mode 100644
index 0000000000..d9414315e5
--- /dev/null
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/mdc/MdcDataTest.java
@@ -0,0 +1,60 @@
+package org.openecomp.sdc.fe.mdc;
+
+import org.junit.Test;
+
+public class MdcDataTest {
+
+ private MdcData createTestSubject() {
+ return new MdcData("", "", "", "", null);
+ }
+
+ @Test
+ public void testGetTransactionStartTime() throws Exception {
+ MdcData testSubject;
+ Long result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getTransactionStartTime();
+ }
+
+ @Test
+ public void testGetUserId() throws Exception {
+ MdcData testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getUserId();
+ }
+
+ @Test
+ public void testGetRemoteAddr() throws Exception {
+ MdcData testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRemoteAddr();
+ }
+
+ @Test
+ public void testGetLocalAddr() throws Exception {
+ MdcData testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getLocalAddr();
+ }
+
+ @Test
+ public void testGetServiceInstanceID() throws Exception {
+ MdcData testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceInstanceID();
+ }
+} \ No newline at end of file
diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/utils/BeProtocolTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/utils/BeProtocolTest.java
new file mode 100644
index 0000000000..7899996ffe
--- /dev/null
+++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/utils/BeProtocolTest.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdc.fe.utils;
+
+import org.junit.Test;
+
+public class BeProtocolTest {
+
+ private BeProtocol createTestSubject() {
+ return BeProtocol.HTTP;
+ }
+
+ @Test
+ public void testGetProtocolName() throws Exception {
+ BeProtocol testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getProtocolName();
+ }
+} \ No newline at end of file