professional software development using apex rob van wijk

68
Professional Software Development using APEX Rob van Wijk

Upload: camryn-wink

Post on 01-Apr-2015

260 views

Category:

Documents


19 download

TRANSCRIPT

Page 1: Professional Software Development using APEX Rob van Wijk

Professional Software Development using APEX

Rob van Wijk

Page 2: Professional Software Development using APEX Rob van Wijk

Rob van Wijk since 1972

Oracle since 1995

Ciber since 2003

Oracle ACE since 2008

Oracle University SQL Masterclass since 2011

Forums: OTN & Stack Overflow

Blog: rwijk.blogspot.com

Twitter: @rwijk

About me

Page 3: Professional Software Development using APEX Rob van Wijk

Starting with HTMLDB/APEX since 2005

Own APEX website www.robstourpoules.nl since 2009

Programming OGh APEX day conference since 2010

Ciber APEXSoFa since early 2012

Working with APEX since November 2012

My APEX experience

Page 4: Professional Software Development using APEX Rob van Wijk

Development User AcceptanceTest

Page 5: Professional Software Development using APEX Rob van Wijk

pro·fes·sion·al [pruh-fesh-uh-nl]

adjective

3. appropriate to a profession: professional objectivity.

Source: http://dictionary.reference.com/browse/professional?s=t

Page 6: Professional Software Development using APEX Rob van Wijk

Do you use source control?

Can you make a build in one step?

Do you make daily builds?

Do you have a bug database?

Do you fix bugs before writing new code?

Do you have an up-to-date schedule?

Do you have a spec?

Do programmers have quiet working conditions?

Do you use the best tools money can buy?

Do you have testers?

Do new candidates write code during their interview?

Do you do hallway usability testing?

The Joel Test

Source: http://www.joelonsoftware.com/articles/fog0000000043.html

Page 7: Professional Software Development using APEX Rob van Wijk

Do you use source control?

Can you make a build in one step?

Do you make daily builds?

Do you have a bug database?

Do you fix bugs before writing new code?

Do you have an up-to-date schedule?

Do you have a spec?

Do programmers have quiet working conditions?

Do you use the best tools money can buy?

Do you have testers?

Do new candidates write code during their interview?

Do you do hallway usability testing?

The Joel Test

Source: http://www.joelonsoftware.com/articles/fog0000000043.html

Page 8: Professional Software Development using APEX Rob van Wijk

1. Version Control2. Parallel Development3. One-Step Build4. Daily Build5. Unit Testing

Agenda

Page 9: Professional Software Development using APEX Rob van Wijk

1. Version Control

Page 10: Professional Software Development using APEX Rob van Wijk

Goal

The entire application can be installed completely from files under version control

Page 11: Professional Software Development using APEX Rob van Wijk
Page 12: Professional Software Development using APEX Rob van Wijk

svn repository

tekstsvn

chec

kout

svn c

omm

itsv

n u

pdate

Page 13: Professional Software Development using APEX Rob van Wijk

Subversion client for Windows:

Page 14: Professional Software Development using APEX Rob van Wijk

Subversion client for Mac:Cornerstone

Page 15: Professional Software Development using APEX Rob van Wijk

Oracle Application ExpressOracle Application ExpressAPEX_040100 schemaAPEX_040100 schema

DATA schemaDATA schemaTables, Data, Indexes, SequencesTables, Data, Indexes, Sequences

UI schema, APEX’s parsing schemaUI schema, APEX’s parsing schemaviews and packages containing minimal set of API layer callsviews and packages containing minimal set of API layer calls

API schemaAPI schemaDatabase packages with business logicDatabase packages with business logic

views selectingfrom tables

select, insert, update & delete

API calls

Page 16: Professional Software Development using APEX Rob van Wijk

Minimal system privileges

No CREATE SESSION privilege

Password generated with dbms_random.string(‘a’,30)

UI, API & DATA schema

Page 17: Professional Software Development using APEX Rob van Wijk
Page 18: Professional Software Development using APEX Rob van Wijk

APEXExport

APEXExportSplitter

Page 19: Professional Software Development using APEX Rob van Wijk
Page 20: Professional Software Development using APEX Rob van Wijk

META schema

SQL> select * from meta.mta_applications 2 /CODE NAME APEX_APPLICATION_ID---------- ------------------------------------------------- -------------------CV Ciber CV's 1SCA Standen Collectie Applicatie 22 rows selected.

Page 21: Professional Software Development using APEX Rob van Wijk

META schema

SQL> desc meta.mta_admin...PROCEDURE ADD_APPLICATION Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_CODE VARCHAR2(10) IN P_NAME VARCHAR2(50) IN P_APEX_APPLICATION_ID NUMBER(5) IN

...FUNCTION APEX_APPLICATION_ID RETURNS NUMBER Argument Name Type

In/Out Default? ------------------------------ ----------------------- ------ -------- P_APP_CODE VARCHAR2(10) IN...PROCEDURE REMOVE_APPLICATION Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_CODE VARCHAR2(10) IN...

Page 22: Professional Software Development using APEX Rob van Wijk

A challenge with APEX and file based version control

Page 23: Professional Software Development using APEX Rob van Wijk

Your APEX working copy

Your APEX workspace application

Page 24: Professional Software Development using APEX Rob van Wijk

get the delta from your APEX workspace into your working copysvn update

put your colleagues’ changes plus your delta back into your APEX workspace

Page 25: Professional Software Development using APEX Rob van Wijk

rm -rf $HOME/ciber/apexsofa/$1/apexcd $HOME/ciber/apexsofa/$1java oracle.apex.APEXExport\ -db ourserver:1521:APEXSOFAO\ -user apex_040100\ -password secret\ -applicationid $2\ -skipExportDatejava oracle.apex.APEXExportSplitter f$2.sqlmv f$2 apexcd apexsed s_@application_@$1/apex/application_\ <install.sql\ >../non-apex/install/install_apex_components.sqlsvn status | grep ^\? | awk '{print $2}' | xargs svn addsvn status | grep ^\! | awk '{print $2}' | xargs svn delete --forcesvn updatecd ... non-apex/install/reinstall_apex

zz

zz

Page 26: Professional Software Development using APEX Rob van Wijk

MacBookPro:application robvanwijk$ svn update Conflict discovered in 'pages/page_00004.sql'.

Select: (p) postpone, (df) diff-full, (e) edit,

(mc) mine-conflict, (tc) theirs-conflict,

(s) show all options: p

C pages/page_00004.sql

Updated to revision 96.

Summary of conflicts:

Text conflicts: 1

MacBookPro:application robvanwijk$ ls page_00004.sql*

page_00004.sql page_00004.sql.mine

page_00004.sql.r95 page_00004.sql.r96

Merge conflict

Page 27: Professional Software Development using APEX Rob van Wijk

