From 4aa52a79592d54605ebb1b86fa203f5f07b286f7 Mon Sep 17 00:00:00 2001 From: j00302280 Date: Mon, 26 Sep 2016 12:56:23 +0800 Subject: [PATCH] Solve the install issues Change-Id: I4402388c3d245a062299fd6d65fa152d63b8f08c Signed-off-by: j00302280 --- servicegateway/deployment/pom.xml | 97 +++++- .../deployment/src/main/release/bin/start.sh | 4 +- .../deployment/src/main/release/bin/stop.sh | 2 +- servicegateway/pom.xml | 370 +++++++-------------- servicegateway/service/pom.xml | 174 +++------- .../roa/impl/ServiceGatewayRoaModuleImpl.java | 11 + .../service/src/main/resources/spring/service.xml | 13 +- 7 files changed, 262 insertions(+), 409 deletions(-) diff --git a/servicegateway/deployment/pom.xml b/servicegateway/deployment/pom.xml index 88d6f4eb..2f025e92 100644 --- a/servicegateway/deployment/pom.xml +++ b/servicegateway/deployment/pom.xml @@ -18,22 +18,97 @@ 4.0.0 org.openo.gso.gui - servicegateway + service-gateway-root 1.0.0-SNAPSHOT - deployment - deployment - jar + service-gateway-deployment + ServiceGatewayRootDeployment + pom UTF-8 - - - org.openo.common-services.common-utilities - commonlib-cbb - 1.0.0-SNAPSHOT - - + + + + + + org.codehaus.gmaven + groovy-maven-plugin + 2.0 + + + + + + org.codehaus.gmaven + gmaven-plugin + 1.5 + + + ServiceGateway package + package + + execute + + + + System.out.println("******** Going to make release zip ********") + + deployFolder = "${project.build.directory}/deployoutput" + deployUnzip = "${project.build.directory}/deployunzip" + outfileName = "ServiceGateway-.${project.version}.zip" + + ant.delete(dir: "${deployFolder}") + ant.mkdir(dir: "${deployFolder}") + + ant.delete(dir: "${deployUnzip}") + ant.mkdir(dir: "${deployUnzip}") + + ant.mkdir(dir: "${deployUnzip}/webapps/ROOT") + ant.mkdir(dir: "${deployUnzip}/webapps/openoui#servicegateway#v1") + + ant.copy(todir: "${deployUnzip}") { + fileset(dir: "${basedir}/src/main/release"){ + exclude(name: "**/.gitignore") + } + } + + ant.copy(todir: "${deployUnzip}/webapps/ROOT") { + fileset(dir: "${project.build.directory}/../../service/target/ROOT") + } + + ant.zip(destfile: "${deployFolder}/${outfileName}") { + fileset(dir: "${deployUnzip}") + } + System.out.println("******** completed. ************") + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.directory}/deployoutput/ServiceGateway-.${project.version}.zip + zip + + + + + + + + diff --git a/servicegateway/deployment/src/main/release/bin/start.sh b/servicegateway/deployment/src/main/release/bin/start.sh index 235b3197..521ef3b7 100644 --- a/servicegateway/deployment/src/main/release/bin/start.sh +++ b/servicegateway/deployment/src/main/release/bin/start.sh @@ -14,6 +14,8 @@ # limitations under the License. #******************************************************************************* #!/bin/bash +mkdir logs +mkdir temp cd .. export CATALINA_BASE=$(cd `dirname $0`; pwd) -catalina.sh start \ No newline at end of file +$CATALINA_HOME/bin/catalina.sh start \ No newline at end of file diff --git a/servicegateway/deployment/src/main/release/bin/stop.sh b/servicegateway/deployment/src/main/release/bin/stop.sh index bcc60433..365da00d 100644 --- a/servicegateway/deployment/src/main/release/bin/stop.sh +++ b/servicegateway/deployment/src/main/release/bin/stop.sh @@ -16,4 +16,4 @@ #!/bin/bash cd .. export CATALINA_BASE=$(cd `dirname $0`; pwd) -catalina.sh stop \ No newline at end of file +$CATALINA_HOME/bin/catalina.sh stop \ No newline at end of file diff --git a/servicegateway/pom.xml b/servicegateway/pom.xml index 3836dd5c..4b2ed45e 100644 --- a/servicegateway/pom.xml +++ b/servicegateway/pom.xml @@ -21,271 +21,129 @@ gso-gui 1.0.0-SNAPSHOT - servicegateway - servicegateway + org.openo.gso.gui + service-gateway-root + 1.0.0-SNAPSHOT + ServiceGatewayRoot pom UTF-8 + 3.1.6 service deployment + + HEAD + + + + org.openo.common-services.common-utilities + commonlib-cbb + 1.0.0-SNAPSHOT + + + org.openo.common-services.common-utilities + commonlib-restclient + 1.0.0-SNAPSHOT + + + org.apache.cxf + cxf-rt-frontend-jaxrs + 3.1.6 + + + commons-httpclient + commons-httpclient + 3.1 + + + + org.openo.gso + org.openo.gso.commsvc.common + 1.0.0-SNAPSHOT + + + org.springframework + spring-beans + 3.1.0.RELEASE + + + org.springframework + spring-context + 3.1.0.RELEASE + + + org.springframework + spring-jdbc + 3.1.0.RELEASE + + + org.springframework + spring-web + 3.1.0.RELEASE + + + org.osgi + org.osgi.core + 4.1.0 + + + org.mybatis + mybatis + 3.2.7 + + + org.mybatis + mybatis-spring + 1.2.0 + jar + compile + + + com.mchange + c3p0 + 0.9.2.1 + jar + compile + + + org.codehaus.jackson + jackson-jaxrs + 1.9.2 + + + javax.servlet + javax.servlet-api + 3.1.0 + + + com.googlecode.jmockit + jmockit + 1.1 + test + + + junit + junit + 4.12 + test + + + org.jmockit + jmockit-coverage + 1.18 + test + + + com.h2database + h2 + 1.4.190 + test + + - - - - - src/main/release/pub - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.10 - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/deploydependencis - false - false - true - compile - runtime - - - - - - org.codehaus.gmaven - gmaven-plugin - 1.5 - - - make new jar - package - - execute - - - - private String getWebContextFromManifest(File warFile) { - String context = null; - java.util.jar.JarFile jarFile = null; - try { - jarFile = new java.util.jar.JarFile(warFile); - context = - jarFile.getManifest().getMainAttributes().getValue("WebContext-Name"); - context = context == null ? "ROOT" : context; - context = context.replace("\", "/"); - context = context.replaceAll("[/]{2,}", "/"); - context = context.endsWith("/") ? context.substring(0, context.length() - 1) : context; - context = context.startsWith("/") ? context.substring(1, context.length()) : context; - context = context.replaceAll("/", "#"); - return context; - } catch (Exception e) { - System.out.println("-------------------context eror: ",e); - context = "ROOT"; - } finally { - if (jarFile != null) { - jarFile.close(); - } - } - System.out.println("-------------------context is: " + context); - return context; - } - System.out.println("------------------------------1") - List contexts=new ArrayList(); - deploydependencisdir = "${project.build.directory}/deploydependencis"; - unzipdir = - "${project.build.directory}/deployunzip"; - outputdir = - "${project.build.directory}/deployoutput"; - resourcesdir = - "${project.basedir}/src/main/release"; - jarsdir = "${unzipdir}/lib"; - toolpath = - "${project.build.directory}/deployoutputjars"; - - System.out.println("------------------------------2") - ant = new AntBuilder() - ant.delete(dir: "${unzipdir}") - ant.mkdir(dir: "${unzipdir}") - ant.mkdir(dir: - toolpath) - ant.delete(dir: "${outputdir}") - ant.mkdir(dir: "${outputdir}") - ant.delete(dir: "${jarsdir}") - ant.mkdir(dir: "${jarsdir}") - outputFileName = - "${project.name}" - - System.out.println("------------------------------3") - if(new - File("${deploydependencisdir}").exists()){ - for (File file : new File("${deploydependencisdir}").listFiles()) - { - String filePath = file.getAbsolutePath(); - fileName = file.getName(); - if (fileName.endsWith(".war")) { - context = getWebContextFromManifest(file) - ant.mkdir(dir: "${unzipdir}/webapps/" + context) - ant.unzip(src: filePath, dest: "${unzipdir}/webapps/" + context) - ant.copy(todir: toolpath) { - fileset(dir: "${unzipdir}/webapps/" + context + "/WEB-INF/lib") { - include(name: "*.jar") - } - } - - } - } - - contexts.add(toolpath) - ant.copy(todir: toolpath) { - fileset(dir: "${deploydependencisdir}") { - include(name: "*.jar") - } - } - } - - - System.out.println("------------------------------4") - ant.copy(todir: toolpath) { - fileset(dir: "${project.build.directory}") { - include(name: "*.jar") - } - } - - ant.copy(todir: "${unzipdir}") { - fileset(dir: "${resourcesdir}") { - include(name: "**") - } - } - - - /* compile python .py files. */ - System.out.println("------------------------------5------------------") - pythonFile = "${project.basedir}/src/main/python"; - if(new - File(pythonFile).exists()) { - try { - ant.exec(dir: "${project.basedir}/src/main/python", executable: "python") { - arg(value: "-m") - arg(value: "compileall") - arg(value: ".") - } - - ant.copy(todir: "${unzipdir}") { - fileset(dir: "${project.basedir}/src/main/python") { - include(name: "**/*.*") - exclude(name: "**/*.py") - } - } - } catch (Exception eee) { - System.out.println("---------------->>>"+eee.toString()) - } - } - - /* copy all dependencies to $APP_ROOT/lib. */ - System.out.println("------------------------------6------------------") - for(String temPath : contexts) - { - if(new File(temPath).exists()) - { - try { - for (File file : new File(temPath).listFiles()) { - fileName = file.getName(); - if (fileName.endsWith(".jar")) { - ant.copy(file: file.getAbsolutePath(), todir: "${jarsdir}") - } - } - } catch (Exception e) { - e.printStackTrace() - } - } - } - - /* deploy the upzip file to ${outputdir}/${outputFileName} */ - System.out.println("------------------------------7------------------") - outputFileName = - outputFileName.endsWith("Deployment")?outputFileName:outputFileName+"Deployment"; - outputFileName = outputFileName.substring(0, outputFileName.length() - - "Deployment".length()); - outputFileName = outputFileName + - "-${project.version}.zip"; - - outputFileName = outputFileName.replace("-SNAPSHOT", - "." + new java.text.SimpleDateFormat("yyyyMMddHHmmss").format( - new Date())); - - ant.delete(dir: "${unzipdir}/webapps/ROOT/WEB-INF/lib"); - ant.mkdir(dir: - "${unzipdir}/webapps/ROOT/WEB-INF/lib"); - ant.copy(todir: - "${unzipdir}/webapps/ROOT/WEB-INF/lib") { - fileset(dir: "${unzipdir}/lib") { - include(name: "org.openo.common-services.common-utilities.commonlib.db-*.jar") - include(name: "org.openo.common-services.common-utilities.commonlib.cbb-*.jar") - } - } - - ant.delete() { - fileset(dir: "${unzipdir}/lib") { - include(name: "org.openo.common-services.common-utilities.commonlib.db-*.jar") - include(name: "org.openo.common-services.common-utilities.commonlib.cbb-*.jar") - } - } - - /* generate dependencies.list in $APP_ROOT/lib. Requirement for install disk size. */ - System.out.println("------------------------------8------------------") - dependenciesPath="${unzipdir}/lib"; - try { - def writer = new File(dependenciesPath+"/dependencies.list").newWriter('UTF-8') - for (String fileName : new File(dependenciesPath).list()) { - if (fileName.endsWith(".jar")) { - writer.writeLine(fileName); - } - } - writer.close() - } catch (Exception e) { - e.printStackTrace() - } - - /* make the archive. */ - System.out.println("------------------------------9------------------") - ant.zip(destfile: - "${outputdir}/${outputFileName}") { - fileset(dir: "${unzipdir}") { - exclude(name: "**/.gitignore") - } - } - - System.out.println("------------------------------done") - - - - - - - - - diff --git a/servicegateway/service/pom.xml b/servicegateway/service/pom.xml index 3ff6fdcf..b0cd551e 100644 --- a/servicegateway/service/pom.xml +++ b/servicegateway/service/pom.xml @@ -17,155 +17,63 @@ 4.0.0 - + org.openo.gso.gui - servicegateway + service-gateway-root 1.0.0-SNAPSHOT - service - service + service-gateway-service + ServiceGatewayService war - - - - org.openo.common-services.common-utilities - commonlib-cbb - 1.0.0-SNAPSHOT - - - - org.openo.common-services.common-utilities - commonlib-restclient - 1.0.0-SNAPSHOT - - - org.apache.cxf - cxf-rt-frontend-jaxrs - 3.1.6 - - - commons-httpclient - commons-httpclient - 3.1 - - - - org.openo.gso - org.openo.gso.commsvc.common - 1.0.0-SNAPSHOT - - - org.springframework - spring-beans - 3.1.0.RELEASE - - - org.springframework - spring-context - 3.1.0.RELEASE - - - org.springframework - spring-jdbc - 3.1.0.RELEASE - - - org.springframework - spring-web - 3.1.0.RELEASE - - - org.osgi - org.osgi.core - 4.1.0 - - - org.mybatis - mybatis - 3.2.7 - - - org.mybatis - mybatis-spring - 1.2.0 - jar - compile - - - com.mchange - c3p0 - 0.9.2.1 - jar - compile - - - org.codehaus.jackson - jackson-jaxrs - 1.9.2 - - - javax.servlet - javax.servlet-api - 3.1.0 - - - com.googlecode.jmockit - jmockit - 1.1 - test - - - junit - junit - 4.12 - test - - - org.jmockit - jmockit-coverage - 1.18 - test - - - com.h2database - h2 - 1.4.190 - test - - - + + UTF-8 + 3.1.6 + 1.6.1 + false + false + + + + + all-tests + + all-tests + false + + + + ROOT + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + org.apache.maven.plugins maven-surefire-plugin + 2.19.1 - -XX:-UseSplitVerifier - true + always + ${surefireArgLine} + ${maven.test.skip} + true + - ${excludesFile} + **/IT*.java - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - html - xml - - - - org/**/*Test.class - - - - diff --git a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java index ff337512..3c47c657 100644 --- a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java +++ b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/impl/ServiceGatewayRoaModuleImpl.java @@ -124,4 +124,15 @@ public class ServiceGatewayRoaModuleImpl implements IServiceGatewayRoaModule { return Response.accepted().entity(result).build(); } + + public IServiceGateway getServiceGateway() + { + return serviceGateway; + } + + public void setServiceGateway(IServiceGateway serviceGateway) + { + this.serviceGateway = serviceGateway; + } + } diff --git a/servicegateway/service/src/main/resources/spring/service.xml b/servicegateway/service/src/main/resources/spring/service.xml index c328d867..39e5ea7f 100644 --- a/servicegateway/service/src/main/resources/spring/service.xml +++ b/servicegateway/service/src/main/resources/spring/service.xml @@ -26,7 +26,6 @@ http://www.huawei.com/schema/oms/oms.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> - @@ -35,8 +34,7 @@ - - + @@ -65,9 +63,10 @@ - - + + - - + + + \ No newline at end of file -- 2.16.6