diff options
author | wangyaoguang <sunshine.wang@huawei.com> | 2016-04-05 15:25:46 +0800 |
---|---|---|
committer | wangyaoguang <sunshine.wang@huawei.com> | 2016-04-05 17:00:08 +0800 |
commit | 708e3c7eacb563bfe029719bc7f4c7d0c6d233b7 (patch) | |
tree | c58152a52d5d6b7a0652d0ccf67acf9e7f2e2baa | |
parent | c3756b0ed4a52407f5da611fa92ddc68b9e6be8b (diff) |
add puppet manifests and conf files for rubbos tomcat module
Change-Id: Ieff7000004a3f228731f4c35a519a9634a70a702
JIRA: BOTTLENECK-53
10 files changed, 803 insertions, 0 deletions
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/server.xml b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/server.xml new file mode 100644 index 00000000..43ef7c07 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/server.xml @@ -0,0 +1,38 @@ +<Server port="8005" shutdown="SHUTDOWN"> + <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> + + <GlobalNamingResources> + <Environment name="simpleValue" type="java.lang.Integer" value="30"/> + <Resource name="UserDatabase" auth="Container" + type="org.apache.catalina.UserDatabase" + description="User database that can be updated and saved" + factory="org.apache.catalina.users.MemoryUserDatabaseFactory" + pathname="conf/tomcat-users.xml" /> + </GlobalNamingResources> + + <!-- Define the Tomcat Stand-Alone Service --> + <Service name="Catalina"> + <!-- Define a non-SSL HTTP/1.1 Connector on port 2117 (default 8080) --> + <Connector port="8080" maxHttpHeaderSize="8192" + maxThreads="330" minSpareThreads="5" maxSpareThreads="50" + enableLookups="false" redirectPort="8443" acceptCount="6000" + connectionTimeout="20000" disableUploadTimeout="true" /> + + <!-- Define an AJP 1.3 Connector on port 8009 --> + <Connector port="8009" + maxThreads="330" minSpareThreads="5" maxSpareThreads="50" + acceptCount="6000" redirectPort="8443" protocol="AJP/1.3" /> + + <!-- Define the top level container in our container hierarchy --> + <Engine name="Catalina" defaultHost="localhost"> + <Realm className="org.apache.catalina.realm.UserDatabaseRealm" + resourceName="UserDatabase"/> + <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> + <Valve className="org.apache.catalina.valves.AccessLogValve" + directory="logs" prefix="localhost_access_log." suffix=".txt" + pattern="common" resolveHosts="false"/> + </Host> + </Engine> + </Service> + +</Server> diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/Config.java b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/Config.java new file mode 100644 index 00000000..b415ba4b --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/Config.java @@ -0,0 +1,68 @@ + +/** + * RUBBoS: Rice University Bulletin Board System. + * Copyright (C) 2001-2004 Rice University and French National Institute For + * Research In Computer Science And Control (INRIA). + * Contact: jmob@objectweb.org + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or any later + * version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * Initial developer(s): Emmanuel Cecchet. + * Contributor(s): ______________________. + */ + +package edu.rice.rubbos.servlets; + +/** + * This class contains the configuration for the servlets like the path of HTML + * files, etc ... + * + * @author <a href="mailto:cecchet@rice.edu">Emmanuel Cecchet </a> and <a + * href="mailto:julie.marguerite@inrialpes.fr">Julie Marguerite </a> + * @version 1.0 + */ + +public class Config +{ + + /** + * Creates a new <code>Config</code> instance. + */ + Config() + { + } + + + public static final String HTMLFilesPath = "REPLACED_RUBBOS_HOME/Servlet_HTML"; + public static final String DatabaseProperties = "REPLACED_RUBBOS_HOME/Servlets/mysql.properties"; + public static final int DatabasePropertiesSize = 1; + + public static final int AboutMePoolSize = 10; + public static final int BrowseCategoriesPoolSize = 6; + public static final int BrowseRegionsPoolSize = 6; + public static final int BuyNowPoolSize = 4; + public static final int PutBidPoolSize = 8; + public static final int PutCommentPoolSize = 2; + public static final int RegisterItemPoolSize = 2; + public static final int RegisterUserPoolSize = 2; + public static final int SearchItemsByCategoryPoolSize = 15; + public static final int SearchItemsByRegionPoolSize = 20; + public static final int StoreBidPoolSize = 8; + public static final int StoreBuyNowPoolSize = 4; + public static final int StoreCommentPoolSize = 2; + public static final int ViewBidHistoryPoolSize = 4; + public static final int ViewItemPoolSize = 20; + public static final int ViewUserInfoPoolSize = 4; +} diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/build.properties b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/build.properties new file mode 100644 index 00000000..5c108b45 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/build.properties @@ -0,0 +1,7 @@ +src = . +dist =. +classes.dir = ./build +web.dir = ../Servlet_HTML + +j2ee = REPLACED_RUBBOS_APP_TOOLS/j2sdkee1.3.1 +mysql_connector = ./mysql-connector-java-5.1.7-bin.jar diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/build.xml b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/build.xml new file mode 100644 index 00000000..a248847e --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/build.xml @@ -0,0 +1,82 @@ +<project name="RUBBoS Servlets" default="dist" basedir="."> + <property file="../build.properties" /> + <property name="servlets.html" value="../Servlet_HTML" /> + + <target name="init"> + <tstamp/> + <mkdir dir="${classes.dir}"/> + </target> + + <path id="base.classpath"> + <pathelement location="${classes.dir}" /> + <fileset dir="${j2ee}/lib"> + <include name="j2ee.jar"/> + </fileset> + </path> + + <target name="compile" depends="init"> + <javac srcdir="${src}" + includes="edu/rice/rubbos/servlets/*" + destdir="${classes.dir}" + classpath="${build.classpath}" + depend="yes"> + <classpath refid="base.classpath" /> + </javac> + </target> + + <target name="jar" depends="init, compile"> + <jar destfile="${dist}/rubbos_servlets.jar"> + <fileset dir="${classes.dir}" + includes="edu/rice/rubbos/servlets/*.class"/> + </jar> + </target> + + <target name="war" depends="init, compile, jar"> + <copy file="${dist}/rubbos_servlets.jar" todir="${servlets.html}/WEB-INF/lib"/> + <copy file="${j2ee}/lib/j2ee.jar" todir="${servlets.html}/WEB-INF/lib"/> + <copy file="${mysql_connector}" todir="${servlets.html}/WEB-INF/lib"/> + + <war destfile="${dist}/rubbos.war" webxml="${servlets.html}/WEB-INF/web.xml" basedir="${web.dir}"> + <fileset dir="${classes.dir}" + includes="*" excludes="*/web.xml"/> + <classes dir="${classes.dir}"/> + </war> + </target> + + <target name="dist" depends="init, compile, jar, war"> + </target> + + <target name="doc"> + <mkdir dir="docs/api"/> + <javadoc classpathref="base.classpath" + packagenames="edu.rice.rubbos.*.*" + sourcepath="." + defaultexcludes="yes" + destdir="docs/api" + author="true" + version="true" + use="true" + windowtitle="RUBBoS API"> + <doctitle><![CDATA[<h1>RUBBoS API</h1>]]></doctitle> + <bottom><![CDATA[<i>Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.</i>]]></bottom> + </javadoc> + </target> + + <target name="clean"> + <delete dir="${classes.dir}"/> + <delete> + <fileset dir="${dist}" includes="rubbos_servlets.jar"/> + </delete> + <delete> + <fileset dir="${dist}" includes="rubbos.war"/> + </delete> + <delete> + <fileset dir="edu" includes="**/*.class"/> + </delete> + </target> + + <target name="clean-doc"> + <delete dir="docs/api"/> + </target> + +</project> diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/mysql.properties b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/mysql.properties new file mode 100644 index 00000000..966cfa59 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/mysql.properties @@ -0,0 +1,17 @@ +## DataSource configuration +datasource.name mysql + +#datasource.url jdbc:mysql://btnks-1:3313/rubbos +datasource.url REPLACED_MYSQL_JDBC_DB_URL +datasource.classname com.mysql.jdbc.Driver + +datasource.username REPLACED_MYSQL_USERNAME +datasource.password REPLACED_MYSQL_PASSWORD + + +## ConnectionManager configuration +jdbc.connchecklevel 1 +jdbc.connmaxage 30 +jdbc.connmaxthreads 4 +jdbc.connexcltimeout 30 +jdbc.connteststmt select 1 diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/rubbos_files/Makefile b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/rubbos_files/Makefile new file mode 100755 index 00000000..e01d4e3e --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/rubbos_files/Makefile @@ -0,0 +1,79 @@ + + +########################### +# RUBBoS Makefile # +########################### + +include config.mk + +############################## +# Environment variables # +############################## + +JAVA = $(JAVA_HOME)/bin/java +JAVAC = $(JAVA_HOME)/bin/javac +JAVACOPTS = -deprecation +JAVACC = $(JAVAC) $(JAVACOPTS) +RMIC = $(JAVA_HOME)/bin/rmic +RMIREGISTRY= $(JAVA_HOME)/bin/rmiregistry +CLASSPATH = .:$(J2EE_HOME)/lib/j2ee.jar:$(JAVA_HOME)/jre/lib/rt.jar +JAVADOC = $(JAVA_HOME)/javadoc + + +######################### +# Servlets version # +######################### +#ServletPrinter +Servlets = Config TimeManagement BrowseCategories Auth RegisterUser RubbosHttpServlet BrowseRegions SearchItemsByCategory SearchItemsByRegion ViewItem ViewBidHistory ViewUserInfo SellItemForm RegisterItem PutCommentAuth PutComment StoreComment BuyNowAuth BuyNow StoreBuyNow PutBidAuth PutBid StoreBid AboutMe + +all_servlets_sources = $(addprefix edu/rice/rubbos/servlets/, $(addsuffix .java, $(Servlets))) +all_servlets_obj = $(addprefix edu/rice/rubbos/servlets/, $(addsuffix .class, $(Servlets))) + +servlets: $(all_servlets_obj) + +clean_servlets: + rm -f edu/rice/rubbos/servlets/*.class + +#################### +# Client # +#################### + +ClientFiles = URLGenerator URLGeneratorPHP RUBBoSProperties Stats \ + TransitionTable ClientEmulator UserSession + +all_client_sources = $(addprefix edu/rice/rubbos/client/, $(addsuffix .java, $(ClientFiles))) +all_client_obj = $(addprefix edu/rice/rubbos/client/, $(addsuffix .class, $(ClientFiles))) edu/rice/rubbos/beans/TimeManagement.class + +client: $(all_client_obj) + +initDB: + ${JAVA} -classpath .:./database edu.rice.rubbos.client.InitDB ${PARAM} + +emulator: + ${JAVA} -classpath Client:Client/rubbos_client.jar:. -Xmx1300m -Dhttp.keepAlive=true -Dhttp.maxConnections=1000000 edu.rice.rubbos.client.ClientEmulator + +emulatorDebug: + ${JAVA} -classpath Client:Client/rubbos_client.jar:. -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Xmx1300m -Dhttp.keepAlive=true -Dhttp.maxConnections=1000000 edu.rice.rubbos.client.ClientEmulator + + +############################ +# Global rules # +############################ + + +all: beans ejb_servlets client javadoc flush_cache + +world: all servlets + +javadoc : + ${JAVADOC} -d ./doc/api -bootclasspath ${CLASSPATH} -version -author -windowtitle "RUBBoS API" -header "<b>RUBBoS (C)2001 Rice University/INRIA</b><br>" edu.rice.rubbos.beans edu.rice.rubbos.beans.servlets edu.rice.rubbos.client + +clean: + rm -f core edu/rice/rubbos/beans/*.class edu/rice/rubbos/beans/JOnAS* edu/rice/rubbos/beans/servlets/*.class edu/rice/rubbos/client/*.class edu/rice/rubbos/servlets/*.class + +%.class: %.java + ${JAVACC} -classpath ${CLASSPATH} $< + +flush_cache: bench/flush_cache.c + gcc bench/flush_cache.c -o bench/flush_cache + diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/rubbos_files/config.mk b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/rubbos_files/config.mk new file mode 100644 index 00000000..9182da4d --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/rubbos_files/config.mk @@ -0,0 +1,32 @@ + +############################## +# Environment variables # +############################## + +JAVA = $(JAVA_HOME)/bin/java +JAVAC = $(JAVA_HOME)/bin/javac +JAVACOPTS = -deprecation +JAVACC = $(JAVAC) $(JAVACOPTS) +RMIC = $(JAVA_HOME)/bin/rmic +RMIREGISTRY= $(JAVA_HOME)/bin/rmiregistry +CLASSPATH = .:$(J2EE_HOME)/lib/j2ee.jar:$(JAVA_HOME)/jre/lib/rt.jar:$(SERVLET_API_PATH) +JAVADOC = $(JAVA_HOME)/bin/javadoc +JAR = $(JAVA_HOME)/bin/jar + +GENIC = ${JONAS_ROOT}/bin/unix/GenIC + +MAKE = gmake +CP = /bin/cp +RM = /bin/rm +MKDIR = /bin/mkdir + + +# EJB server: supported values are jonas or jboss +EJB_SERVER = jonas + +# DB server: supported values are MySQL or PostgreSQL +DB_SERVER = MySQL + +%.class: %.java + ${JAVACC} -classpath ${CLASSPATH} $< + diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/web.xml b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/web.xml new file mode 100644 index 00000000..a937286a --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/files/tomcat_sl/web.xml @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!-- +<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'> +--> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> + +<web-app> + + <display-name>RUBBos</display-name> + <description>Rice University Bulletin Board System</description> + + <servlet> + <servlet-name>BrowseCategories</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.BrowseCategories</servlet-class> + </servlet> + + <servlet> + <servlet-name>BrowseStoriesByCategory</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.BrowseStoriesByCategory</servlet-class> + </servlet> + + <servlet> + <servlet-name>ViewComment</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.ViewComment</servlet-class> + </servlet> + + <servlet> + <servlet-name>ModerateComment</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.ModerateComment</servlet-class> + </servlet> + + <servlet> + <servlet-name>PostComment</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.PostComment</servlet-class> + </servlet> + + <servlet> + <servlet-name>StoreComment</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.StoreComment</servlet-class> + </servlet> + + <servlet> + <servlet-name>SubmitStory</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.SubmitStory</servlet-class> + </servlet> + + <servlet> + <servlet-name>AcceptStory</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.AcceptStory</servlet-class> + </servlet> + + <servlet> + <servlet-name>RejectStory</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.RejectStory</servlet-class> + </servlet> + + <servlet> + <servlet-name>ReviewStories</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.ReviewStories</servlet-class> + </servlet> + + <servlet> + <servlet-name>StoreStory</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.StoreStory</servlet-class> + </servlet> + + <servlet> + <servlet-name>ViewStory</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.ViewStory</servlet-class> + </servlet> + + <servlet> + <servlet-name>StoriesOfTheDay</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.StoriesOfTheDay</servlet-class> + </servlet> + + <servlet> + <servlet-name>Search</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.Search</servlet-class> + </servlet> + + <servlet> + <servlet-name>StoreModeratorLog</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.StoreModeratorLog</servlet-class> + </servlet> + + <servlet> + <servlet-name>RegisterUser</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.RegisterUser</servlet-class> + </servlet> + + <servlet> + <servlet-name>Author</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.Author</servlet-class> + </servlet> + + <servlet> + <servlet-name>OlderStories</servlet-name> + <servlet-class>edu.rice.rubbos.servlets.OlderStories</servlet-class> + </servlet> + + + <servlet-mapping> + <servlet-name>BrowseCategories</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.BrowseCategories</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>BrowseStoriesByCategory</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.BrowseStoriesByCategory</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ViewComment</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.ViewComment</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ModerateComment</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.ModerateComment</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>PostComment</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.PostComment</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>StoreComment</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.StoreComment</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>SubmitStory</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.SubmitStory</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>AcceptStory</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.AcceptStory</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>RejectStory</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.RejectStory</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ReviewStories</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.ReviewStories</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>StoreStory</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.StoreStory</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ViewStory</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.ViewStory</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>StoriesOfTheDay</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.StoriesOfTheDay</url-pattern> + </servlet-mapping> + + + <servlet-mapping> + <servlet-name>Search</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.Search</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>StoreModeratorLog</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.StoreModeratorLog</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>RegisterUser</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.RegisterUser</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>Author</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.Author</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>OlderStories</servlet-name> + <url-pattern>/servlet/edu.rice.rubbos.servlets.OlderStories</url-pattern> + </servlet-mapping> + + <session-config> + <session-timeout>30</session-timeout> <!-- 30 minutes --> + </session-config> + +</web-app> diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/manifests/rubbos_tomcat_off.pp b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/manifests/rubbos_tomcat_off.pp new file mode 100644 index 00000000..30673b67 --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/manifests/rubbos_tomcat_off.pp @@ -0,0 +1,80 @@ +############################################################################# +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class rubbos_tomcat::rubbos_tomcat_off { + + include params::rubbos_params + + # Declare some variables + $rubbos_app_tools = $params::rubbos_params::rubbos_app_tools + $rubbos_home = $params::rubbos_params::rubbos_home + + # stop tomcat server + exec {'${rubbos_app_tools}/apache-tomcat-5.5.17/bin/shutdown.sh': + cwd => "${rubbos_app_tools}/apache-tomcat-5.5.17", + command => "${rubbos_app_tools}/apache-tomcat-5.5.17/bin/shutdown.sh", + path => "/usr/bin:/usr/sbin:/bin:/sbin", + environment => "JAVA_HOME=${rubbos_app_tools}/jdk1.6.0_27", + onlyif => "test -f ${rubbos_app_tools}/apache-tomcat-5.5.17/bin/shutdown.sh", + notify => [ + File['${rubbos_app_tools}/apache-tomcat-5.5.17'], + File['${rubbos_app_tools}/j2sdkee1.3.1'], + File['${rubbos_app_tools}/apache-ant-1.6.5'], + ], + } + + file {'${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz': + ensure => absent, + path => "${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz", + backup => false, + } + + file {'${rubbos_app_tools}/apache-tomcat-5.5.17': + ensure => absent, + path => "${rubbos_app_tools}/apache-tomcat-5.5.17", + force => true, + backup => false, + } + + file {'${rubbos_app_tools}/j2sdkee1.3.1.tar.gz': + ensure => absent, + path => "${rubbos_app_tools}/j2sdkee1.3.1.tar.gz", + backup => false, + } + + file {'${rubbos_app_tools}/j2sdkee1.3.1': + ensure => absent, + path => "${rubbos_app_tools}/j2sdkee1.3.1", + force => true, + backup => false, + } + + file {'${rubbos_app_tools}/apache-ant-1.6.5.tar.gz': + ensure => absent, + path => "${rubbos_app_tools}/apache-ant-1.6.5.tar.gz", + backup => false, + } + + file {'${rubbos_app_tools}/apache-ant-1.6.5': + ensure => absent, + path => "${rubbos_app_tools}/apache-ant-1.6.5", + force => true, + backup => false, + } + + file {'${rubbos_home}/Servlets': + ensure => absent, + path => "${rubbos_home}/Servlets", + force => true, + recurse => true, + backup => false, + } + +} diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/manifests/rubbos_tomcat_on.pp b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/manifests/rubbos_tomcat_on.pp new file mode 100644 index 00000000..154b5fcb --- /dev/null +++ b/testsuites/rubbos/puppet_manifests/modules/rubbos_tomcat/manifests/rubbos_tomcat_on.pp @@ -0,0 +1,201 @@ +############################################################################# +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class rubbos_tomcat::rubbos_tomcat_on { + + include params::rubbos_params + require rubbos_common::rubbos_common_on + + # Declare some variables + $rubbos_app_tools = $params::rubbos_params::rubbos_app_tools + $rubbos_home = $params::rubbos_params::rubbos_home + + # Prepare packages + file {'${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz': + ensure => file, + path => "${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz", + source => "puppet:///modules/rubbos_tomcat/apache-tomcat-5.5.17.tar.gz", + backup => false, + } + + exec {'tar xzvf ${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz': + cwd => "${rubbos_app_tools}", + command => "tar xzvf ${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => File['${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz'], + } + + file {'${rubbos_app_tools}/j2sdkee1.3.1.jar.gz': + ensure => file, + path => "${rubbos_app_tools}/j2sdkee1.3.1.jar.gz", + source => "puppet:///modules/rubbos_common/j2sdkee1.3.1.jar.gz", + backup => false, + } + + exec {'tar xzvf ${rubbos_app_tools}/j2sdkee1.3.1.jar.gz': + cwd => "${rubbos_app_tools}", + command => "tar xzvf ${rubbos_app_tools}/j2sdkee1.3.1.jar.gz", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => File['${rubbos_app_tools}/j2sdkee1.3.1.jar.gz'], + } + + file {'${rubbos_app_tools}/apache-ant-1.6.5.tar.gz': + ensure => file, + path => "${rubbos_app_tools}/apache-ant-1.6.5.tar.gz", + source => "puppet:///modules/rubbos_common/apache-ant-1.6.5.tar.gz", + backup => false, + } + + exec {'tar xzvf ${rubbos_app_tools}/apache-ant-1.6.5.tar.gz': + cwd => "${rubbos_app_tools}", + command => "tar xzvf ${rubbos_app_tools}/apache-ant-1.6.5.tar.gz", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => File['${rubbos_app_tools}/apache-ant-1.6.5.tar.gz'], + } + + # Override a config file: servier.xml + file {'${rubbos_app_tools}/apache-tomcat-5.5.17/conf/server.xml': + ensure => file, + path => "${rubbos_app_tools}/apache-tomcat-5.5.17/conf/server.xml", + source => "puppet:///modules/rubbos_tomcat/server.xml", + show_diff => false, + backup => false, + require => Exec['tar xzvf ${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz'], + } + + # Config tomcal_sl + file {'${rubbos_home}/build.properties': + ensure => file, + path => "${rubbos_home}/build.properties", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/build.properties", + backup => false, + } + + # Makefile + file {'${rubbos_home}/Makefile': + ensure => file, + path => "${rubbos_home}/Makefile", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/rubbos_files/Makefile", + backup => false, + } + + # config.mk + file {'${rubbos_home}/config.mk': + ensure => file, + path => "${rubbos_home}/config.mk", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/rubbos_files/config.mk", + backup => false, + } + + # servlets codes + file {'${rubbos_home}/Servlets': + ensure => directory, + path => "${rubbos_home}/Servlets", + recurse => true, + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/rubbos_files/Servlets", + show_diff => false, + backup => false, + } + + # mysql.properties etc. + file {'${rubbos_home}/Servlets/mysql.properties': + ensure => file, + path => "${rubbos_home}/Servlets/mysql.properties", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/mysql.properties", + backup => false, + } + + file {'${rubbos_home}/Servlets/build.xml': + ensure => file, + path => "${rubbos_home}/Servlets/build.xml", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/build.xml", + backup => false, + show_diff => false, + require => File['${rubbos_home}/Servlets'], + } + + file {'${rubbos_home}/Servlets/edu/rice/rubbos/servlets/Config.java': + ensure => file, + path => "${rubbos_home}/Servlets/edu/rice/rubbos/servlets/Config.java", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/Config.java", + backup => false, + require => File['${rubbos_home}/Servlets'], + } + + # mkdir for web.xml + exec {'mkdir -p ${rubbos_home}/Servlet_HTML/WEB-INF': + command => "mkdir -p ${rubbos_home}/Servlet_HTML/WEB-INF", + creates => "${rubbos_home}/Servlet_HTML/WEB-INF", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + } + file {'${rubbos_home}/Servlet_HTML/WEB-INF/web.xml': + ensure => file, + path => "${rubbos_home}/Servlet_HTML/WEB-INF/web.xml", + source => "puppet:///modules/rubbos_tomcat/tomcat_sl/web.xml", + backup => false, + require => Exec['mkdir -p ${rubbos_home}/Servlet_HTML/WEB-INF'], + } + + ## build rubbos.war + exec {'ant clean': + cwd => "${rubbos_home}/Servlets", + command => "${rubbos_app_tools}/apache-ant-1.6.5/bin/ant clean", + environment => ["JAVA_HOME=${rubbos_app_tools}/jdk1.6.0_27","ANT_HOME=${rubbos_app_tools}/apache-ant-1.6.5"], + path => [ + "/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin", + "${rubbos_app_tools}/jdk1.6.0_27/bin", + "${rubbos_app_tools}/jdk1.6.0_27/jre/bin", + "${rubbos_app_tools}/apache-ant-1.6.5/bin"], + require => [ + Exec['tar xzvf ${rubbos_app_tools}/j2sdkee1.3.1.jar.gz'], + Exec['tar xzvf ${rubbos_app_tools}/apache-ant-1.6.5.tar.gz'], + File['${rubbos_home}/build.properties'], + File['${rubbos_home}/Makefile'], + File['${rubbos_home}/config.mk'], + File['${rubbos_home}/Servlets/mysql.properties'], + File['${rubbos_home}/Servlets/build.xml'], + File['${rubbos_home}/Servlets/edu/rice/rubbos/servlets/Config.java'], + File['${rubbos_home}/Servlet_HTML/WEB-INF/web.xml']], + } + + exec {'ant dist': + cwd => "${rubbos_home}/Servlets", + command => "${rubbos_app_tools}/apache-ant-1.6.5/bin/ant dist", + environment => ["JAVA_HOME=${rubbos_app_tools}/jdk1.6.0_27","ANT_HOME=${rubbos_app_tools}/apache-ant-1.6.5"], + path => [ + "/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin", + "${rubbos_app_tools}/jdk1.6.0_27/bin", + "${rubbos_app_tools}/jdk1.6.0_27/jre/bin", + "${rubbos_app_tools}/apache-ant-1.6.5/bin"], + subscribe => Exec['ant clean'], + } ## ant dist will generate: servlets.jar and rubbos.war + + exec {'deploy rubbos.war': + cwd => "${rubbos_app_tools}/apache-tomcat-5.5.17", + command => "cp ${rubbos_home}/Servlets/rubbos.war ${rubbos_app_tools}/apache-tomcat-5.5.17/webapps/", + onlyif => "test -f ${rubbos_home}/Servlets/rubbos.war", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + require => [ + Exec['ant dist'], + Exec['tar xzvf ${rubbos_app_tools}/apache-tomcat-5.5.17.tar.gz']], + } + + # Finally, start tomcat server + exec {'${rubbos_app_tools}/apache-tomcat-5.5.17/bin/startup.sh': + cwd => "${rubbos_app_tools}/apache-tomcat-5.5.17", + command => "${rubbos_app_tools}/apache-tomcat-5.5.17/bin/startup.sh", + path => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"], + environment => "JAVA_HOME=${rubbos_app_tools}/jdk1.6.0_27", + require => [ + File['${rubbos_app_tools}/apache-tomcat-5.5.17/conf/server.xml'], + Exec['deploy rubbos.war']], + } + +} |