wwv_flow_api.create_page_button(

p_id => 9921078634714986 + wwv_flow_api.g_id_offset,

p_flow_id => wwv_flow.g_flow_id,

p_flow_step_id => 4,

p_button_sequence=> 10,

p_button_plug_id => 9918676911714819+wwv_flow_api.g_id_offset,

p_button_name => 'CREATE',

p_button_action => 'REDIRECT_PAGE',

p_button_image => 'template:'||to_char(11795888447107612+wwv_flow_api.g_id_offset),

p_button_is_hot=>'N',

<<<<<<< .mine

p_button_image_alt=> 'Maak aan',

=======

p_button_image_alt=> 'Aanmaken',

>>>>>>> .r96

p_button_position=> 'REGION_TEMPLATE_CREATE',

p_button_alignment=> 'RIGHT',

p_button_redirect_url=> 'f?p=&APP_ID.:5:&SESSION.::&DEBUG.:5',

p_required_patch => null + wwv_flow_api.g_id_offset);

Merge conflict

Page 28: Professional Software Development using APEX Rob van Wijk

whenever sqlerror exit failure

Page 29: Professional Software Development using APEX Rob van Wijk

Development database

APEXAPEXWorkspace CiberWorkspace Ciber

CV SCACV SCA

SchemaSchemaSCA_UISCA_UI

SchemaSchemaSCA_APISCA_API

SchemaSchemaSCA_DATASCA_DATA

SchemaSchemaCV_UICV_UI

SchemaSchemaCV_APICV_API

SchemaSchemaCV_DATACV_DATA

SchemaSchemaMETAMETA

User User INSTALLINSTALL

Page 30: Professional Software Development using APEX Rob van Wijk

2. Parallel Development

Page 31: Professional Software Development using APEX Rob van Wijk

“The developer should be free to experiment as much as possible, safe in the knowledge

that the worst that could happen is they destroy only their own environment and not

impact the productivity of others.” - Nick Ashley

Source:

http://dbdeploy.com/documentation/taking-control-of-your-database-development-white-paper/

Page 32: Professional Software Development using APEX Rob van Wijk

each developer has its ownfour database schemas, for instance:

RWIJKRWIJK_UIRWIJK_API

RWIJK_DATA

Page 33: Professional Software Development using APEX Rob van Wijk

and each developer has its ownAPEX workspace

Page 34: Professional Software Development using APEX Rob van Wijk

Development database

APEXAPEXWorkspace CiberWorkspace Ciber

CV SCACV SCA

SchemaSchemaSCA_UISCA_UI

SchemaSchemaSCA_APISCA_API

SchemaSchemaSCA_DATASCA_DATA

SchemaSchemaCV_UICV_UI

SchemaSchemaCV_APICV_API

SchemaSchemaCV_DATACV_DATA

SchemaSchemaMETAMETA

User User INSTALLINSTALL

Workspace Workspace RWIJKRWIJKSCASCA

SchemaSchemaRWIJK_UIRWIJK_UI

SchemaSchemaRWIJK_APIRWIJK_API

SchemaSchemaRWIJK_DATARWIJK_DATA

Workspace MPLASWorkspace MPLASCV SCACV SCA

SchemaSchemaMPLAS_UIMPLAS_UI

SchemaSchemaMPLAS_APIMPLAS_API

SchemaSchemaMPLAS_DATAMPLAS_DATA

UserUserRWIJKRWIJK

UserUserMPLASMPLAS

Page 35: Professional Software Development using APEX Rob van Wijk

META schema

SQL> select code 2 , name 3 , apex_application_id_from 4 , apex_application_id_until 5 from meta.mta_developers 6 /CODE NAME APEX_APPLICATION_ID_FROM APEX_APPLICATION_ID_UNTIL---------- ------------------- ------------------------ -------------------------RWIJK Rob van Wijk 10000 10999MPLAS Marcel van der Plas 11000 11999MHOEFS Marcel Hoefs 12000 12999EASLAN Erdal Aslan 13000 13999ASUVEREIN Arne Suverein 14000 14999EHAMERS Etienne Hamers 15000 15999LSAVALKA Larysa Savalka 16000 169997 rows selected.

Page 36: Professional Software Development using APEX Rob van Wijk

META schema

SQL> desc meta.mta_admin...PROCEDURE ADD_DEVELOPER Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_CODE VARCHAR2(10) IN P_NAME VARCHAR2(30) IN P_APEX_APPLICATION_ID_FROM NUMBER(5) IN P_APEX_APPLICATION_ID_UNTIL NUMBER(5) IN

...PROCEDURE REMOVE_DEVELOPER Argument Name Type In/Out Default?

------------------------------ ----------------------- ------ -------- P_CODE VARCHAR2(10) IN...

Page 37: Professional Software Development using APEX Rob van Wijk

META schema

SQL> select dev_code 2 , app_code 3 , apex_application_id 4 from meta.mta_application_copies 5 order by apex_application_id 6 /DEV_CODE APP_CODE APEX_APPLICATION_ID---------- ---------- ------------------RWIJK CV 10000RWIJK SCA 10001MPLAS CV 11000MPLAS SCA 11001MHOEFS SCA 12000MHOEFS CV 12001EASLAN SCA 13000EASLAN CV 13001ASUVEREIN SCA 14000EHAMERS SCA 15000LSAVALKA SCA 16000LSAVALKA CV 1600112 rows selected.

Page 38: Professional Software Development using APEX Rob van Wijk

META schema

SQL> desc meta.mta_admin...PROCEDURE ADD_APPLICATION_COPY Argument Name Type In/Out

Default? ------------------------------ ----------------------- ------ -------- P_DEV_CODE VARCHAR2(10) IN P_APP_CODE VARCHAR2(10) IN P_APEX_APPLICATION_ID NUMBER(5) IN DEFAULT

FUNCTION APEX_APPLICATION_ID RETURNS NUMBER Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_APP_CODE VARCHAR2(10) IN P_SCHEMAPREFIX VARCHAR2 INFUNCTION APEX_WORKSPACE_ID RETURNS NUMBER Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_SCHEMAPREFIX VARCHAR2 INPROCEDURE REMOVE_APPLICATION_COPY Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_DEV_CODE VARCHAR2(10) IN P_APP_CODE VARCHAR2(10) IN

...

Page 39: Professional Software Development using APEX Rob van Wijk

set define offset verify offset feedback offWHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACKbegin wwv_flow.g_import_in_progress := true; end; / --application/set_environmentprompt APPLICATION 10001 - SCA---- Application Export:-- Application: 10001-- Name: SCA-- Exported By: -- Flashback: 0-- Export Type: Application Export-- Version: 4.1.1.00.23-- Instance ID: 63130648066820 -- Import:-- Using application builder-- or-- Using SQL*Plus as the Oracle user APEX_040100 or as the owner (parsing schema) of the application. -- Application Statistics:-- Pages: 2-- Items: 3-- Computations: 0-- Validations: 0-- Processes: 4-- Regions: 2-- Buttons: 0-- Dynamic Actions: 0-- Shared Components-- Breadcrumbs: 1-- Entries 1-- Items: 0-- Computations: 0-- Processes: 0-- Parent Tabs: 0-- Tab Sets: 0-- Tabs: 0-- NavBars: 1-- Lists: 0-- Shortcuts: 0-- Themes: 1-- Templates:-- Page: 17-- List: 17-- Report: 11-- Label: 6-- Region: 34-- Messages: 0-- Build Options: 0 -- AAAA PPPPP EEEEEE XX XX-- AA AA PP PP EE XX XX-- AA AA PP PP EE XX XX-- AAAAAAAAAA PPPPP EEEE XXXX-- AA AA PP EE XX XX-- AA AA PP EE XX XX-- AA AA PP EEEEEE XX XXprompt Set Credentials... begin -- Assumes you are running the script connected to SQL*Plus as the Oracle user APEX_040100 or as the owner (parsing schema) of the

