~ name pkg properly.

pull/1/head
Ivan Olexyn 5 years ago
parent 86f861dc52
commit 40d752b4ea

@ -0,0 +1,5 @@
#!/bin/bash
cp ./mispbridge.war /home/user/app/tomcat/webapps
cp ./mispclient.war /home/user/app/tomcat/webapps
/home/user/app/tomcat/bin/shutdown.sh
/home/user/app/tomcat/bin/startup.sh

@ -0,0 +1,21 @@
#!/bin/bash
cwd=$(pwd)
cp -r ./production/mispbridge/core/ mispbridge-war-wrapper/WEB-INF/classes
cd warbridge
jar -cvf ../mispbridge.war *
cd $cwd
cp -r ./production/mispclient/core/ mispclient-war-wrapper/WEB-INF/classes
cd warclient
jar -cvf ../mispclient.war *

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,25 @@
<html>
<head>
<title>BridgeServlet</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td>
<img src="images/tomcat.gif">
</td>
<td>
<h1>BridgeServlet</h1>
</td>
</tr>
</table>
<ul>
<p>This Servlet currently provides the following features:
<!--<li>To a <a href="hello.jsp">JSP page</a>.-->
<li><a href="core">Tunnel</a> to hosted Application.
</ul>
</body>
</html>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/../out/production/mirror" />
<output-test url="file://$MODULE_DIR$/../out/test/mirror" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,4 @@
path.variable.kotlin_bundled=/home/user/app/intellij-idea/plugins/Kotlin/kotlinc
path.variable.maven_repository=/home/user/.m2/repository
jdk.home.11=/usr/lib/jvm/java-11-openjdk-amd64
javac2.instrumentation.includeJavaRuntime=false

