суббота, 15 сентября 2012 г.

Хеширование SHA-1 и MD5 на PL/SQL и Java

  • Реализация на PL/SQL:
    • SHA-1:
       CREATE OR REPLACE  
        FUNCTION SHA1(plain_text VARCHAR2) RETURN VARCHAR2  
        AS  
        BEGIN  
         RETURN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_CRYPTO.HASH (src => utl_i18n.string_to_raw (plain_text, 'AL32UTF8'), typ => DBMS_CRYPTO.HASH_SH1)));  
        END;  
      
    • MD5:
       CREATE OR REPLACE  
        FUNCTION MD5(plain_text VARCHAR2) RETURN VARCHAR2 IS  
        BEGIN  
         RETURN RAWTOHEX(DBMS_OBFUSCATION_TOOLKIT.MD5(INPUT => TL_RAW.CAST_TO_RAW(plain_text) ));  
        END;
      
  • Реализация на Java:
    import java.math.BigInteger;
    
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    
    public class CryptoUtils {
    
        private final static char[] ALPHABET =
            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
    
        public static String sha1(String plain) {
            try {
                MessageDigest md = MessageDigest.getInstance("sha");
                md.update(plain.getBytes());
                byte[] digest = md.digest();
    
                return encode(digest);
                /* Альтернативные варианты:
                return javax.xml.bind.DatatypeConverter.printBase64Binary(digest);
                или
                return com.sun.org.apache.xml.internal.security.utils.Base64.encode(digest);
                */
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
                return null;
            }
        }
    
        public static String md5(String raw) {
            try {
                MessageDigest md = MessageDigest.getInstance("MD5");
                md.update(raw.getBytes(), 0, raw.length());
                return new BigInteger(1, md.digest()).toString(16);
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
                return null;
            }
        }
    
        public static String encode(byte[] buf) {
            int size = buf.length;
            char[] ar = new char[((size + 2) / 3) * 4];
            int a = 0;
            int i = 0;
            while (i < size) {
                byte b0 = buf[i++];
                byte b1 = (i < size) ? buf[i++] : 0;
                byte b2 = (i < size) ? buf[i++] : 0;
    
                int mask = 0x3F;
                ar[a++] = ALPHABET[(b0 >> 2) & mask];
                ar[a++] = ALPHABET[((b0 << 4) | ((b1 & 0xFF) >> 4)) & mask];
                ar[a++] = ALPHABET[((b1 << 2) | ((b2 & 0xFF) >> 6)) & mask];
                ar[a++] = ALPHABET[b2 & mask];
            }
            switch (size % 3) {
            case 1:
                ar[--a] = '=';
            case 2:
                ar[--a] = '=';
            }
            return new String(ar);
        }
    }
    

воскресенье, 29 июля 2012 г.

Управление структурой MDS с помощью MDS Explorer

  MDS Explorer - это OpenSource-проект, цель которого создание средства для доступа к Oracle MDS (Meta Data Services) репозиториям с помощью которого можно создавать, удалять, загружать, выгружать директории и файлы.
  На сайте проекта можно скачать исходники (в скомпилированном виде отсутствуют). В скомпилированном виде в одном jar-файле выкладываю здесь.
  Запуск:
  1. Выполнить следующую команду:
     java -Drepository.flavor=DB -jar MDSExplorer.jar  
    
    где DB - для доступа к репозиторию в БД;
        FILE - для доступа к репозиторию в файловой системе.
  2. Ввести параметры соединения со схемой MDS, затем нажать "Connect", выбрать нужный раздел (partition) и нажать "OK":
  3. В открывшемся окне можно выполнять действия по управлению структурой MDS:

пятница, 29 июня 2012 г.

Удаление метаданных из MDS