application. wwv_flow_api.set_security_group_id(p_security_group_id=>nvl(wwv_flow_application_install.get_workspace_id,1597919183057345)); end;/

begin wwv_flow.g_import_in_progress := true; end;/begin

select value into wwv_flow_api.g_nls_numeric_chars from nls_session_parameters where parameter='NLS_NUMERIC_CHARACTERS';

end;

/begin execute immediate 'alter session set nls_numeric_characters=''.,''';

end;

/begin wwv_flow.g_browser_language := 'en'; end;/prompt Check Compatibility... begin -- This date identifies the minimum version required to import this file.wwv_flow_api.set_version(p_version_yyyy_mm_dd=>'2011.02.12'); end;/

prompt Set Application ID... begin -- SET APPLICATION ID wwv_flow.g_flow_id := nvl(wwv_flow_application_install.get_application_id,10001); wwv_flow_api.g_id_offset := nvl(wwv_flow_application_install.get_offset,0);null; end;/

--application/delete_application begin -- Remove Applicationwwv_flow_api.remove_flow(nvl(wwv_flow_application_install.get_application_id,10001)); end;/

begin wwv_flow_audit.remove_audit_trail(nvl(wwv_flow_application_install.get_application_id,10001));null; end;/

--application/create_application begin wwv_flow_api.create_flow( p_id => nvl(wwv_flow_application_install.get_application_id,10001), p_display_id=> nvl(wwv_flow_application_install.get_application_id,10001), p_owner => nvl(wwv_flow_application_install.get_schema,'RWIJK_UI'), p_name => nvl(wwv_flow_application_install.get_application_name,'SCA'), p_alias => nvl(wwv_flow_application_install.get_application_alias,'F10001'), p_page_view_logging => 'YES', p_default_page_template=> 1912001052247903 + wwv_flow_api.g_id_offset, p_printer_friendly_template=> 1912806466247909 + wwv_flow_api.g_id_offset, p_default_region_template=> 1916306363247913 + wwv_flow_api.g_id_offset, p_error_template=> 1911932173247903 + wwv_flow_api.g_id_offset, p_page_protection_enabled_y_n=> 'Y', p_checksum_salt_last_reset => '20120606162931', p_max_session_length_sec=> null, p_compatibility_mode=> '4.1', p_home_link=> 'f?p=&APP_ID.:1:&SESSION.', p_flow_language=> 'nl', p_flow_language_derived_from=> 'FLOW_PRIMARY_LANGUAGE', p_allow_feedback_yn=> 'N', p_date_format=> 'dd-mm-yyyy', p_date_time_format=> 'dd-mm-yyyy hh24:mi:ss', p_timestamp_format=> 'dd-mm-yyyy hh24:mi:ssxff', p_timestamp_tz_format=> 'dd-mm-yyyy hh24:mi:ssxff tzr', p_flow_image_prefix => nvl(wwv_flow_application_install.get_image_prefix,'/i/'), p_publish_yn=> 'N', p_documentation_banner=> '', p_authentication=> 'PLUGIN', p_authentication_id=> 1921907684247927 + wwv_flow_api.g_id_offset, p_login_url=> '', p_logout_url=> '', p_application_tab_set=> 0, p_public_url_prefix => '', p_public_user=> '', p_dbauth_url_prefix => '', p_proxy_server=> nvl(wwv_flow_application_install.get_proxy,''), p_cust_authentication_process=> '', p_cust_authentication_page=> '', p_custom_auth_login_url=> '', p_flow_version=> 'release 1.0', p_flow_status=> 'AVAILABLE_W_EDIT_LINK', p_flow_unavailable_text=> '', p_build_status=> 'RUN_AND_BUILD', p_exact_substitutions_only=> 'Y', p_browser_cache=>'N', p_browser_frame=>'D', p_vpd=> '', p_vpd_teardown_code=> '', p_csv_encoding=> 'Y', p_default_error_display_loc=> 'INLINE_WITH_FIELD_AND_NOTIFICATION', p_theme_id => 24, p_default_label_template => 1920401041247919 + wwv_flow_api.g_id_offset, p_default_report_template => 1919720720247918 + wwv_flow_api.g_id_offset, p_default_list_template => 1918827351247916 + wwv_flow_api.g_id_offset, p_default_menu_template => 1920822858247920 + wwv_flow_api.g_id_offset, p_default_button_template => 1913323201247909 + wwv_flow_api.g_id_offset, p_default_chart_template => 1914710909247912 + wwv_flow_api.g_id_offset, p_default_form_template => 1915032456247912 + wwv_flow_api.g_id_offset, p_default_wizard_template => 1917131204247913 + wwv_flow_api.g_id_offset, p_default_tabform_template => 1916306363247913 + wwv_flow_api.g_id_offset, p_default_reportr_template =>1916306363247913 + wwv_flow_api.g_id_offset, p_default_menur_template => 1914316460247912 + wwv_flow_api.g_id_offset, p_default_listr_template => 1914621431247912 + wwv_flow_api.g_id_offset, p_default_irr_template => 1915417634247912 + wwv_flow_api.g_id_offset, p_last_updated_by => 'RWIJK', p_last_upd_yyyymmddhh24miss=> '20120606162931', p_required_roles=> wwv_flow_utilities.string_to_table2('')); end;/

prompt ...authorization schemes-- begin null; end;/

--application/shared_components/navigation/navigation_barprompt ...navigation bar entries-- begin wwv_flow_api.create_icon_bar_item( p_id => 1921827834247925 + wwv_flow_api.g_id_offset, p_flow_id => wwv_flow.g_flow_id, p_icon_sequence=> 200, p_icon_image => '', p_icon_subtext=> 'Logout', p_icon_target=> '&LOGOUT_URL.', p_icon_image_alt=> 'Logout', p_icon_height=> 32, p_icon_width=> 32, p_icon_height2=> 24, p_icon_width2=> 24, p_nav_entry_is_feedback_yn => 'N', p_icon_bar_disp_cond=> '', p_icon_bar_disp_cond_type=> '', p_begins_on_new_line=> '', p_cell_colspan => 1, p_onclick=> '', p_icon_bar_comment=> ''); end;/

prompt ...application processes--prompt ...application items--prompt ...application level computations-- begin null; end;/

prompt ...Application Tabs-- begin null; end;/

prompt ...Application Parent Tabs-- begin null; end;/

prompt ...Shared Lists of values--prompt ...Application Trees----application/pages/page_groupsprompt ...page groups-- begin null; end;/

