- Сервер непрерывной интеграции: Oracle Enterprise Linux 5.7, JDeveloper 11.1.1.5, Hudson 2.2.0;
- Сервер SOA: Oracle SOA Suite 11.1.1.5.
В предыдущей статье (см. здесь) описана конфигурация в которой предполагалось, что в SOA-приложениях не много SOA-проектов (например, 1-3), а на уровне системы непрерывной интеграции (в нашем случае - Hudson) производится опрос системы контроля версий (в нашем случае - SVN) на уровне SOA-приложения. Эта стратегия не оптимальна, при условии что в SOA-приложении большое количество (например, 5-15) SOA-проектов, т.к. при изменении одного из проектов будут собраны, развернуты и запущенны автотесты всех проектов в приложении. В данной статье описана конфигурация на уровне SOA-проекта.
Последовательность шагов:
- Скачиваем дистрибутив Hudson с официального сайта и устанавливаем его.
- Создать тестовое SOA-приложение (в нашем случае это HelloWorldApplication), включая автотесты для этого приложения (подробнее об их создании для Oracle SOA Suite здесь).
- Добавим в SOA-проект директорию tools, а в неё конфигурационный файл с именем project.properties:
Следующего содержания:
project.name=HelloWorldProject project.revision=1.0 project.partition=test
- Для композита сгенерировать "Configuration Plan":
- Отредактировать конфигурационный файл build.properties находящийся в директории SOA-проект/tools/ant/:
Если структура SVN-репозитория идентична структуре описанной на шаге 2, то изменить значения параметров выделенных красным и настройки развертывания.# global wn.bea.home=/u01/jdeveloper11.1.1.5 oracle.home=${wn.bea.home}/jdeveloper java.passed.home=/u01/jdk1.6.0_30 wl_home=${wn.bea.home}/wlserver_10.3 # temp tmp.output.dir=/u01/tmp junit.output.dir=../.. deployment.plan.environment=dev # dev deployment server weblogic dev.serverURL=http://192.168.2.130:9030 dev.user=weblogic dev.password=welcome1 dev.overwrite=true dev.forceDefault=true # testing deployment server weblogic test.serverURL=http://192.168.2.130:8801 test.overwrite=true test.user=weblogic test.password=welcome1 test.forceDefault=true # production deployment server weblogic prod.serverURL=http://192.168.2.130:8001 prod.overwrite=true prod.user=weblogic prod.password=welcome1 prod.forceDefault=true
- Отредактировать конфигурационный файл для каждого окружения (в нашем тестовом примере будем использовать только dev) - файл с именем <окружение>.jndi.properties (в нашем случае это dev.jndi.properties) в директорию SOA-проект/tools/ant/:
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory java.naming.provider.url=t3://192.168.2.130:9030/soa-infra java.naming.security.principal=weblogic java.naming.security.credentials=welcome1 dedicated.connection=true dedicated.rmicontext=true
- Теперь настроим Hudson на наш тестовый пример.
- Зайти в консоль Hudson, затем "Настроить Hudson" -> "Конфигурирование системы":
- Добавляем в секцию JDK используемую версию, а в секцию Ant добавляем входящий в состав JDeveloper из директории
jdeveloper/ant : - Создать новую задачу для нашего SOA-проекта (для этого нажать "Новая задача" в консоли Hudson):
- Откроется меня настройки проекта (или нажать "Настроить проект"). В "Управление исходным кодом" выбрать "Subversion" и ввести "URL репозитория" - в нашем случае указываем путь до SOA-проекта: Если используется авторизация, то нажать "enter credential" и ввести параметры авторизации:
- В секции "Триггеры сборки" выбрать "Опрашивать SCM об изменениях" и ввести в поле расписание значение "* * * * *" (это значит что опрашивать каждую минуту):
- В секции "Сборка" выбрать "Добавить шаг сборки" и далее выбрать "Вызвать Ant":
- Заполнить поля следующим образом:
- Версия Ant - jdev_ant;
- Цели - deployProject;
- Сборочный файл - tools/ant/build.xml;
- Опции Java - -Dbasedir=/u01/jdeveloper11.1.1.5/jdeveloper/bin
- В секции "Послесборочные операции" выбрать "Publish JUnit test result report" и ввести значение "*.xml":
- Сохранить все настройки.
- Протестируем работоспособность.
- Изменяем любой файл в SVN-репозитории (в течении одной минуты будет запущена сборка);
- Нажав на кнопку "Собрать сейчас":
Started by user sdevyatov Reverting /var/lib/hudson/jobs/HelloWorldProject/workspace/. ignoreExternals: false Updating http://127.0.0.1/repo/TestingApplication/HelloWorldProject revision: May 3, 2012 2:48:07 PM depth:infinity ignoreExternals: false At revision 93 no change for http://127.0.0.1/repo/TestingApplication/HelloWorldProject since the previous build [ant] $ /u01/jdeveloper11.1.1.5/jdeveloper/ant/bin/ant -file build.xml deployProject Buildfile: build.xml [echo] basedir /u01/jdeveloper11.1.1.5/jdeveloper/bin [echo] current folder /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [input] Please enter composite directory: [input] Please enter composite name: [input] Please enter composite revision: [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper deployProject: [echo] deploy project HelloWorldProject for environment dev [echo] deploy compositeName HelloWorldProject [echo] deploy compositeDir /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../.. [echo] basedir /u01/jdeveloper11.1.1.5/jdeveloper/bin [echo] current folder /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [input] skipping input as property compositeDir has already been set. [input] skipping input as property compositeName has already been set. [input] skipping input as property revision has already been set. Trying to override old definition of task scac Trying to override old definition of task attachplan Trying to override old definition of task extractplan Trying to override old definition of task generateplan Trying to override old definition of task validateplan Trying to override old definition of task replaceRevision [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper clean: [echo] deleting /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../deploy/sca_HelloWorldProject_rev1.0.jar [delete] Deleting: /var/lib/hudson/jobs/HelloWorldProject/workspace/deploy/sca_HelloWorldProject_rev1.0.jar init: scac-validate: [echo] Running scac-validate in /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../composite.xml [echo] basedir /u01/jdeveloper11.1.1.5/jdeveloper/bin [echo] current folder /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [input] skipping input as property compositeDir has already been set. [input] skipping input as property compositeName has already been set. [input] skipping input as property revision has already been set. [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper scac: [scac] Validating composite "/var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../composite.xml" [scac] BPEL 2.0 validation of "BPELProcess1" took 99.9 milliseconds [scac] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [scac] >> modified xmlbean locale class in use [scac] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [scac] info: Validating composite "/var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../composite.xml" [scac] info: Pass [scac] info: File to validate does not exist fault-policies.xml:/var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../fault-policies.xml (No such file or directory) [scac] info: Checking validateMessages....testsuites/TestCase2/messages [scac] info: Begin validateIncludes....testsuites/TestCase2/includes [scac] info: Begin validateTests....testsuites/TestCase2/tests [scac] info: Check validateTestDocument....testsuites/TestCase2/tests/Test2.1.xml [scac] info: Check doSchemaValidation....testsuites/TestCase2/tests/Test2.1.xml [scac] info: Check isSetInitiate ....testsuites/TestCase2/tests/Test2.1.xml [scac] info: Check WireActionsModel ....testsuites/TestCase2/tests/Test2.1.xml [scac] info: validateTestDocument Pass [scac] info: validateTests Pass [scac] info: Checking validateMessages....testsuites/TestCase1/messages [scac] info: Begin validateIncludes....testsuites/TestCase1/includes [scac] info: Begin validateTests....testsuites/TestCase1/tests [scac] info: Check validateTestDocument....testsuites/TestCase1/tests/Test1.xml [scac] info: Check doSchemaValidation....testsuites/TestCase1/tests/Test1.xml [scac] info: Check isSetInitiate ....testsuites/TestCase1/tests/Test1.xml [scac] info: Check WireActionsModel ....testsuites/TestCase1/tests/Test1.xml [scac] info: validateTestDocument Pass [scac] info: Check validateTestDocument....testsuites/TestCase1/tests/Test2.xml [scac] info: Check doSchemaValidation....testsuites/TestCase1/tests/Test2.xml [scac] info: Check isSetInitiate ....testsuites/TestCase1/tests/Test2.xml [scac] info: Check WireActionsModel ....testsuites/TestCase1/tests/Test2.xml [scac] info: validateTestDocument Pass [scac] info: validateTests Pass package: [echo] basedir /u01/jdeveloper11.1.1.5/jdeveloper/bin [echo] current folder /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [input] skipping input as property compositeDir has already been set. [input] skipping input as property compositeName has already been set. [input] skipping input as property revision has already been set. [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper compile-source: [mkdir] Created dir: /var/lib/hudson/jobs/HelloWorldProject/workspace/dist [copy] Copying 28 files to /var/lib/hudson/jobs/HelloWorldProject/workspace/dist [copy] Warning: /var/lib/hudson/jobs/HelloWorldProject/.adf not found. [copy] Warning: /var/lib/hudson/jobs/HelloWorldProject/src not found. [copy] Warning: /var/lib/hudson/jobs/HelloWorldProject/workspace/src not found. [jar] Building jar: /var/lib/hudson/jobs/HelloWorldProject/workspace/deploy/sca_HelloWorldProject_rev1.0.jar [delete] Deleting directory /var/lib/hudson/jobs/HelloWorldProject/workspace/dist [echo] deploy on http://192.168.2.130:9030 with user weblogic [echo] deploy sarFile /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../deploy/sca_HelloWorldProject_rev1.0.jar [echo] basedir /u01/jdeveloper11.1.1.5/jdeveloper/bin [echo] current folder /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [input] Please enter composite directory: [input] Please enter composite name: [input] Please enter composite revision: [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper deploy: [input] skipping input as property serverURL has already been set. [input] skipping input as property sarLocation has already been set. [deployComposite] setting user/password..., user=weblogic [deployComposite] Processing sar=/var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../deploy/sca_HelloWorldProject_rev1.0.jar [deployComposite] Adding sar file - /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../deploy/sca_HelloWorldProject_rev1.0.jar [deployComposite] INFO: Creating HTTP connection to host:192.168.2.130, port:9030 [deployComposite] INFO: Received HTTP response from the server, response code=200 [deployComposite] ---->Deploying composite success. [echo] basedir /u01/jdeveloper11.1.1.5/jdeveloper/bin [echo] current folder /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [echo] oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper [input] Please enter composite directory: [input] Please enter composite name: [input] Please enter composite revision: [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper test: [echo] Classpth = /u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-ext.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/oracle-soa-client-api.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-common.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel.jar:/u01/jdeveloper11.1.1.5/wlserver_10.3/server/lib/weblogic.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jps_11.1.1/jps-api.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jps_11.1.1/jps-common.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jps_11.1.1/jps-internal.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.mgmt_11.1.1/soa-client-stubs-was.jar:/u01/jdeveloper11.1.1.5/websphere/runtimes/com.ibm.ws.ejb.thinclient_7.0.0.jar:/u01/jdeveloper11.1.1.5/websphere/runtimes/com.ibm.ws.orb_7.0.0.jar:/u01/jdeveloper11.1.1.5/websphere/plugins/com.ibm.ws.runtime.jar:/u01/jdeveloper11.1.1.5/websphere/runtimes/com.ibm.ws.admin.client_7.0.0.jar [echo] Running scatest using oracle.home = /u01/jdeveloper11.1.1.5/jdeveloper HelloWorldProject [echo] Using context = build.properties [echo] Using path = /u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-ext.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.fabric_11.1.1/oracle-soa-client-api.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel-common.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.bpel_11.1.1/orabpel.jar:/u01/jdeveloper11.1.1.5/wlserver_10.3/server/lib/weblogic.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jps_11.1.1/jps-api.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jps_11.1.1/jps-common.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jps_11.1.1/jps-internal.jar:/u01/jdeveloper11.1.1.5/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar:/u01/jdeveloper11.1.1.5/jdeveloper/soa/modules/oracle.soa.mgmt_11.1.1/soa-client-stubs-was.jar:/u01/jdeveloper11.1.1.5/websphere/runtimes/com.ibm.ws.ejb.thinclient_7.0.0.jar:/u01/jdeveloper11.1.1.5/websphere/runtimes/com.ibm.ws.orb_7.0.0.jar:/u01/jdeveloper11.1.1.5/websphere/plugins/com.ibm.ws.runtime.jar:/u01/jdeveloper11.1.1.5/websphere/runtimes/com.ibm.ws.admin.client_7.0.0.jar [input] skipping input as property scatest.input has already been set. [input] skipping input as property jndi.properties.input has already been set. [scatest] Junit formatting [scatest] <testsuite name="sca.test-HelloWorldProject.TestCase1" tests="2" errors="0" failures="0" time="0.132"><properties><property name="db.type" value="oracle"/><property name="bpel.host.name" value="oracle-sb.tsretail.ru"/><property name="soa.oracle.home" value="/opt/Middleware/soa_11.1"/><property name="suite.start.date" value="2012-05-03T14:42:30.978+04:00"/><property name="suite.end.date" value="2012-05-03T14:42:31.110+04:00"/><property name="run.start.date" value="2012-05-03T14:42:30.978+04:00"/><property name="run.end.date" value="2012-05-03T14:42:31.163+04:00"/></properties><testcase name="Test1" classname="sca.test-HelloWorldProject.TestCase1.Test1" time="0.132"/><testcase name="Test2" classname="sca.test-HelloWorldProject.TestCase1.Test2" time="0.052"/></testsuite> [scatest] /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../BPEL-sca.test-HelloWorldProject.TestCase1.xml [scatest] <testsuite name="sca.test-HelloWorldProject.TestCase2" tests="1" errors="0" failures="0" time="0.102"><properties><property name="db.type" value="oracle"/><property name="bpel.host.name" value="oracle-sb.tsretail.ru"/><property name="soa.oracle.home" value="/opt/Middleware/soa_11.1"/><property name="suite.start.date" value="2012-05-03T14:42:31.061+04:00"/><property name="suite.end.date" value="2012-05-03T14:42:31.163+04:00"/><property name="run.start.date" value="2012-05-03T14:42:30.978+04:00"/><property name="run.end.date" value="2012-05-03T14:42:31.163+04:00"/></properties><testcase name="Test2.1" classname="sca.test-HelloWorldProject.TestCase2.Test2.1" time="0.102"/></testsuite> [scatest] /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../BPEL-sca.test-HelloWorldProject.TestCase2.xml [scatest] <testsuite name="sca.test-HelloWorldProject.codeCoverages" errors="0" failures="0" tests="0" time="0.0"/> [scatest] /var/lib/hudson/jobs/HelloWorldProject/workspace/tools/ant/../../BPEL-sca.test-HelloWorldProject.codeCoverages.xml BUILD SUCCESSFUL Total time: 13 seconds Recording test results Finished: SUCCESS