Все команды выполняются из wlst.cmd или wlst.sh находящегося в SOA_HOME, у меня например это:
 C:\Apps\Oracle\Weblogic\10.3.6\Oracle_SOA1\common\bin\wlst.cmd  
  • Удаление файлов
    Примечание: удаляются файлы, но не каталоги:
    1. Соединяемся с SOA-сервером:
      wls:/offline> 
       connect('weblogic','welcome1','t3://bpm-dev.mycompany.com:8001')  
      
      где weblogic - логин административного пользователя;
      welcome1 - пароль административного пользователя;
      bpm-dev.mycompany.com - хост SOA-сервера;
      8001 - порт SOA-сервера.
    2. Выполняем удаление файлов:
      wls:/soa_dev/serverConfig>
       deleteMetadata('soa-infra','soa_server1','/apps/MyComponents/**')  
      
      где soa_server1 - имя SOA-сервера;
      /apps/MyComponents - директория из которой будут удаляться файлы;
      ** - удаление в текущем каталоги в всех вложенных каталогах.
  • Удаление каталогов (рекурсивное)
    Примечание: если в удаляемом каталоге нет ни одного файла может произойти ошибка и каталог не будет удалён.
    wls:/offline>
     sca_removeSharedData('http://bpm-dev.mycompany.com:8001', 
                          'MyComponents',
                          'weblogic',
                          'welcome1')  
    
    где bpm-dev.mycompany.com - хост SOA-сервера;
    8001 - http-порт SOA-сервера;
    MyComponents - директория из корневой директории apps которую следует удалить;
    weblogic - логин административного пользователя;
    welcome1 - пароль административного пользователя.

суббота, 5 мая 2012 г.

Ошибка валидации SOA-композита при сборке на сервере Hudson

Ошибка:
При сборке композита возникает ошибка вида:
 scac:  
    [scac] Validating composite "/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/../../composite.xml"  
    [scac] info: Validating composite "/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/../../composite.xml"  
    [scac] info: Pass  
    [scac] error: location {/ns:composite}(12,61): Parse of component type files failed, check the adf-config.xml file : "oracle.fabric.common.FabricException: oracle.fabric.common.FabricException: javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: oracle.fabric.common.FabricException: javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean"  
   
 BUILD FAILED  
 /var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/build.xml:28: The following error occurred while executing this line:  
 /u01/jdeveloper11.1.1.5/jdeveloper/bin/ant-sca-package.xml:46: The following error occurred while executing this line:  
 /u01/jdeveloper11.1.1.5/jdeveloper/bin/ant-sca-compile.xml:269: Java returned: 1 Check log file : /u01/tmp/SAPRetailRegistrationInventoryComments.err for errors  