--application/pages/page_00001prompt ...PAGE 1: Page 1-- begin wwv_flow_api.create_page ( p_flow_id => wwv_flow.g_flow_id ,p_id => 1 ,p_name => 'Page 1' ,p_step_title => 'Page 1' ,p_step_sub_title => 'Page 1' ,p_step_sub_title_type => 'TEXT_WITH_SUBSTITUTIONS' ,p_include_apex_css_js_yn => 'Y' ,p_cache_page_yn => 'N' ,p_help_text => 'No help is available for this page.' ,p_last_upd_yyyymmddhh24miss => '20120606162931' );null; end;/

declare s varchar2(32767) := null; l_clob clob; l_length number := 1;begins := null;wwv_flow_api.create_page_plug ( p_id=> 1923429404247939 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_page_id=> 1, p_plug_name=> 'Breadcrumbs', p_region_name=>'', p_escape_on_http_output=>'N', p_plug_template=> 1914316460247912+ wwv_flow_api.g_id_offset, p_plug_display_sequence=> 1, p_plug_display_column=> 1, p_plug_display_point=> 'REGION_POSITION_01', p_plug_source=> s, p_plug_source_type=> 'M'|| to_char(1923025113247937 + wwv_flow_api.g_id_offset), p_menu_template_id=> 1920822858247920+ wwv_flow_api.g_id_offset, p_plug_query_row_template=> 1, p_plug_query_headings_type=> 'COLON_DELMITED_LIST', p_plug_query_row_count_max => 500, p_plug_display_condition_type => '', p_plug_caching=> 'NOT_CACHED', p_plug_comment=> '');end;/ begin null; end;/

begin null; end;/

begin ----------------------------------------- ...updatable report columns for page 1-- begin null;end;null; end;/

--application/pages/page_00101prompt ...PAGE 101: Login-- begin wwv_flow_api.create_page ( p_flow_id => wwv_flow.g_flow_id ,p_id => 101 ,p_name => 'Login' ,p_alias => 'LOGIN' ,p_step_title => 'Login' ,p_step_sub_title_type => 'TEXT_WITH_SUBSTITUTIONS' ,p_first_item => 'AUTO_FIRST_ITEM' ,p_include_apex_css_js_yn => 'Y' ,p_autocomplete_on_off => 'OFF' ,p_step_template => 1911602557247902 + wwv_flow_api.g_id_offset ,p_page_is_public_y_n => 'Y' ,p_cache_page_yn => 'N' ,p_last_upd_yyyymmddhh24miss => '20120606162931' );null; end;/

declare s varchar2(32767) := null; l_clob clob; l_length number := 1;begins := null;wwv_flow_api.create_page_plug ( p_id=> 1922223885247934 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_page_id=> 101, p_plug_name=> 'Login', p_region_name=>'', p_escape_on_http_output=>'N', p_plug_template=> 1915032456247912+ wwv_flow_api.g_id_offset, p_plug_display_sequence=> 10, p_plug_display_column=> 1, p_plug_display_point=> 'AFTER_SHOW_ITEMS', p_plug_source=> s, p_plug_source_type=> 'STATIC_TEXT', p_plug_query_row_template=> 1, p_plug_query_headings_type=> 'COLON_DELMITED_LIST', p_plug_query_row_count_max => 500, p_plug_display_condition_type => '', p_plug_caching=> 'NOT_CACHED', p_plug_comment=> '');end;/ begin null; end;/

begin null; end;/

declare h varchar2(32767) := null;beginwwv_flow_api.create_page_item( p_id=>1922330433247936 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id=> 101, p_name=>'P101_USERNAME', p_data_type=> '', p_is_required=> false, p_accept_processing=> 'REPLACE_EXISTING', p_item_sequence=> 10, p_item_plug_id => 1922223885247934+wwv_flow_api.g_id_offset, p_use_cache_before_default=> '', p_prompt=>'Username', p_display_as=> 'NATIVE_TEXT_FIELD', p_lov_display_null=> 'NO', p_lov_translated=> 'N', p_cSize=> 40, p_cMaxlength=> 100, p_cHeight=> null, p_begin_on_new_line=> 'YES', p_begin_on_new_field=> 'YES', p_colspan=> 2, p_rowspan=> 1, p_label_alignment=> 'RIGHT', p_field_alignment=> 'LEFT', p_field_template=> 1920401041247919+wwv_flow_api.g_id_offset, p_is_persistent=> 'Y', p_attribute_01 => 'N', p_attribute_02 => 'N', p_attribute_03 => 'N', p_item_comment => ''); end;/

declare h varchar2(32767) := null;beginwwv_flow_api.create_page_item( p_id=>1922426816247936 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id=> 101, p_name=>'P101_PASSWORD', p_data_type=> '', p_is_required=> false, p_accept_processing=> 'REPLACE_EXISTING', p_item_sequence=> 20, p_item_plug_id => 1922223885247934+wwv_flow_api.g_id_offset, p_use_cache_before_default=> '', p_prompt=>'Password', p_display_as=> 'NATIVE_PASSWORD', p_lov_display_null=> 'NO', p_lov_translated=> 'N', p_cSize=> 40, p_cMaxlength=> 100, p_cHeight=> null, p_begin_on_new_line=> 'YES', p_begin_on_new_field=> 'YES', p_colspan=> 1, p_rowspan=> 1, p_label_alignment=> 'RIGHT', p_field_alignment=> 'LEFT', p_field_template=> 1920401041247919+wwv_flow_api.g_id_offset, p_is_persistent=> 'Y', p_attribute_01 => 'Y', p_attribute_02 => 'Y', p_item_comment => ''); end;/

declare h varchar2(32767) := null;beginwwv_flow_api.create_page_item( p_id=>1922520298247936 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id=> 101, p_name=>'P101_LOGIN', p_data_type=> '', p_is_required=> false, p_accept_processing=> 'REPLACE_EXISTING', p_item_sequence=> 30, p_item_plug_id => 1922223885247934+wwv_flow_api.g_id_offset, p_use_cache_before_default=> '', p_item_default=> 'Login', p_prompt=>'Login', p_source=>'LOGIN', p_source_type=> 'STATIC', p_display_as=> 'BUTTON', p_lov_display_null=> 'NO', p_lov_translated=> 'N', p_cSize=> null, p_cMaxlength=> null, p_cHeight=> null, p_tag_attributes => 'template:'||to_char(1913323201247909 + wwv_flow_api.g_id_offset), p_begin_on_new_line=> 'NO', p_begin_on_new_field=> 'YES', p_colspan=> 1, p_rowspan=> 1, p_label_alignment=> 'LEFT', p_field_alignment=> 'LEFT', p_is_persistent=> 'Y', p_button_action => 'SUBMIT', p_button_is_hot=>'N', p_item_comment => ''); end;/

begin declare p varchar2(32767) := null; l_clob clob; l_length number := 1;beginp:=p||'apex_authentication.send_login_username_cookie ('||unistr('\000a')||' p_username => lower(:P101_USERNAME) );';

wwv_flow_api.create_page_process( p_id => 1922706324247937 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id => 101, p_process_sequence=> 10, p_process_point=> 'AFTER_SUBMIT', p_process_type=> 'PLSQL', p_process_name=> 'Set Username Cookie', p_process_sql_clob => p, p_process_error_message=> '', p_error_display_location=> 'INLINE_IN_NOTIFICATION', p_process_success_message=> '', p_process_is_stateful_y_n=>'N', p_process_comment=>'');end;null; end;/

