X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Floader%2Fimpl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fdlux%2Floader%2FDluxLoaderIndexServletTest.java;fp=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Floader%2Fimpl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fdlux%2Floader%2FDluxLoaderIndexServletTest.java;h=eb1c9055cbe5f4baa0ca20c82a6dba8df8b346cc;hb=27fb2d06608fbb070ae2c15a5580a4f5b2423d15;hp=0000000000000000000000000000000000000000;hpb=60315525ab5e7c12a9f47c409092e8dba6ad656d;p=ccsdk%2Fapps.git diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/loader/impl/src/test/java/org/opendaylight/dlux/loader/DluxLoaderIndexServletTest.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/loader/impl/src/test/java/org/opendaylight/dlux/loader/DluxLoaderIndexServletTest.java new file mode 100644 index 00000000..eb1c9055 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/loader/impl/src/test/java/org/opendaylight/dlux/loader/DluxLoaderIndexServletTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.dlux.loader; + +import org.junit.Test; +import org.junit.Assert; +import org.opendaylight.dlux.loader.exception.DluxLoaderException; +import org.opendaylight.dlux.loader.implementation.DluxLoader; +import org.opendaylight.dlux.loader.implementation.DluxLoaderIndexServlet; + +import java.util.List; +import java.util.Properties; + + +public class DluxLoaderIndexServletTest { + + private DluxLoader dluxLoader = new DluxLoader(); + + @Test + public void testLoadModulePropertyFile() throws DluxLoaderException { + + DluxLoaderIndexServlet indexServlet = new DluxLoaderIndexServlet(dluxLoader); + Properties properties = indexServlet.getProp(); + String defineJS = properties.getProperty("defineJS"); + Assert.assertNotNull(defineJS); + Assert.assertTrue(defineJS.contains("'angular',")); + String requireJS = properties.getProperty("requireJS"); + Assert.assertNotNull(requireJS); + Assert.assertTrue(requireJS.contains("common/config/env.module")); + String angularJS = properties.getProperty("angularJS"); + Assert.assertNotNull(angularJS); + Assert.assertTrue(angularJS.contains("'ui.router',")); + } + + @Test + public void testLoadIndexHTML() throws DluxLoaderException { + DluxLoaderIndexServlet indexServlet = new DluxLoaderIndexServlet(dluxLoader); + List indexHTML = indexServlet.getIndexHTML(); + Properties properties = indexServlet.getProp(); + + String jsReplace = properties.getProperty("javascriptReplaceString"); + String cssReplace = properties.getProperty("cssReplaceString"); + + boolean containsJSReplace = false; + boolean containsCssReplace = false; + + for(String line : indexHTML) { + if(line.contains(jsReplace)) { + containsJSReplace = true; + } + + if(line.contains(cssReplace)) { + containsCssReplace = true; + } + } + + Assert.assertTrue(containsCssReplace); + Assert.assertTrue(containsJSReplace); + } + +}