Или следующего вида:
 scac:  
    [scac] Validating composite "/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/../../composite.xml"  
    [scac] BPEL 2.0 validation of "RegistrationInventoryCommentsBPELProcess" took 391.7 milliseconds  
    [scac] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  
    [scac] >> modified xmlbean locale class in use  
    [scac] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  
    [scac] info: Validating composite "/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/../../composite.xml"  
    [scac] info: Pass  
    [scac] error: location {/ns:composite/ns:import[@location='file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/RegistrationInventoryCommentsBPELProcess.wsdl']}: Load of wsdl "ZINV_VERIF_receive.wsdl with Message part element undefined in wsdl [file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/RegistrationInventoryCommentsBPELProcess.wsdl] part name = payload     type = {urn:sap-com:document:sap:idoc}ZINV_VERIF" failed  
    [scac] error: location {/ns:composite/ns:import[@location='file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/CheckIfMsgExistsDBAdapter.wsdl']}: Load of wsdl "ZINV_VERIF_receive.wsdl with Message part element undefined in wsdl [file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/CheckIfMsgExistsDBAdapter.wsdl] part name = OutputParameters     type = {http://xmlns.oracle.com/pcbpel/adapter/db/RTKESBPROTO/INTEGRATION_PKG/CHECK_IF_MSG_EXISTS/}OutputParameters" failed  
    [scac] error: location {/ns:composite/ns:import[@location='http://oracle-sb.tsretail.ru:9030/soa-infra/directWsdl/SAP/SAPRetailRegistrationCommon/RegistrationCommonService?resource=%2FRegistrationCommonService.wsdl']}(20,30): Load of wsdl "ZINV_VERIF_receive.wsdl with Message part element undefined in wsdl [http://oracle-sb.tsretail.ru:9030/soa-infra/directWsdl/SAP/SAPRetailRegistrationCommon/RegistrationCommonService?resource=%2FRegistrationCommonService.wsdl] part name = payload     type = {http://www.tsretail.ru/integration/sap/retail}registration_reply" failed  
    [scac] error: location {/ns:composite/ns:import[@location='file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/RegistrationCommonServiceWrapper.wsdl']}: Load of wsdl "ZINV_VERIF_receive.wsdl with Message part element undefined in wsdl [http://oracle-sb.tsretail.ru:9030/soa-infra/directWsdl/SAP/SAPRetailRegistrationCommon/RegistrationCommonService?resource=%2FRegistrationCommonService.wsdl] part name = payload     type = {http://www.tsretail.ru/integration/sap/retail}registration_reply" failed  
    [scac] error: location {/ns:composite/ns:import[@location='http://oracle-sb.tsretail.ru:9030/soa-infra/directWsdl/SAP/SAPRetailRegistrationCommon/RegistrationCommonService?resource=%2FRegistrationCommonService.wsdl']}(20,30): Load of wsdl "ZINV_VERIF_receive.wsdl with Message part element undefined in wsdl [http://oracle-sb.tsretail.ru:9030/soa-infra/directWsdl/SAP/SAPRetailRegistrationCommon/RegistrationCommonService?resource=%2FRegistrationCommonService.wsdl] part name = payload     type = {http://www.tsretail.ru/integration/sap/retail}registration_reply" failed  
    [scac] error: location {/ns:composite/ns:import[@location='file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/ZINV_VERIF_receive.wsdl']}: Load of wsdl "ZINV_VERIF_receive.wsdl with Message part element undefined in wsdl [file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/ZINV_VERIF_receive.wsdl] part name = event_ZINV_VERIF     type = {urn:sap-com:document:sap:idoc}ZINV_VERIF" failed  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(38): Error loading schema from file:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/RegistrationInventoryCommentsBPELProcess.wsdl [Cause=Error in getting XML input stream: oramds:/apps/core.xsd: Error encountered while creating the MDS Session]  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(81): "element" is set to "ns4:error" on this <bpel:variable> but it cannot be resolved (check value of "element", imports, WSDLs or XSDs).  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(94): "element" is set to "ns8:comments" on this <bpel:variable> but it cannot be resolved (check value of "element", imports, WSDLs or XSDs).  
    [scac] info: in RegistrationInventoryCommentsBPELProcess.bpel(100): Copy rule not checked - from-spec type-of "xsd:string", to-spec type-of "unspecified".  
    [scac] info: in RegistrationInventoryCommentsBPELProcess.bpel(104): Copy rule not checked - from-spec type-of "xsd:string", to-spec type-of "unspecified".  
    [scac] info: in RegistrationInventoryCommentsBPELProcess.bpel(108): Copy rule not checked - from-spec type-of "xsd:string", to-spec type-of "unspecified".  
    [scac] info: in RegistrationInventoryCommentsBPELProcess.bpel(112): Copy rule not checked - from-spec type-of "xsd:string", to-spec type-of "unspecified".  
    [scac] info: in RegistrationInventoryCommentsBPELProcess.bpel(116): Copy rule not checked - from-spec type-of "xsd:string", to-spec type-of "unspecified".  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(146): Variable "OnMessage_process_InputVariable" does not have a part named "payload" - check expression segment "$OnMessage_process_InputVariable.payload"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(160): Variable "OnMessage_ZINV_VERIF_InputVariable" does not have a part named "event_ZINV_VERIF" - check expression segment "$OnMessage_ZINV_VERIF_InputVariable.event_ZINV_VERIF"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(160): The XPath segment "child::ns5:IDOC" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(161): Variable "InvokeCheckIfMsgExists_InputVariable" does not have a part named "InputParameters" - check expression segment "$InvokeCheckIfMsgExists_InputVariable.InputParameters"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(161): The XPath segment "child::ns6:P_IN_MSG_SYS_ID" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(165): Variable "InvokeCheckIfMsgExists_InputVariable" does not have a part named "InputParameters" - check expression segment "$InvokeCheckIfMsgExists_InputVariable.InputParameters"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(165): The XPath segment "child::ns6:P_IN_MSG_TYPE" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(177): Variable "InvokeCheckIfMsgExists_OutputVariable" does not have a part named "OutputParameters" - check expression segment "$InvokeCheckIfMsgExists_OutputVariable.OutputParameters"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(177): The XPath segment "child::ns6:P_ERR_CODE" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(184): Variable "InvokeCheckIfMsgExists_OutputVariable" does not have a part named "OutputParameters" - check expression segment "$InvokeCheckIfMsgExists_OutputVariable.OutputParameters"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(184): The XPath segment "child::ns6:P_ERR_MESSAGE" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(188): Variable "InvokeCheckIfMsgExists_OutputVariable" does not have a part named "OutputParameters" - check expression segment "$InvokeCheckIfMsgExists_OutputVariable.OutputParameters"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(188): The XPath segment "child::ns6:P_ERR_CODE" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(199): Variable "InvokeCheckIfMsgExists_OutputVariable" does not have a part named "OutputParameters" - check expression segment "$InvokeCheckIfMsgExists_OutputVariable.OutputParameters"  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(199): The XPath segment "child::ns6:P_RESULT" cannot be resolved.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(210): Variable "OnMessage_ZINV_VERIF_InputVariable" does not have a part named "event_ZINV_VERIF" - check expression segment "$OnMessage_ZINV_VERIF_InputVariable.event_ZINV_VERIF"  
    [scac] warning: in RegistrationInventoryCommentsBPELProcess.bpel(211): The node <bpel:to> refers to a bpel:variable (via the attribute "variable") - this bpel:variable needs to be defined correctly.  
    [scac] error: in RegistrationInventoryCommentsBPELProcess.bpel(219): Variable "OnMessage_ZINV_VERIF_InputVariable" does not have a part named "event_ZINV_VERIF" - check expression segment "$OnMessage_ZINV_VERIF_InputVariable.event_ZINV_VERIF"  
    [scac] info: File to validate does not exist fault-policies.xml:/var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/../../fault-policies.xml (No such file or directory)  
    [scac] info: Checking validateMessages....testsuites/SAPRetailRegistrationInventoryComments/messages  
    [scac] info: Begin validateIncludes....testsuites/SAPRetailRegistrationInventoryComments/includes  
    [scac] info: Begin validateTests....testsuites/SAPRetailRegistrationInventoryComments/tests  
    [scac] info:      Check validateTestDocument....testsuites/SAPRetailRegistrationInventoryComments/tests/CommonRegistration-Test.xml  
    [scac] info:      Check doSchemaValidation....testsuites/SAPRetailRegistrationInventoryComments/tests/CommonRegistration-Test.xml  
    [scac] info:      Check isSetInitiate ....testsuites/SAPRetailRegistrationInventoryComments/tests/CommonRegistration-Test.xml  
    [scac] info:      Check WireActionsModel ....testsuites/SAPRetailRegistrationInventoryComments/tests/CommonRegistration-Test.xml  
    [scac] info:      Check WireActionsModel ....testsuites/SAPRetailRegistrationInventoryComments/tests/CommonRegistration-Test.xml  
    [scac] info:      validateTestDocument Pass  
    [scac] info: validateTests Pass  
   
 BUILD FAILED  
 /var/lib/hudson/jobs/SAPRetailRegistrationInventoryComments/workspace/tools/ant/build.xml:39: The following error occurred while executing this line:  
 /u01/jdeveloper11.1.1.5/jdeveloper/bin/ant-sca-package.xml:46: The following error occurred while executing this line:  
 /u01/jdeveloper11.1.1.5/jdeveloper/bin/ant-sca-compile.xml:269: Java returned: 1 Check log file : /u01/tmp/SAPRetailRegistrationInventoryComments.err for errors  
   
 Total time: 4 seconds  
 Recording test results  
 [DEBUG] Skipping watched dependency update for build: SAPRetailRegistrationInventoryComments #31 due to result: FAILURE  
 Finished: FAILURE  