begin declare p varchar2(32767) := null; l_clob clob; l_length number := 1;beginp:=p||'apex_authentication.login('||unistr('\000a')||' p_username => :P101_USERNAME,'||unistr('\000a')||' p_password => :P101_PASSWORD );';

wwv_flow_api.create_page_process( p_id => 1922623600247937 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id => 101, p_process_sequence=> 20, p_process_point=> 'AFTER_SUBMIT', p_process_type=> 'PLSQL', p_process_name=> 'Login', p_process_sql_clob => p, p_process_error_message=> '', p_error_display_location=> 'INLINE_IN_NOTIFICATION', p_process_success_message=> '', p_process_is_stateful_y_n=>'N', p_process_comment=>'');end;null; end;/

begin declare p varchar2(32767) := null; l_clob clob; l_length number := 1;beginp:=p||'101';

wwv_flow_api.create_page_process( p_id => 1922913619247937 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id => 101, p_process_sequence=> 30, p_process_point=> 'AFTER_SUBMIT', p_process_type=> 'CLEAR_CACHE_FOR_PAGES', p_process_name=> 'Clear Page(s) Cache', p_process_sql_clob => p, p_process_error_message=> '', p_error_display_location=> 'INLINE_IN_NOTIFICATION', p_process_success_message=> '', p_process_is_stateful_y_n=>'N', p_process_comment=>'');end;null; end;/

begin declare p varchar2(32767) := null; l_clob clob; l_length number := 1;beginp:=p||':P101_USERNAME := apex_authentication.get_login_username_cookie;';

wwv_flow_api.create_page_process( p_id => 1922823450247937 + wwv_flow_api.g_id_offset, p_flow_id=> wwv_flow.g_flow_id, p_flow_step_id => 101, p_process_sequence=> 10, p_process_point=> 'BEFORE_HEADER', p_process_type=> 'PLSQL', p_process_name=> 'Get Username Cookie', p_process_sql_clob => p, p_process_error_message=> '', p_error_display_location=> 'ON_ERROR_PAGE', p_process_success_message=> '', p_process_is_stateful_y_n=>'N', p_process_comment=>'');end;null; end;/

Page 40: Professional Software Development using APEX Rob van Wijk

select to_number

( to_char(wwv_seq.nextval) ||

lpad( substr( abs(wwv_flow_random.rand), 1, 5 ),5, '0' ) ||

ltrim(to_char(mod(abs(hsecs),1000000),'000000'))

)

into g_curr_val

from sys.v_$timer;

Source:: http://joelkallman.blogspot.nl/2010/07/apexapplicationinstall.html

Page 41: Professional Software Development using APEX Rob van Wijk

add offset number when importing

apex_application_install.generate_offsetapex_application_install.set_offset

Page 42: Professional Software Development using APEX Rob van Wijk

subtract offset number when exporting

sed -E 's/([0-9]+)([ ]*\+[ ]*wwv_flow_api.g_id_offset)/^\1^\2/'<f$2.sql | awk -F^ '{if(length($3)>0) {print $1 $2-ENVIRON["offset"] $3} else

{print $0}}' >f$2.sql

Page 43: Professional Software Development using APEX Rob van Wijk

META schema

SQL> select code 2 , name 3 , apex_application_id_from id_from 4 , apex_application_id_until id_until 5 , apex_id_offset 6 from meta.mta_developers 7 /CODE NAME ID_FROM ID_UNTIL APEX_ID_OFFSET---------- ------------------- ------------ ------------ --------------RWIJK Rob van Wijk 10000 10999 10000000000MPLAS Marcel van der Plas 11000 11999 20000000000MHOEFS Marcel Hoefs 12000 12999 30000000000EASLAN Erdal Aslan 13000 13999 40000000000ASUVEREIN Arne Suverein 14000 14999 50000000000EHAMERS Etienne Hamers 15000 15999 60000000000LSAVALKA Larysa Savalka 16000 16999 700000000007 rows selected.

Page 44: Professional Software Development using APEX Rob van Wijk

META schema

SQL> desc meta.mta_admin...FUNCTION APEX_ID_OFFSET RETURNS NUMBER(20) Argument Name Type

In/Out Default? ------------------------------ ----------------------- ------ -------- P_SCHEMAPREFIX VARCHAR2 IN

...

Page 45: Professional Software Development using APEX Rob van Wijk

3. One-Step Build

Page 46: Professional Software Development using APEX Rob van Wijk

Goal

Reduce the chance for errors during installation

Page 47: Professional Software Development using APEX Rob van Wijk

install.sqluninstall.s

ql

reinstall.sql

install_apex.sql

install_db.sql uninstall_db.sql

uninstall_apex.sql

reinstall_apex.sql

reinstall_db.sql

Page 48: Professional Software Development using APEX Rob van Wijk

remarkremark install_db.sqlremarkremark Marcel Hoefs 06 juni 2012remarkcolumn current_schema new_value curschemaselect sys_context('userenv','current_schema') current_schema from dual/define SCHEMAPREFIX='&1'define APPLICATIE='sca'prompt ***************************************************************************prompt Installeer db-gedeelte van &APPLICATIE in schema's &SCHEMAPREFIX._data, &SCHEMAPREFIX._api en &SCHEMAPREFIX._uiprompt ***************************************************************************

define tables_path='&APPLICATIE./non-apex/data/tables/'define sequences_path='&APPLICATIE./non-apex/data/sequences/'define indexes_path='&APPLICATIE./non-apex/data/indexes/'define data_path='&APPLICATIE./non-apex/data/data/'define privs_path='&APPLICATIE./non-apex/data/privileges/'define triggers_path='&APPLICATIE./non-apex/data/triggers/'define packages_path='&APPLICATIE./non-apex/api/packages/'define package_bodies_path='&APPLICATIE./non-apex/api/package_bodies/'define api_synonyms_path='&APPLICATIE./non-apex/api/synonyms/'define view_path='&APPLICATIE./non-apex/ui/views/'define ui_synonyms_path='&APPLICATIE./non-apex/ui/synonyms/'

set verify off

alter session set current_schema = &SCHEMAPREFIX._data/

@@&tables_path.SCA_KLANTEN.sql@@&tables_path.SCA_KLT_PK.sql@@&tables_path.SCA_KLANTEN_CONSTRAINT.sql

@@&tables_path.SCA_MEETINSTALLATIES.sql@@&tables_path.SCA_MIE_PK.sql@@&tables_path.SCA_MEETINSTALLATIES_CONSTRAINT.sql@@&tables_path.SCA_MEETINSTALLATIES_REFCONSTRAINT.sql

@@&tables_path.SCA_OPNAMES.sql@@&tables_path.SCA_ONE_PK.sql@@&tables_path.SCA_OPNAMES_CONSTRAINT.sql@@&tables_path.SCA_OPNAMES_REFCONSTRAINT.sql