@ -0,0 +1,482 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="misp" default="all">
<property file="misp.properties"/>
<!-- Uncomment the following property if no tests compilation is needed -->
<!--
<property name="skip.tests" value="true"/>
-->
<!-- Compiler options -->
<property name="compiler.debug" value="on"/>
<property name="compiler.generate.no.warnings" value="off"/>
<property name="compiler.args" value=""/>
<property name="compiler.max.memory" value="700m"/>
<patternset id="ignored.files">
<exclude name="**/*.hprof/**"/>
<exclude name="**/*.pyc/**"/>
<exclude name="**/*.pyo/**"/>
<exclude name="**/*.rbc/**"/>
<exclude name="**/*.yarb/**"/>
<exclude name="**/*~/**"/>
<exclude name="**/.DS_Store/**"/>
<exclude name="**/.git/**"/>
<exclude name="**/.hg/**"/>
<exclude name="**/.svn/**"/>
<exclude name="**/CVS/**"/>
<exclude name="**/__pycache__/**"/>
<exclude name="**/_svn/**"/>
<exclude name="**/vssver.scc/**"/>
<exclude name="**/vssver2.scc/**"/>
</patternset>
<patternset id="library.patterns">
<include name="*.war"/>
<include name="*.swc"/>
<include name="*.zip"/>
<include name="*.egg"/>
<include name="*.ane"/>
<include name="*.jar"/>
<include name="*.ear"/>
<include name="*.klib"/>
</patternset>
<patternset id="compiler.resources">
<exclude name="**/?*.java"/>
<exclude name="**/?*.form"/>
<exclude name="**/?*.class"/>
<exclude name="**/?*.groovy"/>
<exclude name="**/?*.scala"/>
<exclude name="**/?*.flex"/>
<exclude name="**/?*.kt"/>
<exclude name="**/?*.clj"/>
<exclude name="**/?*.aj"/>
</patternset>
<!-- JDK definitions -->
<property name="jdk.bin.11" value="${jdk.home.11}/bin"/>
<path id="jdk.classpath.11">
<fileset dir="${jdk.home.11}">
<include name="../java-11-openjdk-amd64!/java.base"/>
<include name="../java-11-openjdk-amd64!/java.compiler"/>
<include name="../java-11-openjdk-amd64!/java.datatransfer"/>
<include name="../java-11-openjdk-amd64!/java.desktop"/>
<include name="../java-11-openjdk-amd64!/java.instrument"/>
<include name="../java-11-openjdk-amd64!/java.logging"/>
<include name="../java-11-openjdk-amd64!/java.management"/>
<include name="../java-11-openjdk-amd64!/java.management.rmi"/>
<include name="../java-11-openjdk-amd64!/java.naming"/>
<include name="../java-11-openjdk-amd64!/java.net.http"/>
<include name="../java-11-openjdk-amd64!/java.prefs"/>
<include name="../java-11-openjdk-amd64!/java.rmi"/>
<include name="../java-11-openjdk-amd64!/java.scripting"/>
<include name="../java-11-openjdk-amd64!/java.se"/>
<include name="../java-11-openjdk-amd64!/java.security.jgss"/>
<include name="../java-11-openjdk-amd64!/java.security.sasl"/>
<include name="../java-11-openjdk-amd64!/java.smartcardio"/>
<include name="../java-11-openjdk-amd64!/java.sql"/>
<include name="../java-11-openjdk-amd64!/java.sql.rowset"/>
<include name="../java-11-openjdk-amd64!/java.transaction.xa"/>
<include name="../java-11-openjdk-amd64!/java.xml"/>
<include name="../java-11-openjdk-amd64!/java.xml.crypto"/>
<include name="../java-11-openjdk-amd64!/jdk.accessibility"/>
<include name="../java-11-openjdk-amd64!/jdk.aot"/>
<include name="../java-11-openjdk-amd64!/jdk.attach"/>
<include name="../java-11-openjdk-amd64!/jdk.charsets"/>
<include name="../java-11-openjdk-amd64!/jdk.compiler"/>
<include name="../java-11-openjdk-amd64!/jdk.crypto.cryptoki"/>
<include name="../java-11-openjdk-amd64!/jdk.crypto.ec"/>
<include name="../java-11-openjdk-amd64!/jdk.dynalink"/>
<include name="../java-11-openjdk-amd64!/jdk.editpad"/>
<include name="../java-11-openjdk-amd64!/jdk.hotspot.agent"/>
<include name="../java-11-openjdk-amd64!/jdk.httpserver"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.ed"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.jvmstat"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.le"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.opt"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.vm.ci"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.vm.compiler"/>
<include name="../java-11-openjdk-amd64!/jdk.internal.vm.compiler.management"/>
<include name="../java-11-openjdk-amd64!/jdk.jartool"/>
<include name="../java-11-openjdk-amd64!/jdk.javadoc"/>
<include name="../java-11-openjdk-amd64!/jdk.jcmd"/>
<include name="../java-11-openjdk-amd64!/jdk.jconsole"/>
<include name="../java-11-openjdk-amd64!/jdk.jdeps"/>
<include name="../java-11-openjdk-amd64!/jdk.jdi"/>
<include name="../java-11-openjdk-amd64!/jdk.jdwp.agent"/>
<include name="../java-11-openjdk-amd64!/jdk.jfr"/>
<include name="../java-11-openjdk-amd64!/jdk.jlink"/>
<include name="../java-11-openjdk-amd64!/jdk.jshell"/>
<include name="../java-11-openjdk-amd64!/jdk.jsobject"/>
<include name="../java-11-openjdk-amd64!/jdk.jstatd"/>
<include name="../java-11-openjdk-amd64!/jdk.localedata"/>
<include name="../java-11-openjdk-amd64!/jdk.management"/>
<include name="../java-11-openjdk-amd64!/jdk.management.agent"/>
<include name="../java-11-openjdk-amd64!/jdk.management.jfr"/>
<include name="../java-11-openjdk-amd64!/jdk.naming.dns"/>
<include name="../java-11-openjdk-amd64!/jdk.naming.rmi"/>
<include name="../java-11-openjdk-amd64!/jdk.net"/>
<include name="../java-11-openjdk-amd64!/jdk.pack"/>
<include name="../java-11-openjdk-amd64!/jdk.rmic"/>
<include name="../java-11-openjdk-amd64!/jdk.scripting.nashorn"/>
<include name="../java-11-openjdk-amd64!/jdk.scripting.nashorn.shell"/>
<include name="../java-11-openjdk-amd64!/jdk.sctp"/>
<include name="../java-11-openjdk-amd64!/jdk.security.auth"/>
<include name="../java-11-openjdk-amd64!/jdk.security.jgss"/>
<include name="../java-11-openjdk-amd64!/jdk.unsupported"/>
<include name="../java-11-openjdk-amd64!/jdk.unsupported.desktop"/>
<include name="../java-11-openjdk-amd64!/jdk.xml.dom"/>
<include name="../java-11-openjdk-amd64!/jdk.zipfs"/>
</fileset>
</path>
<property name="project.jdk.home" value="${jdk.home.11}"/>
<property name="project.jdk.bin" value="${jdk.bin.11}"/>
<property name="project.jdk.classpath" value="jdk.classpath.11"/>
<!-- Project Libraries -->
<path id="library.commons-io:commons-io:2.6.classpath">
<pathelement location="${path.variable.maven_repository}/commons-io/commons-io/2.6/commons-io-2.6.jar"/>
</path>
<path id="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath">
<pathelement location="${path.variable.maven_repository}/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.jar"/>
</path>
<path id="library.org.json:json:20190722.classpath">
<pathelement location="${path.variable.maven_repository}/org/json/json/20190722/json-20190722.jar"/>
</path>
<path id="library.springframework:spring-mock:1.2.6.classpath">
<pathelement location="${path.variable.maven_repository}/junit/junit/3.8.1/junit-3.8.1.jar"/>
<pathelement location="${path.variable.maven_repository}/org/springframework/spring-mock/1.2.6/spring-mock-1.2.6.jar"/>
</path>
<path id="library.springframework:spring:1.2.6.classpath">
<pathelement location="${path.variable.maven_repository}/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
<pathelement location="${path.variable.maven_repository}/org/springframework/spring/1.2.6/spring-1.2.6.jar"/>
</path>
<!-- Register Custom Compiler Taskdefs -->
<property name="javac2.home" value="${idea.home}/lib"/>
<path id="javac2.classpath">
<fileset dir="${javac2.home}">
<include name="javac2.jar"/>
<include name="jdom.jar"/>
<include name="asm-all*.jar"/>
<include name="forms-*.jar"/>
</fileset>
</path>
<target name="register.custom.compilers">
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
</target>
<!-- Modules -->
<!-- Module mispbridge -->
<dirname property="module.mispbridge.basedir" file="${ant.file}"/>
<property name="module.jdk.home.mispbridge" value="${project.jdk.home}"/>
<property name="module.jdk.bin.mispbridge" value="${project.jdk.bin}"/>
<property name="module.jdk.classpath.mispbridge" value="${project.jdk.classpath}"/>
<property name="compiler.args.mispbridge" value="-encoding UTF-8 -source 11 -target 11 ${compiler.args}"/>
<property name="mispbridge.output.dir" value="${module.mispbridge.basedir}/production/mispbridge"/>
<property name="mispbridge.testoutput.dir" value="${module.mispbridge.basedir}/test/mispbridge"/>
<path id="mispbridge.module.bootclasspath">
<!-- Paths to be included in compilation bootclasspath -->
</path>
<path id="mispbridge.module.production.classpath">
<path refid="${module.jdk.classpath.mispbridge}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispbridge.runtime.production.module.classpath">
<pathelement location="${mispbridge.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispbridge.module.classpath">
<path refid="${module.jdk.classpath.mispbridge}"/>
<pathelement location="${mispbridge.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispbridge.runtime.module.classpath">
<pathelement location="${mispbridge.testoutput.dir}"/>
<pathelement location="${mispbridge.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<patternset id="excluded.from.module.mispbridge">
<patternset refid="ignored.files"/>
</patternset>
<patternset id="excluded.from.compilation.mispbridge">
<patternset refid="excluded.from.module.mispbridge"/>
</patternset>
<path id="mispbridge.module.sourcepath">
<dirset dir="${module.mispbridge.basedir}/mispbridge">
<include name="src"/>
</dirset>
</path>
<target name="compile.module.mispbridge" depends="compile.module.mispbridge.production,compile.module.mispbridge.tests" description="Compile module mispbridge"/>
<target name="compile.module.mispbridge.production" depends="register.custom.compilers" description="Compile module mispbridge; production classes">
<mkdir dir="${mispbridge.output.dir}"/>
<javac2 destdir="${mispbridge.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mispbridge}/javac">
<compilerarg line="${compiler.args.mispbridge}"/>
<bootclasspath refid="mispbridge.module.bootclasspath"/>
<classpath refid="mispbridge.module.production.classpath"/>
<src refid="mispbridge.module.sourcepath"/>
<patternset refid="excluded.from.compilation.mispbridge"/>
</javac2>
<copy todir="${mispbridge.output.dir}">
<fileset dir="${module.mispbridge.basedir}/mispbridge/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<target name="compile.module.mispbridge.tests" depends="register.custom.compilers,compile.module.mispbridge.production" description="compile module mispbridge; test classes" unless="skip.tests"/>
<target name="clean.module.mispbridge" description="cleanup module">
<delete dir="${mispbridge.output.dir}"/>
<delete dir="${mispbridge.testoutput.dir}"/>
</target>
<!-- Module mispclient -->
<dirname property="module.mispclient.basedir" file="${ant.file}"/>
<property name="module.jdk.home.mispclient" value="${project.jdk.home}"/>
<property name="module.jdk.bin.mispclient" value="${project.jdk.bin}"/>
<property name="module.jdk.classpath.mispclient" value="${project.jdk.classpath}"/>
<property name="compiler.args.mispclient" value="-encoding UTF-8 -source 11 -target 11 ${compiler.args}"/>
<property name="mispclient.output.dir" value="${module.mispclient.basedir}/production/mispclient"/>
<property name="mispclient.testoutput.dir" value="${module.mispclient.basedir}/test/mispclient"/>
<path id="mispclient.module.bootclasspath">
<!-- Paths to be included in compilation bootclasspath -->
</path>
<path id="mispclient.module.production.classpath">
<path refid="${module.jdk.classpath.mispclient}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispclient.runtime.production.module.classpath">
<pathelement location="${mispclient.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispclient.module.classpath">
<path refid="${module.jdk.classpath.mispclient}"/>
<pathelement location="${mispclient.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispclient.runtime.module.classpath">
<pathelement location="${mispclient.testoutput.dir}"/>
<pathelement location="${mispclient.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<patternset id="excluded.from.module.mispclient">
<patternset refid="ignored.files"/>
</patternset>
<patternset id="excluded.from.compilation.mispclient">
<patternset refid="excluded.from.module.mispclient"/>
</patternset>
<path id="mispclient.module.sourcepath">
<dirset dir="${module.mispclient.basedir}/mispclient">
<include name="src"/>
</dirset>
</path>
<target name="compile.module.mispclient" depends="compile.module.mispclient.production,compile.module.mispclient.tests" description="Compile module mispclient"/>
<target name="compile.module.mispclient.production" depends="register.custom.compilers" description="Compile module mispclient; production classes">
<mkdir dir="${mispclient.output.dir}"/>
<javac2 destdir="${mispclient.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mispclient}/javac">
<compilerarg line="${compiler.args.mispclient}"/>
<bootclasspath refid="mispclient.module.bootclasspath"/>
<classpath refid="mispclient.module.production.classpath"/>
<src refid="mispclient.module.sourcepath"/>
<patternset refid="excluded.from.compilation.mispclient"/>
</javac2>
<copy todir="${mispclient.output.dir}">
<fileset dir="${module.mispclient.basedir}/mispclient/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<target name="compile.module.mispclient.tests" depends="register.custom.compilers,compile.module.mispclient.production" description="compile module mispclient; test classes" unless="skip.tests"/>
<target name="clean.module.mispclient" description="cleanup module">
<delete dir="${mispclient.output.dir}"/>
<delete dir="${mispclient.testoutput.dir}"/>
</target>
<!-- Module mispmock -->
<dirname property="module.mispmock.basedir" file="${ant.file}"/>
<property name="module.jdk.home.mispmock" value="${project.jdk.home}"/>
<property name="module.jdk.bin.mispmock" value="${project.jdk.bin}"/>
<property name="module.jdk.classpath.mispmock" value="${project.jdk.classpath}"/>
<property name="compiler.args.mispmock" value="-encoding UTF-8 -source 11 -target 11 ${compiler.args}"/>
<property name="mispmock.output.dir" value="${module.mispmock.basedir}/production/mispmock"/>
<property name="mispmock.testoutput.dir" value="${module.mispmock.basedir}/test/mispmock"/>
<path id="mispmock.module.bootclasspath">
<!-- Paths to be included in compilation bootclasspath -->
</path>
<path id="mispmock.module.production.classpath">
<path refid="${module.jdk.classpath.mispmock}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.springframework:spring-mock:1.2.6.classpath"/>
<path refid="library.springframework:spring:1.2.6.classpath"/>
<pathelement location="${mispclient.output.dir}"/>
<pathelement location="${mispbridge.output.dir}"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispmock.runtime.production.module.classpath">
<pathelement location="${mispmock.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.springframework:spring-mock:1.2.6.classpath"/>
<path refid="library.springframework:spring:1.2.6.classpath"/>
<path refid="mispclient.runtime.production.module.classpath"/>
<path refid="mispbridge.runtime.production.module.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispmock.module.classpath">
<path refid="${module.jdk.classpath.mispmock}"/>
<pathelement location="${mispmock.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.springframework:spring-mock:1.2.6.classpath"/>
<path refid="library.springframework:spring:1.2.6.classpath"/>
<pathelement location="${mispclient.testoutput.dir}"/>
<pathelement location="${mispclient.output.dir}"/>
<pathelement location="${mispbridge.testoutput.dir}"/>
<pathelement location="${mispbridge.output.dir}"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<path id="mispmock.runtime.module.classpath">
<pathelement location="${mispmock.testoutput.dir}"/>
<pathelement location="${mispmock.output.dir}"/>
<path refid="library.org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016.classpath"/>
<path refid="library.springframework:spring-mock:1.2.6.classpath"/>
<path refid="library.springframework:spring:1.2.6.classpath"/>
<path refid="mispclient.runtime.module.classpath"/>
<path refid="mispbridge.runtime.module.classpath"/>
<path refid="library.commons-io:commons-io:2.6.classpath"/>
<path refid="library.org.json:json:20190722.classpath"/>
</path>
<patternset id="excluded.from.module.mispmock">
<patternset refid="ignored.files"/>
</patternset>
<patternset id="excluded.from.compilation.mispmock">
<patternset refid="excluded.from.module.mispmock"/>
</patternset>
<path id="mispmock.module.sourcepath">
<dirset dir="${module.mispmock.basedir}/mispmock">
<include name="src"/>
</dirset>
</path>
<target name="compile.module.mispmock" depends="compile.module.mispmock.production,compile.module.mispmock.tests" description="Compile module mispmock"/>
<target name="compile.module.mispmock.production" depends="register.custom.compilers,compile.module.mispclient,compile.module.mispbridge" description="Compile module mispmock; production classes">
<mkdir dir="${mispmock.output.dir}"/>
<javac2 destdir="${mispmock.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.mispmock}/javac">
<compilerarg line="${compiler.args.mispmock}"/>
<bootclasspath refid="mispmock.module.bootclasspath"/>
<classpath refid="mispmock.module.production.classpath"/>
<src refid="mispmock.module.sourcepath"/>
<patternset refid="excluded.from.compilation.mispmock"/>
</javac2>
<copy todir="${mispmock.output.dir}">
<fileset dir="${module.mispmock.basedir}/mispmock/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<target name="compile.module.mispmock.tests" depends="register.custom.compilers,compile.module.mispmock.production" description="compile module mispmock; test classes" unless="skip.tests"/>
<target name="clean.module.mispmock" description="cleanup module">
<delete dir="${mispmock.output.dir}"/>
<delete dir="${mispmock.testoutput.dir}"/>
</target>
<target name="init" description="Build initialization">
<!-- Perform any build initialization in this target -->
</target>
<target name="clean" depends="clean.module.mispbridge, clean.module.mispclient, clean.module.mispmock" description="cleanup all"/>
<target name="build.modules" depends="init, clean, compile.module.mispbridge, compile.module.mispclient, compile.module.mispmock" description="build all modules"/>
<target name="all" depends="build.modules" description="build all"/>
</project>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>BridgeServlet, World Application</display-name>
<description>
This is a simple web application with a source code organization
based on the recommendations of the Application Developer's Guide.
</description>
<servlet>
<servlet-name>BridgeServlet</servlet-name>
<servlet-class>core.BridgeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BridgeServlet</servlet-name>
<url-pattern>/core</url-pattern>
</servlet-mapping>
</web-app>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,25 @@
<html>
<head>
<title>BridgeServlet</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td>
<img src="images/tomcat.gif">
</td>
<td>
<h1>BridgeServlet</h1>
</td>
</tr>
</table>
<ul>
<p>This Servlet currently provides the following features:
<!--<li>To a <a href="hello.jsp">JSP page</a>.-->
<li><a href="core">Tunnel</a> to hosted Application.
</ul>
</body>
</html>

