1 package org.onap.portalapp.portal.framework;
 
   3  * ============LICENSE_START==========================================
 
   5  * ===================================================================
 
   6  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 
   7  * ===================================================================
 
   9  * Unless otherwise specified, all software contained herein is licensed
 
  10  * under the Apache License, Version 2.0 (the "License");
 
  11  * you may not use this software except in compliance with the License.
 
  12  * You may obtain a copy of the License at
 
  14  *             http://www.apache.org/licenses/LICENSE-2.0
 
  16  * Unless required by applicable law or agreed to in writing, software
 
  17  * distributed under the License is distributed on an "AS IS" BASIS,
 
  18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  19  * See the License for the specific language governing permissions and
 
  20  * limitations under the License.
 
  22  * Unless otherwise specified, all documentation contained herein is licensed
 
  23  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
 
  24  * you may not use this documentation except in compliance with the License.
 
  25  * You may obtain a copy of the License at
 
  27  *             https://creativecommons.org/licenses/by/4.0/
 
  29  * Unless required by applicable law or agreed to in writing, documentation
 
  30  * distributed under the License is distributed on an "AS IS" BASIS,
 
  31  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  32  * See the License for the specific language governing permissions and
 
  33  * limitations under the License.
 
  35  * ============LICENSE_END============================================
 
  37  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
 
  39 //package org.onap.portalapp.portal.framework;
 
  41 //import java.io.IOException;
 
  43 //import org.junit.Before;
 
  44 //import org.junit.runner.RunWith;
 
  45 //import org.onap.portalsdk.core.conf.AppConfig;
 
  46 ////import org.onap.portalapp.conf.ExternalAppConfig;
 
  47 ////import org.onap.portalapp.conf.HibernateMappingLocations;
 
  48 //import org.onap.portalsdk.core.conf.HibernateConfiguration;
 
  49 //import org.onap.portalsdk.core.conf.HibernateMappingLocatable;
 
  50 //import org.onap.portalsdk.core.objectcache.AbstractCacheManager;
 
  51 //import org.onap.portalsdk.core.util.CacheManager;
 
  52 //import org.onap.portalsdk.core.util.SystemProperties;
 
  53 //import org.springframework.beans.factory.annotation.Autowired;
 
  54 //import org.springframework.context.annotation.Bean;
 
  55 //import org.springframework.context.annotation.ComponentScan;
 
  56 //import org.springframework.context.annotation.Configuration;
 
  57 //import org.springframework.context.annotation.FilterType;
 
  58 //import org.springframework.context.annotation.Profile;
 
  59 //import org.springframework.core.io.ClassPathResource;
 
  60 //import org.springframework.core.io.Resource;
 
  61 //import org.springframework.test.context.ActiveProfiles;
 
  62 //import org.springframework.test.context.ContextConfiguration;
 
  63 //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
  64 //import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
 
  65 //import org.springframework.test.context.web.WebAppConfiguration;
 
  66 //import org.springframework.test.web.servlet.MockMvc;
 
  67 //import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 
  68 //import org.springframework.web.context.WebApplicationContext;
 
  69 //import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 
  73 // * In order to write a unit test, 1. inherit this class 2. place the "war"
 
  74 // * folder on your test class's classpath 3. run the test with the following VM
 
  75 // * argument; This is important because when starting the application from
 
  76 // * Container, the System Properties file (SystemProperties.java) can have the
 
  77 // * direct path but, when running from the Mock Junit container, the path should
 
  78 // * be prefixed with "classpath" to enable the mock container to search for the
 
  79 // * file in the classpath -Dcontainer.classpath="classpath:"
 
  82 //@SuppressWarnings("deprecation")
 
  83 //@RunWith(SpringJUnit4ClassRunner.class)
 
  84 //@WebAppConfiguration
 
  85 //@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class })
 
  86 //@ActiveProfiles(value = "test")
 
  87 //public class ApplicationCommonContextTestSuite {
 
  90 //      public WebApplicationContext wac;
 
  92 //      private MockMvc mockMvc;
 
  95 //      public void setup() {
 
  96 //              if (mockMvc == null) {
 
  97 //                      this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
 
 102 //      public Object getBean(String name) {
 
 103 //              return this.wac.getBean(name);
 
 106 //      public MockMvc getMockMvc() {
 
 110 //      public void setMockMvc(MockMvc mockMvc) {
 
 111 //              this.mockMvc = mockMvc;
 
 114 //      public WebApplicationContext getWebApplicationContext() {
 
 121 //@ComponentScan(basePackages = "org.onap", excludeFilters = {
 
 122 //              // the following source configurations should not be scanned; instead of
 
 123 //              // using Exclusion filter, we can use the @Profile annotation to exclude
 
 125 //              @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.onap.portalsdk.core.controller.LogoutController*"),
 
 126 //              @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.onap.portalsdk.core.controller.SDKLoginController*"),
 
 127 //              @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.onap.portalapp.conf.ExternalAppConfig*"),
 
 128 //              @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.onap.*.*InitUebHandler*") })
 
 130 //class MockAppConfig extends AppConfig {
 
 133 //      HibernateMappingLocatable locatable() {
 
 134 //              return new MockHibernateMappingLocations();
 
 138 //      HibernateConfiguration hibConfiguration() {
 
 139 //              return new HibernateConfiguration();
 
 143 //      public SystemProperties systemProperties() {
 
 144 //              return new MockSystemProperties();
 
 148 //      public AbstractCacheManager cacheManager() {
 
 149 //              return new CacheManager() {
 
 151 //                      public void configure() throws IOException {
 
 157 //      public String[] tileDefinitions() {
 
 158 //              return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml",
 
 159 //                              "classpath:/WEB-INF/defs/definitions.xml" };
 
 162 //      public void addInterceptors(InterceptorRegistry registry) {
 
 163 //              // registry.addInterceptor(new
 
 164 //              // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
 
 165 //              // registry.addInterceptor(resourceInterceptor());
 
 168 //      public static class MockSystemProperties extends SystemProperties {
 
 170 //              public MockSystemProperties() {
 
 178 //class MockHibernateMappingLocations implements HibernateMappingLocatable {
 
 180 //      public Resource[] getMappingLocations() {
 
 181 //              return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"),
 
 182 //                              new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"),
 
 183 //                              new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") };
 
 187 //      public String[] getPackagesToScan() {
 
 188 //              return new String[] { "org.onap", "src" };