@@&tables_path.SCA_METERSTANDEN.sql@@&tables_path.SCA_MSD_PK.sql@@&tables_path.SCA_METERSTANDEN_CONSTRAINT.sql@@&tables_path.SCA_METERSTANDEN_REFCONSTRAINT.sql

@@&sequences_path.SCA_KLT_SEQ1.sql@@&sequences_path.SCA_MIE_SEQ1.sql@@&sequences_path.SCA_MSD_SEQ1.sql@@&sequences_path.SCA_ONE_SEQ1.sql

@@&indexes_path.MIE_KLT_FK1_I.sql@@&indexes_path.MSD_MIE_FK_I.sql@@&indexes_path.MSD_ONE_FK1_I.sql@@&indexes_path.ONE_KLT_FK1_I.sql

@@&privs_path.privileges.sql &SCHEMAPREFIX

alter session set current_schema = &SCHEMAPREFIX._api/

remark Deze applicatie heeft geen API-laag.

alter session set current_schema = &SCHEMAPREFIX._ui/

@@&ui_synonyms_path.sca_klanten.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_meetinstallaties.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_meterstanden.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_opnames.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_klt_seq1.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_mie_seq1.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_msd_seq1.syn &SCHEMAPREFIX@@&ui_synonyms_path.sca_one_seq1.syn &SCHEMAPREFIX

alter session set current_schema = &CURSCHEMA/

set verify onundefine SCHEMAPREFIXundefine APPLICATIEundefine CURSCHEMA

Page 49: Professional Software Development using APEX Rob van Wijk

remarkremark uninstall_db.sqlremarkremark Marcel Hoefs 6 juni 2012remark

column current_schema new_value CURSCHEMAselect sys_context('userenv','current_schema') current_schema from dual/

set verify off

define SCHEMAPREFIX='&1'

prompt *************************************************************************************prompt De-installeer db-gedeelte van SCA uit schema's &SCHEMAPREFIX._data, &SCHEMAPREFIX._api en &SCHEMAPREFIX._uiprompt *************************************************************************************

alter session set current_schema = &SCHEMAPREFIX._data/

remarkremark Verwijder hier alle objecten uit de DATA-laagremarkdrop table sca_klanten cascade constraints purge/drop table sca_meetinstallaties cascade constraints purge/drop table sca_meterstanden cascade constraints purge/drop table sca_opnames cascade constraints purge/drop sequence sca_klt_seq1/drop sequence sca_mie_seq1/drop sequence sca_msd_seq1/drop sequence sca_one_seq1/

alter session set current_schema = &SCHEMAPREFIX._api/

remarkremark Verwijder hier alle objecten uit de API-laagremark

alter session set current_schema = &SCHEMAPREFIX._ui/

remarkremark Verwijder hier alle objecten uit de UI-laagremarkdrop synonym sca_klanten/drop synonym sca_meetinstallaties/drop synonym sca_meterstanden/drop synonym sca_opnames/drop synonym sca_klt_seq1/drop synonym sca_mie_seq1/drop synonym sca_msd_seq1/drop synonym sca_one_seq1/alter session set current_schema = &CURSCHEMA/

set verify onundefine SCHEMAPREFIXundefine CURSCHEMA

Page 50: Professional Software Development using APEX Rob van Wijk

remarkremark install_apex.sqlremarkremark Rob van Wijk, 6 juni 2012remark

define SCHEMAPREFIX='&1'define APPLICATIE='sca'

prompt ***************************************************************************prompt Installeer APEX-gedeelte van &APPLICATIE in de werkruimte horend bij schemaprefix &SCHEMAPREFIX.prompt ***************************************************************************

set verify off

column current_schema new_value curschemaselect sys_context('userenv','current_schema') current_schema from dual/

alter session set current_schema = &SCHEMAPREFIX._ui/

declare cn_schemaprefix constant varchar2(25) := '&SCHEMAPREFIX'; cn_applicatie constant varchar2(30) := '&APPLICATIE';begin apex_application_install.set_workspace_id(meta.mta_admin.apex_werkruimte_id(cn_schemaprefix)); apex_application_install.set_application_id(meta.mta_admin.apex_applicatie_id(cn_applicatie,cn_schemaprefix)); apex_application_install.set_offset(meta.mta_admin.apex_offset_id(cn_schemaprefix)); apex_application_install.set_schema(upper(cn_schemaprefix) || '_UI'); apex_application_install.set_application_alias ( case lower(cn_schemaprefix) when lower(cn_applicatie) then cn_applicatie else cn_applicatie || '_' || cn_schemaprefix end );end;/

@@install_apex_components

whenever sqlerror continue

alter session set current_schema = &CURSCHEMA/

undefine APPLICATIEundefine SCHEMAPREFIX

Page 51: Professional Software Development using APEX Rob van Wijk

remarkremark uninstall_apex.sqlremarkremark Rob van Wijk, 6 juni 2012remark

define SCHEMAPREFIX='&1'define APPLICATIE='sca'

prompt ***************************************************************************prompt De-installeer APEX-gedeelte van &APPLICATIE uit werkruimte horend bij schemaprefix &SCHEMAPREFIX.prompt ***************************************************************************

set verify off

column current_schema new_value curschemaselect sys_context('userenv','current_schema') current_schema from dual/

alter session set current_schema = &SCHEMAPREFIX._UI/

remarkremark Dit script wordt gebruikt om zowel het applicatieschema als een gebruikersschema te verwijderen.remark Gebruik package APEX_APPLICATION_INSTALL om precies aan te geven welke applicatie we gaan verwijderen.remark

declare cn_schemaprefix constant varchar2(25) := '&SCHEMAPREFIX'; cn_applicatie constant varchar2(10) := '&APPLICATIE';begin apex_application_install.set_workspace_id(meta.mta_admin.apex_werkruimte_id(cn_schemaprefix)); apex_application_install.set_application_id(meta.mta_admin.apex_applicatie_id(cn_applicatie,cn_schemaprefix));end;/

remarkremark Gebruik de bestaande scripts uit de APEX Export Splitter om de applicatie uit APEX te verwijderenremark

@sca/apex/application/init.sql@sca/apex/application/set_environment.sql@sca/apex/application/delete_application.sql@sca/apex/application/end_environment.sql

whenever sqlerror continue

remarkremark Zet het huidige schema terug naar de oorspronkelijke waarderemark

alter session set current_schema = &CURSCHEMA/

set verify onundefine schemaprefixundefine applicatie

Page 52: Professional Software Development using APEX Rob van Wijk

4. Daily Build

Page 53: Professional Software Development using APEX Rob van Wijk

Goal

to ensure no breakage of the build goes unnoticed

Page 54: Professional Software Development using APEX Rob van Wijk

“Extensible continuous integration server”

Page 55: Professional Software Development using APEX Rob van Wijk

svn repository

svn update rein

stall.s

ql

Application schemasApplication schemas

RWIJK development RWIJK development schemasschemas

MPLAS development MPLAS development schemasschemas

LSAVALKA development LSAVALKA development schemasschemas

. .

.

reinstall_a

pex.s

ql

reinstall_db.sql

reinstall_apex.sql