Причина:
Проблема с доступом к MDS-репозиторию или к сервису через механизм прямого связывания.

Вариант решения:
Разобраться почему не удается получить доступ (лучший вариант) или убрать валидацию композита при сборке (но до этого убедится в успешной валидации на рабочей станции), для этого:
  1. Перейти в директорию в которой установлен Oracle JDeveloper:
     $ cd /u01/jdeveloper11.1.1.5/  
    
  2. Перейти в директорию с Ant-скриптами для SOA Suite:
     $ cd jdeveloper/bin  
    
  3. Забэкапить файл ant-sca-package.xml:
     $ cp ant-sca-package.xml ant-sca-package.xml.original
    
  4. Изменить файл ant-sca-package.xml:
     $ vi ant-sca-package.xml
  5. Найти в нём следующие строки:
      ...
        <target name="scac-validate" depends="init">  
          <echo message="Running scac-validate in ${scac.input}"/>  
          <antcall target="scac" inheritall="true"/>   
        </target>  
      ...
    
    Заменить их на следующие:
      ...
        <target name="scac-validate" depends="init">  
          <echo message="Running scac-validate in ${scac.input}"/>  
          <!--antcall target="scac" inheritall="true"/-->  
          <echo message="Skipping scac-validate in ${scac.input}"/>  
        </target>  
      ...
    