Binary file not shown.

@ -1,28 +0,0 @@
<html>
<head>
<title>Sample "BridgeServlet, World" Application</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td>
<img src="images/tomcat.gif">
</td>
<td>
<h1>Sample "BridgeServlet, World" Application</h1>
<p>This is the home page for a sample application used to illustrate the
source directory organization of a web application utilizing the principles
outlined in the Application Developer's Guide.
</td>
</tr>
</table>
<p>To prove that they work, TESTyou can execute either of the following links:
<ul>
<li>To a <a href="hello.jsp">JSP page</a>.
<li>To a <a href="core">servlet</a>.
</ul>
</body>
</html>

Binary file not shown.

@ -1,6 +1,8 @@
package core; package com.olexyn.misp.bridge;
import com.olexyn.misp.helper.Ride;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -27,23 +29,32 @@ public class BridgeServlet extends HttpServlet {
@Override @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String jsonPayload = IOUtils.toString(request.getReader());
Ride ridePayload = new Ride(jsonPayload);
String payload = IOUtils.toString(request.getReader());
JSONObject obj = new JSONObject();
try {
obj = new JSONObject(payload);
}catch (JSONException jsonE){
int br = 0;
Thread handleGetUserRequestThread = new Thread(() -> {
try {
handleGetRequest(request, response);
} catch (IOException | InterruptedException e) {e.printStackTrace(); }
});
handleGetUserRequestThread.setName("handleGetUserRequestThread");
handleGetUserRequestThread.start();
}
Ride ridePayload = new Ride(payload);
boolean hasID = ridePayload.getID() != null; boolean hasID = ridePayload.getID() != null;
boolean hasRequest = ridePayload.getRequest() != null; boolean hasRequest = ridePayload.getRequest() != null;
boolean hasData = ridePayload.getData() != null; boolean hasData = ridePayload.getData() != null;
if (hasID & hasRequest & !hasData) {
Thread handleGetUserRequestThread = new Thread(() -> {
try {
handleGetRequest(request, response);
} catch (IOException | InterruptedException e) {e.printStackTrace(); }
});
handleGetUserRequestThread.setName("handleGetUserRequestThread");
handleGetUserRequestThread.start();
}
if (hasID && hasRequest && hasData) { if (hasID && hasRequest && hasData) {
Thread handleGetRideRequestDataThread = new Thread(() -> { Thread handleGetRideRequestDataThread = new Thread(() -> {
@ -55,6 +66,7 @@ public class BridgeServlet extends HttpServlet {
handleGetRideRequestDataThread.start(); handleGetRideRequestDataThread.start();
} }
} }
@ -68,8 +80,7 @@ public class BridgeServlet extends HttpServlet {
protected void handleGetRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { protected void handleGetRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException {
final Ride ride; final Ride ride;
String parsedRequest = IOUtils.toString(request.getReader()); String parsedRequest = IOUtils.toString(request.getReader());
final JSONObject obj = new JSONObject(parsedRequest);
parsedRequest = obj.getString("request");
synchronized (available) { synchronized (available) {

@ -0,0 +1,37 @@
package com.olexyn.misp.bridge;
import com.olexyn.misp.helper.Ride;
import java.util.Map;
public class Debug {
public static String mapTables(BridgeServlet clientServlet){
StringBuilder sb = new StringBuilder();
sb.append(mapTable(clientServlet.available, "available"));
sb.append(mapTable(clientServlet.booked, "booked"));
sb.append(mapTable(clientServlet.loaded, "loaded"));
return sb.toString();
}
private static String mapTable(Map<Long, Ride> foo, String type){
StringBuilder sb = new StringBuilder();
sb.append("<table style=\"width:100%\">");
sb.append("<tr>");
sb.append("<th>");
sb.append("Debug: "+ type);
sb.append("</th>");
sb.append("</tr>");
synchronized (foo){
for(Map.Entry<Long,Ride> entry : foo.entrySet()){
sb.append("<tr><td>"+entry.getValue()+"</td></tr>");
}
}
sb.append("</table>");
return sb.toString();
}
}

@ -0,0 +1,4 @@
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)

@ -0,0 +1,23 @@
<html>
<head>
<title>Sample Application JSP Page</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td align=center>
<img src="images/tomcat.gif">
</td>
<td>
<h1>Sample Application JSP Page</h1>
This is the output of a JSP page that is part of the Hello, World
application.
</td>
</tr>
</table>
<%= new String("Hello!") %>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,23 @@
<html>
<head>
<title>ClientServlet</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td>
<img src="images/tomcat.gif">
</td>
<td>
<h1>ClientServlet</h1>
</td>
</tr>
</table>
<ul>
<p>This Servlet currently provides no user accessible features.
</ul>
</body>
</html>

Binary file not shown.

@ -1,28 +0,0 @@
<html>
<head>
<title>Sample "BridgeServlet, World" Application</title>
</head>
<body bgcolor=white>
<table border="0">
<tr>
<td>
<img src="images/tomcat.gif">
</td>
<td>
<h1>Sample "BridgeServlet, World" Application</h1>
<p>This is the home page for a sample application used to illustrate the
source directory organization of a web application utilizing the principles
outlined in the Application Developer's Guide.
</td>
</tr>
</table>
<p>To prove that they work, you can execute either of the following links:
<ul>
<li>To a <a href="hello.jsp">JSP page</a>.
<li>To a <a href="core">servlet</a>.
</ul>
</body>
</html>

Binary file not shown.

@ -1,9 +1,14 @@
package core; package com.olexyn.misp.client;
import com.olexyn.misp.helper.Ride;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -12,7 +17,7 @@ import java.util.Map;
public class ClientServlet extends HttpServlet { public class ClientServlet extends HttpServlet {
protected static final String MISP_BRIDGE_URL = "http://localhost:9090/mispbridge/core"; protected static final String MISP_BRIDGE_URL = "http://localhost:9090/mispbridge/core";
protected static final String APP_URL = "http://www.google.ch"; protected static final String APP_URL = "http://localhost:9090/mispclient";
public static final int AVAILABLE_RIDES_OVERHEAD_TRIGGER = 32; public static final int AVAILABLE_RIDES_OVERHEAD_TRIGGER = 32;
public static final int AVAILABLE_RIDES_OVERHEAD = 64; public static final int AVAILABLE_RIDES_OVERHEAD = 64;
@ -31,6 +36,29 @@ public class ClientServlet extends HttpServlet {
postRideThread.start(); postRideThread.start();
} }
/**
* Debugging
*/
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter print = response.getWriter();
print.println("<!DOCTYPE html>");
print.println("<html lang=\"en\">");
print.println("<head>");
print.println("<meta charset=\"utf-8\">");
print.println("<title>title</title>");
print.println("<link rel=\"stylesheet\" href=\"style.css\">");
print.println("<script src=\"script.js\"></script>");
print.println("</head>");
print.println("<body>");
print.println(Debug.mapTables(this));
print.println(" </body></html>");
}
/** /**
* Generated by Loop. * Generated by Loop.
@ -73,7 +101,9 @@ public class ClientServlet extends HttpServlet {
outputStream.flush(); outputStream.flush();
outputStream.close(); outputStream.close();
return ConnectionHelper.parseRide(connection); Ride rideXa= ConnectionHelper.parseRide(connection);
rideXa.setRequest("ff");
return rideXa;
} }
@ -164,6 +194,11 @@ class PostRideRunnable implements Runnable {
if (clientServlet.available.size() < ClientServlet.AVAILABLE_RIDES_OVERHEAD_TRIGGER) { if (clientServlet.available.size() < ClientServlet.AVAILABLE_RIDES_OVERHEAD_TRIGGER) {
for (int i = 0; i < ClientServlet.AVAILABLE_RIDES_OVERHEAD; i++) { for (int i = 0; i < ClientServlet.AVAILABLE_RIDES_OVERHEAD; i++) {
try {clientServlet.sendPostRide();} catch (IOException | ServletException | InterruptedException e) { e.printStackTrace(); } try {clientServlet.sendPostRide();} catch (IOException | ServletException | InterruptedException e) { e.printStackTrace(); }
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
} }
} }
} }

@ -1,4 +1,6 @@
package core; package com.olexyn.misp.client;
import com.olexyn.misp.helper.Ride;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;

@ -0,0 +1,55 @@
package com.olexyn.misp.client;
import com.olexyn.misp.helper.Ride;
import java.util.Map;
public class Debug {
public static String mapTables(ClientServlet clientServlet){
StringBuilder sb = new StringBuilder();
sb.append("<h1>Debug:</h1>");
sb.append(mapTable(clientServlet.available, "available"));
sb.append(mapTable(clientServlet.booked, "booked"));
sb.append(mapTable(clientServlet.loaded, "loaded"));
return sb.toString();
}
private static String mapTable(Map<Long,Ride> foo, String type){
StringBuilder sb = new StringBuilder();
sb.append("<h2>"+type+"</h2>");
sb.append("<table>");
sb.append("<tr>");
sb.append("<th>");
sb.append("ID");
sb.append("</th>");
sb.append("<th>");
sb.append("Request");
sb.append("</th>");
sb.append("<th>");
sb.append("Data");
sb.append("</th>");
sb.append("</tr>");
synchronized (foo){
for(Map.Entry<Long, Ride> entry : foo.entrySet()){
sb.append("<tr>");
sb.append("<td>");
sb.append(entry.getValue().getID());
sb.append("</td>");
sb.append("<td>");
sb.append(entry.getValue().getRequest());
sb.append("</td>");
sb.append("<td>");
sb.append(entry.getValue().getData());
sb.append("</td>");
sb.append("</tr>");
}
}
sb.append("</table>");
return sb.toString();
}
}

@ -1,2 +0,0 @@
#### About
Helper files used by `mispbridge` and `mispclient`.

@ -1,6 +0,0 @@
#!/bin/bash
cd ../mispbridge/mispbridge
jar -cvf mispbridge.war *
cd ../
cd ../mispclient/mispclient
jar -cvf mispclient.war *

@ -1,4 +1,4 @@
package core; package com.olexyn.misp.helper;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -12,7 +12,6 @@ public class Ride {
final private Long id; final private Long id;
private String request; private String request;
private String data; private String data;
private State state;
// FUTURE it might be possible to use a ride for many requests. // FUTURE it might be possible to use a ride for many requests.
// private List<String> requests = new ArrayList<>(); // private List<String> requests = new ArrayList<>();
@ -65,10 +64,7 @@ public class Ride {
} }
public Ride setState(State state) {
this.state = state;
return this;
}
public String getRequest() { public String getRequest() {
return this.request; return this.request;
@ -82,7 +78,7 @@ public class Ride {
return this.id; return this.id;
} }
public State getState() {return this.state;}
private String brace(String foo) { private String brace(String foo) {
return "\"" + foo + "\""; return "\"" + foo + "\"";

@ -1,57 +0,0 @@
package core;
import core.Ride;
import java.util.Map;
public class RideMapHelper {
public Map<Long, Ride> rideMap;
RideMapHelper(Map<Long,Ride> rideMap){
this.rideMap = rideMap;
}
public boolean containsMore(int i, State state){
long availableRides = 0L;
for (Map.Entry<Long,Ride> entry : rideMap.entrySet()){
if (entry.getValue().getState() == state){
availableRides++;
}
if (availableRides > i){
return true;
}
}
return false;
}
public boolean containsLess(int i, State state){
long availableRides = 0L;
for (Map.Entry<Long,Ride> entry : rideMap.entrySet()){
if (entry.getValue().getState() == state){
availableRides++;
}
if (availableRides < i){
return true;
}
}
return false;
}
public Ride pickAvailable(){
for (Map.Entry<Long,Ride> entry : rideMap.entrySet()){
if (entry.getValue().getState() == State.AVAILABLE){
return entry.getValue();
}
}
return null;
}
}

@ -1,5 +0,0 @@
package core;
public enum State {
AVAILABLE, BOOKED, LOADED
}

@ -1,14 +1,14 @@
package core; package com.olexyn.misp.mock;
import com.olexyn.misp.mock.exchange.ExchangeMock;
import com.olexyn.misp.mock.exchange.RequestMock;
import com.olexyn.misp.bridge.BridgeServlet;
import exchange.ExchangeMock;
import exchange.RequestMock;
import org.apache.commons.io.IOUtils;
import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter;
public class BridgeMock extends BridgeServlet { public class BridgeMock extends BridgeServlet {

@ -1,4 +1,4 @@
package core; package com.olexyn.misp.mock;
/** /**
* Pass the MockSet. * Pass the MockSet.

@ -1,6 +1,9 @@
package core; package com.olexyn.misp.mock;
import com.olexyn.misp.client.ClientServlet;
import com.olexyn.misp.helper.Ride;
import com.olexyn.misp.mock.exchange.ExchangeMock;
import exchange.ExchangeMock;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import java.io.IOException; import java.io.IOException;

@ -1,4 +1,4 @@
package core; package com.olexyn.misp.mock;
/** /**
* Pass the MockSet. * Pass the MockSet.

@ -1,7 +1,7 @@
package core; package com.olexyn.misp.mock;
import actor.AppMock; import com.olexyn.misp.mock.actor.AppMock;
import actor.UserMock; import com.olexyn.misp.mock.actor.UserMock;
public class Main { public class Main {

@ -1,7 +1,7 @@
package core; package com.olexyn.misp.mock;
import actor.AppMock; import com.olexyn.misp.mock.actor.AppMock;
import actor.UserMock; import com.olexyn.misp.mock.actor.UserMock;
public class MockSet { public class MockSet {
public UserMock userMock; public UserMock userMock;

@ -1,4 +1,7 @@
package actor; package com.olexyn.misp.mock.actor;
import com.olexyn.misp.mock.MockSet;
import com.olexyn.misp.mock.exchange.ExchangeMock;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -7,8 +10,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import core.MockSet;
import exchange.ExchangeMock;
/** /**
* Generic Runnable. * Generic Runnable.

@ -1,11 +1,11 @@
package actor; package com.olexyn.misp.mock.actor;
import core.Main;
import core.MockSet;
import exchange.ExchangeMock; import com.olexyn.misp.mock.MockSet;
import exchange.RequestMock; import com.olexyn.misp.mock.exchange.ExchangeMock;
import com.olexyn.misp.mock.exchange.RequestMock;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.json.JSONObject;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -37,7 +37,7 @@ public class AppMock extends ActorRunnable {
synchronized (exchange) { synchronized (exchange) {
String parsedRequest = IOUtils.toString(request.getReader()); String parsedRequest = IOUtils.toString(request.getReader());
String dataString = "DATA-" + parsedRequest.split("-")[1]; String dataString = "DATA-" + parsedRequest;
exchange.response.setStatus(200); exchange.response.setStatus(200);
PrintWriter writer = exchange.response.getWriter(); PrintWriter writer = exchange.response.getWriter();

@ -1,11 +1,15 @@
package actor; package com.olexyn.misp.mock.actor;
import com.olexyn.misp.mock.MockSet;
import com.olexyn.misp.mock.exchange.ExchangeMock;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import core.*;
import exchange.ExchangeMock;
public class UserMock extends ActorRunnable { public class UserMock extends ActorRunnable {
@ -68,6 +72,7 @@ public class UserMock extends ActorRunnable {
//String requestBody = longRequest+"-"+(++requestCount); //String requestBody = longRequest+"-"+(++requestCount);
String requestBody = "REQUEST-"+(++requestCount); String requestBody = "REQUEST-"+(++requestCount);
String jsonString = "{\"request\":\""+requestBody+ "\"}"; String jsonString = "{\"request\":\""+requestBody+ "\"}";
jsonString = "asdfasdfa";
exchange.request.setContent(jsonString.getBytes()); exchange.request.setContent(jsonString.getBytes());
synchronized (exchange){ synchronized (exchange){

@ -1,4 +1,4 @@
package exchange; package com.olexyn.misp.mock.exchange;
import java.util.ArrayList; import java.util.ArrayList;

@ -1,4 +1,4 @@
package exchange; package com.olexyn.misp.mock.exchange;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;

@ -1,4 +1,4 @@
package exchange; package com.olexyn.misp.mock.exchange;
import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockHttpServletResponse;

@ -0,0 +1,3 @@
#!/bin/bash
./make-war.sh
./copy-restart.sh
Loading…
Cancel
Save