reinstall_db.s

ql

reinstall_d

b.s

ql

reinstall_apex.s

ql

Page 56: Professional Software Development using APEX Rob van Wijk
Page 57: Professional Software Development using APEX Rob van Wijk
Page 58: Professional Software Development using APEX Rob van Wijk

Started by timerUpdating http://cbrlaot001.gen.cms.local/svn/repos/trunk/sca revision: Nov 25, 2012 2:01:15 AM depth:infinity ignoreExternals: falseAt revision 95no change for http://cbrlaot001.gen.cms.local/svn/repos/trunk/sca since the previous build[workspace] $ /bin/sh -xe /tmp/hudson5181239197586695389.sh+ ORAENV_ASK=NO+ ORACLE_SID=APEXSOFAO+ . oraenv++ SILENT=++ case ${ORACLE_TRACE:-""} in++ N=++ C=++ echo '\c'++ grep c++ N=-n++ '[' 0 = 0 ']'++ OLDHOME=/usr/kerberos/bin:/opt/sw/java/jdk1.6.0_30/bin:/usr/local/bin:/bin:/usr/bin:/opt/sw/firefox:/home/gladmin/bin++ case ${ORAENV_ASK:-""} in++ NEWSID=APEXSOFAO++ export ORACLE_SID+++ dbhome APEXSOFAO++ ORAHOME=/opt/sw/oradmin/product/11.2.0.3/dbhome_1++ case $? in++ ORACLE_HOME=/opt/sw/oradmin/product/11.2.0.3/dbhome_1++ export ORACLE_HOME++ case ${LD_LIBRARY_PATH:-""} in++ LD_LIBRARY_PATH=/opt/sw/oradmin/product/11.2.0.3/dbhome_1/lib:/opt/sw/java/jdk1.6.0_30/jre/lib/amd64/server:/opt/sw/java/jdk1.6.0_30/jre/lib/amd64:/opt/sw/java/jdk1.6.0_30/jre/../lib/amd64++ export LD_LIBRARY_PATH++ case "$OLDHOME" in++ case "$PATH" in++ PATH=/usr/kerberos/bin:/opt/sw/java/jdk1.6.0_30/bin:/usr/local/bin:/bin:/usr/bin:/opt/sw/firefox:/home/gladmin/bin:/opt/sw/oradmin/product/11.2.0.3/dbhome_1/bin++ export PATH+++ LANG=C+++ ulimit++ ULIMIT=unlimited++ '[' 0 = 0 -a unlimited '!=' unlimited ']'++ ORABASE_EXEC=/opt/sw/oradmin/product/11.2.0.3/dbhome_1/bin/orabase++ '[' x '!=' x ']'++ OLD_ORACLE_BASE=++ '[' -w /opt/sw/oradmin/product/11.2.0.3/dbhome_1/inventory/ContentsXML/oraclehomeproperties.xml ']'++ '[' '' '!=' true ']'++ echo 'ORACLE_BASE environment variable is not being set since this'ORACLE_BASE environment variable is not being set since this++ echo 'information is not available for the current user ID gladmin.'information is not available for the current user ID gladmin.++ echo 'You can set ORACLE_BASE manually if it is required.'You can set ORACLE_BASE manually if it is required.+ unset ORAENV_ASK+ cd /opt/sw/hudson/jobs/hudson_sca/workspace+ pwd/opt/sw/hudson/jobs/hudson_sca/workspace+ sqlplus install/install @sca/non-apex/install/build sca

SQL*Plus: Release 11.2.0.3.0 Production on Sun Nov 25 02:01:20 2012

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

BESTANDSNAAM----------------------------build_sca_20121125020120.sql

@sca/non-apex/install/reinstall sca@sca/non-apex/install/reinstall_db RWIJK@sca/non-apex/install/reinstall_apex RWIJK@sca/non-apex/install/reinstall_db MHOEFS@sca/non-apex/install/reinstall_apex MHOEFS@sca/non-apex/install/reinstall_db EASLAN@sca/non-apex/install/reinstall_apex EASLAN@sca/non-apex/install/reinstall_db ASUVEREIN@sca/non-apex/install/reinstall_apex ASUVEREIN@sca/non-apex/install/reinstall_db EHAMERS@sca/non-apex/install/reinstall_db LSAVALKA@sca/non-apex/install/reinstall_apex LSAVALKA***************************************************************************De-installeer APEX-gedeelte van sca uit werkruimte horend bij schemaprefix sca***************************************************************************

CURRENT_SCHEMA--------------------------------------------------------------------------------INSTALLAPPLICATION 12000 - SCASet Credentials...Check Compatibility...API Last Extended:20110212Your Current Version:20110212This import is compatible with version: 20110212COMPATIBLE (You should be able to run this import without issues.)Set Application ID......doneold 1: alter session set current_schema = &CURSCHEMAnew 1: alter session set current_schema = INSTALL

Session altered.

CURRENT_SCHEMA--------------------------------------------------------------------------------INSTALL

1 row selected.

*************************************************************************************De-installeer db-gedeelte van SCA uit schema's sca_data, sca_api en sca_ui*************************************************************************************

Session altered.

Table dropped.

Table dropped.

Table dropped.

Table dropped.

Sequence dropped.

Sequence dropped.

Sequence dropped.

Sequence dropped.

Session altered.

Session altered.

Synonym dropped.

Synonym dropped.

Synonym dropped.

Synonym dropped.

Synonym dropped.

Synonym dropped.

Synonym dropped.

Synonym dropped.

Session altered.

CURRENT_SCHEMA--------------------------------------------------------------------------------INSTALL

1 row selected.

***************************************************************************Installeer db-gedeelte van sca in schema's sca_data, sca_api en sca_ui***************************************************************************

Session altered.

Table created.

Index created.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table created.

Index created.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table created.

Index created.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table created.

Index created.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Table altered.

Sequence created.

Sequence created.

Sequence created.

Sequence created.

Index created.

Index created.

Index created.

Index created.

Grant succeeded.

Grant succeeded.

Grant succeeded.

Grant succeeded.

Grant succeeded.

Grant succeeded.

Grant succeeded.

Grant succeeded.

Session altered.

Session altered.

Synonym created.

Synonym created.

Synonym created.

Synonym created.

Synonym created.

Synonym created.

Synonym created.

Synonym created.

Session altered.

***************************************************************************Installeer APEX-gedeelte van sca in de werkruimte horend bij schemaprefix sca***************************************************************************

CURRENT_SCHEMA--------------------------------------------------------------------------------INSTALL

1 row selected.

Session altered.

PL/SQL procedure successfully completed.