пятница, 4 мая 2012 г.

Непрерывная интеграция для Oracle SOA Suite 11g. Альтернативный вариант

Программное обеспечение:
  • Сервер непрерывной интеграции: 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-проекта.
Последовательность шагов:
  1. Скачиваем дистрибутив Hudson с официального сайта и устанавливаем его.
  2. Создать тестовое SOA-приложение (в нашем случае это HelloWorldApplication), включая автотесты для этого приложения (подробнее об их создании для Oracle SOA Suite здесь).
  3. Добавим в SOA-проект директорию tools, а в неё конфигурационный файл с именем project.properties:
    Следующего содержания:
     project.name=HelloWorldProject
     project.revision=1.0
     project.partition=test  
    
  4. Для композита сгенерировать "Configuration Plan":
  5. Отредактировать конфигурационный файл build.properties находящийся в директории SOA-проект/tools/ant/:
     # 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  
    
    Если структура SVN-репозитория идентична структуре описанной на шаге 2, то изменить значения параметров выделенных красным и настройки развертывания.
  6. Отредактировать конфигурационный файл для каждого окружения (в нашем тестовом примере будем использовать только 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  
    
  7. Теперь настроим Hudson на наш тестовый пример.
    1. Зайти в консоль Hudson, затем "Настроить Hudson" -> "Конфигурирование системы":
    2. Добавляем в секцию JDK используемую версию, а в секцию Ant добавляем входящий в состав JDeveloper из директории jdeveloper/ant:
    3. Создать новую задачу для нашего SOA-проекта (для этого нажать "Новая задача" в консоли Hudson):
    4. Откроется меня настройки проекта (или нажать "Настроить проект"). В "Управление исходным кодом" выбрать "Subversion" и ввести "URL репозитория" - в нашем случае указываем путь до SOA-проекта:
      Если используется авторизация, то нажать "enter credential" и ввести параметры авторизации:
    5. В секции "Триггеры сборки" выбрать "Опрашивать SCM об изменениях" и ввести в поле расписание значение "* * * * *" (это значит что опрашивать каждую минуту):
    6. В секции "Сборка" выбрать "Добавить шаг сборки" и далее выбрать "Вызвать Ant":
    7. Заполнить поля следующим образом:
      • Версия Ant - jdev_ant;
      • Цели - deployProject;
      • Сборочный файл - tools/ant/build.xml;
      • Опции Java - -Dbasedir=/u01/jdeveloper11.1.1.5/jdeveloper/bin
    8. В секции "Послесборочные операции" выбрать "Publish JUnit test result report" и ввести значение "*.xml":
    9. Сохранить все настройки.
  8. Протестируем работоспособность.
    1. Изменяем любой файл в SVN-репозитории (в течении одной минуты будет запущена сборка);
    2. Нажав на кнопку "Собрать сейчас":
    Для просмотра технической информации по сборке, развертыванию, выполнению тестов можно увидеть в консоли задачи:
    Пример:
     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  
    
Исходные тексты используемого SOA-проекта здесь.