APPLICATION 12000 - SCASet Credentials...Check Compatibility...API Last Extended:20110212Your Current Version:20110212This import is compatible with version: 20110212COMPATIBLE (You should be able to run this import without issues.)Set Application ID......authorization schemes...navigation bar entries...application processes...application items...application level computations...Application Tabs...Application Parent Tabs...Shared Lists of values...Application Trees...page groups...PAGE 1: Page 1...PAGE 4: Klanten beheer...PAGE 5: Meetinstallaties...PAGE 8: meetinstallaties bewerken...PAGE 12: klantlogin...PAGE 13: Registratienummers...PAGE 14: meterstanden...PAGE 15: Meterstanden registreren...PAGE 101: Login...lists...breadcrumbs...page templates for application: 12000......Page template 11794167803107605......Page template 11794290137107606......Page template 11794377555107606......Page template 11794497419107606......Page template 11794566298107606......Page template 11794675957107606......Page template 11794776904107607......Page template 11794894636107609......Page template 11794975350107610......Page template 11795077383107610......Page template 11795173951107611......Page template 11795283289107612......Page template 11795371712107612......Page template 11795490978107612......Page template 11795585730107612......Page template 11795696957107612......Page template 11795770245107612...button templates......Button Template 11795888447107612......Button Template 11795992602107613......Button Template 11796085633107613......Button Template 11796191818107613......Button Template 11796286854107613......Button Template 11796367372107613......Button Template 11796468287107614...region templates......region template 11796583399107614......region template 11796677084107615......region template 11796793305107615......region template 11796881706107615......region template 11796984225107615......region template 11797083949107615......region template 11797186677107615......region template 11797276155107615......region template 11797396363107615......region template 11797490683107615......region template 11797597702107615......region template 11797688606107615......region template 11797784607107615......region template 11797868456107615......region template 11797982880107615......region template 11798090397107615......region template 11798188312107615......region template 11798273024107616......region template 11798389824107616......region template 11798469454107616......region template 11798583698107616......region template 11798692106107616......region template 11798775302107616......region template 11798871609107616......region template 11798970725107616......region template 11799097104107616......region template 11799168183107616......region template 11799273036107616......region template 11799388606107616......region template 11799481068107616......region template 11799594611107616......region template 11799696450107616......region template 11799777023107616......region template 11799877782107616...List Templates......list template 11799985587107616......list template 11800082640107617......list template 11800173530107617......list template 11800274923107617......list template 11800369030107618......list template 11800493842107618......list template 11800574377107618......list template 11800678336107618......list template 11800780044107618......list template 11800865590107619......list template 11800982032107619......list template 11801076519107619......list template 11801191475107619......list template 11801276776107619......list template 11801392597107619......list template 11801496832107619......list template 11801586609107619...report templates......report template 11801692413107619......report template 11801787647107620......report template 11801869764107620......report template 11801984578107620......report template 11802083299107620......report template 11802178606107621......report template 11802285966107621......report template 11802376484107621......report template 11802466888107621......report template 11802571578107621......report template 11802674282107621...label templates......label template 11802776016107621......label template 11802888841107622......label template 11802966287107622......label template 11803075299107622......label template 11803178746107623......label template 11803282782107623...breadcrumb templates......template 11803388104107623......template 11803473095107623...popup list of values templates......template 11804188325107625...calendar templates......template 11803568331107623......template 11803771915107624......template 11803993181107624...application themes......theme 11804275466107625...build options used by application 12000...Language Maps for Application 12000...messages used by application: 12000...dynamic translations used by application: 12000...Shortcuts...web services (9iR2 or better)...shared queries...report layouts...authentication schemes......authentication 11804472930107630...plugins...load tables...doneold 1: alter session set current_schema = &CURSCHEMAnew 1: alter session set current_schema = INSTALL

Session altered.

CURRENT_SCHEMA--------------------------------------------------------------------------------INSTALL

1 row selected.

Page 59: Professional Software Development using APEX Rob van Wijk

In Hudson build, developers have option to get a fresh development environment each

night

Page 60: Professional Software Development using APEX Rob van Wijk

META schema

SQL> select dev_code 2 , app_code 3 , apex_application_id 4 , ind_daily_db_refresh 5 , ind_daily_apex_refresh 6 from meta.mta_application_copies 7 /DEV_CODE APP_CODE APEX_APPLICATION_ID I I---------- ---------- ------------------- - -RWIJK CV 10000 J NRWIJK SCA 10001 J JMPLAS CV 11000 J NMPLAS SCA 11001 N NMHOEFS CV 12001 J JMHOEFS SCA 12000 J JEASLAN SCA 13000 J JEASLAN CV 13001 J JASUVEREIN SCA 14000 J JEHAMERS SCA 15000 J NLSAVALKA SCA 16000 J J

LSAVALKA CV 16001 J J

Page 61: Professional Software Development using APEX Rob van Wijk

META schema

SQL> desc meta.mta_admin...PROCEDURE SET_IND_DAILY_APEX_REFRESH Argument Name Type

In/Out Default? ------------------------------ ----------------------- ------ -------- P_DEV_CODE VARCHAR2(10) IN P_APP_CODE VARCHAR2(10) IN P_IND_DAILY_APEX_REFRESH VARCHAR2(1) INPROCEDURE SET_IND_DAILY_DB_REFRESH Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- P_DEV_CODE VARCHAR2(10) IN P_APP_CODE VARCHAR2(10) IN P_IND_DAILY_DB_REFRESH VARCHAR2(1) IN

...

Page 62: Professional Software Development using APEX Rob van Wijk

5. Unit Testing

Page 63: Professional Software Development using APEX Rob van Wijk

Goal

Add value to the automatic build by determining if your (packaged) functions

and procedures are fit to use

Page 64: Professional Software Development using APEX Rob van Wijk
Page 65: Professional Software Development using APEX Rob van Wijk

Development database

APEXAPEXWorkspace CiberWorkspace Ciber

CV SCACV SCA

SchemaSchemaSCA_UISCA_UI

SchemaSchemaSCA_APISCA_API

SchemaSchemaSCA_DATASCA_DATA

SchemaSchemaCV_UICV_UI

SchemaSchemaCV_APICV_API

SchemaSchemaCV_DATACV_DATA

SchemaSchemaMETAMETA

User User INSTALLINSTALL

Workspace Workspace RWIJKRWIJKSCASCA

SchemaSchemaRWIJK_UIRWIJK_UI

SchemaSchemaRWIJK_APIRWIJK_API

SchemaSchemaRWIJK_DATARWIJK_DATA

Workspace MPLASWorkspace MPLASCV SCACV SCA

SchemaSchemaMPLAS_UIMPLAS_UI

SchemaSchemaMPLAS_APIMPLAS_API

SchemaSchemaMPLAS_DATAMPLAS_DATA

UserUserRWIJKRWIJK

UserUserMPLASMPLAS

SchemaSchemaUTUT

Page 66: Professional Software Development using APEX Rob van Wijk

• A single shared test repository in schema UT

• Using command line (UtUtil)

• a different test suite per package

• Schema names are included in XML definition files

• (Un)Load from client: UtUtil.bat & UtUtil.sh exp/imp scripts

• Automatic load when installing db-part of application

• Automatic unload when uninstalling db-part of application

• run all unit tests in application schema in Hudson’s nightly build

• manually start unit tests in developers’ schema

Page 67: Professional Software Development using APEX Rob van Wijk

Completing Unit Testing

Selenium

Template project

Delivering patches

Sonar

What’s Next?

Page 68: Professional Software Development using APEX Rob van Wijk

Thanks for your attention!

@rwijk [email protected]

@rwijk