Skip to content

Commit

Permalink
[#142] Supporting Oracle DIRECTORY objects in environment setup
Browse files Browse the repository at this point in the history
  • Loading branch information
shantstepanian committed May 6, 2018
1 parent 5c61554 commit da2f394
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 16 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log

## 6.5.3
## 6.6.0

### Functionality Improvements
#142: Support Oracle DIRECTORY objects at setup time.

### Technical Improvements
#173: Support YAML/JSON configurations and move away from type safe config towards commons-config v2

### Bug Fixes
#165: Supporting Unicode in regular table/db object files and avoiding "TokenMgrError: Lexical error at line ..." issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ public void testMinimal() {
assertEquals("abc", args.getSourcePath());
assertNull(args.getEnvNames());
assertNull(args.getChangesets());
assertEquals(null, args.getForceEnvSetup());
}

@Test
public void testEnvs() {
DeployerArgs args = parseArgs("-sourcePath abc -env e1,e2,e3");
DeployerArgs args = parseArgs("-sourcePath abc -env e1,e2,e3 -forceEnvSetup");
assertEquals("abc", args.getSourcePath());
assertArrayEquals(new String[] { "e1", "e2", "e3" }, args.getEnvNames());
assertEquals(true, args.getForceEnvSetup());
}

@Test
public void testChangesets() {
DeployerArgs args = parseArgs("-sourcePath abc -changesets c1,c2,c3");
DeployerArgs args = parseArgs("-sourcePath abc -changesets c1,c2,c3 -forceEnvSetup");
assertEquals("abc", args.getSourcePath());
assertArrayEquals(new String[] { "c1", "c2", "c3" }, args.getChangesets());
assertEquals(true, args.getForceEnvSetup());
}

private DeployerArgs parseArgs(String argsStr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,19 @@ private void test1(String filePath) {
assertEquals("pass", user2.getPassword());
assertTrue(user2.isAdmin());

// serverDirectories is defined as a parent attribute, so this should match across all envs ...
assertThat(env1.getServerDirectories(), containsInAnyOrder(
new ServerDirectory("dir1", "path1"),
new ServerDirectory("dir2", "path2")
));
// serverDirectories is defined as a parent attribute, so this should match across all envs
assertEquals(env1.getServerDirectories(), env2.getServerDirectories());
assertEquals(env1.getServerDirectories(), env3.getServerDirectories());
assertEquals(env1.getServerDirectories(), env4.getServerDirectories());
assertEquals(env3.getServerDirectories(), env1.getServerDirectories());
assertEquals(env4.getServerDirectories(), env1.getServerDirectories());

// ... but we override the value for env2
assertThat(env2.getServerDirectories(), containsInAnyOrder(
new ServerDirectory("dir2", "path2_forTest2"),
new ServerDirectory("dir3", "path3")
));

assertEquals(DbEnvironmentXmlEnricherTest1DbPlatform.class, env1.getPlatform().getClass());
assertFalse(env1.isAutoReorgEnabled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
privileges="SELECT, INSERT, UPDATE, DELETE" />
</permission>
</permissions>
<serverDirectories>
<serverDirectory name="dir2" directoryPath="path2_forTest2" />
<serverDirectory name="dir3" directoryPath="path3" />
</serverDirectories>
</dbEnvironment>
<dbEnvironment name="test3" type="DEV" cleanBuildAllowed="true" dbHost="myhost1.me.com"
dbPort="1234"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ serverDirectories:
name: dir2
environments:
dbEnvironment:
- disableAuditTracking: 'true'
- name: test1
disableAuditTracking: 'true'
defaultUserId: defId
dbHost: host
type: DEV
Expand All @@ -94,7 +95,6 @@ environments:
persistToFile: 'true'
defaultTablespace: defTab
jdbcUrl: url
name: test1
includeSchemas: SCHEMA1,SCHEMA2
dbSchemaSuffix: suff
tokens:
Expand All @@ -112,7 +112,8 @@ environments:
schemaOverride:
- schema: SCHEMA1
overrideValue: overriden_SCHEMA1
- invalidObjectCheckEnabled: 'false'
- name: test2
invalidObjectCheckEnabled: 'false'
excludeSchemas: SCHEMA1,SCHEMA2
permissions:
permission:
Expand All @@ -122,16 +123,21 @@ environments:
groups: DACT_RW_BATCH1, DACT_RW_BATCH2, DACT_RW
users: CMDRRWDB
reorgCheckEnabled: 'false'
name: test2
type: UAT
cleanBuildAllowed: 'false'
schemaOverrides:
- schemaOverride:
schema: SCHEMA3
overrideValue: overriden_SCHEMA1
- autoReorgEnabled: 'true'
serverDirectories:
serverDirectory:
- name: dir2
directoryPath: path2_forTest2
- name: dir3
directoryPath: path3
- name: test3
autoReorgEnabled: 'true'
dbPort: '1234'
name: test3
dbHost: myhost1.me.com
dbSchemaSuffix: _MYSUFFIX
type: DEV
Expand All @@ -141,10 +147,10 @@ environments:
- schemaOverride:
schema: SCHEMA4_RO
overrideValue: overriden_SCHEMA4_RO
- autoReorgEnabled: 'true'
- name: test4
autoReorgEnabled: 'true'
dbPort: '1234'
dbSchemaPrefix: MYPREFIX_
name: test4
dbHost: myhost1.me.com
type: DEV
cleanBuildAllowed: 'true'
Expand Down
70 changes: 70 additions & 0 deletions obevo-site/src/site/markdown/oracle-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
Copyright 2017 Goldman Sachs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Oracle Usage Notes

DB Type acronym for configurations: ORACLE


## Packages and Package Bodies

Obevo supports defining packages and package bodies within a single file and allowing the files to be edited in place.
For more information, see [DB Project Structure](db-project-structure.html) and the section "Objects with BODY components".


## Oracle Directories

Obevo supports the [DIRECTORY](https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5007.htm) object type
as part of the environment setup step.

This will create the directory object if it doesn't already exist. If it already exists, it will leave it alone and not
modify it. (We may modify this behavior depending on user feedback; please let us know your thoughts)

To leverage this feature:

1) Define it in your system-config.xml file with the _serverDirectory_ element:

```
<dbSystemConfig type="ORACLE">
<schemas>
<schema name="SCHEMA1" />
</schemas>
<!-- You can define it for all environments by specifying this outside of the dbEnvironment element ... -->
<serverDirectories>
<serverDirectory name="dir1" directoryPath="path1" />
<serverDirectory name="dir2" directoryPath="path2" />
</serverDirectories>
<environments>
<dbEnvironment name="test" ...>
<!-- ... or define it for a single environment (overriding the common definition) within the dbEnvironment element -->
...
<serverDirectories>
<serverDirectory name="dir1" directoryPath="path1_prime" />
<serverDirectory name="dir2" directoryPath="path2_prime" />
</serverDirectories>
...
</dbEnvironment>
</environments>
</dbSystemConfig>
```

2) Force the environment setup, via two options:

1. Use the -forceEnvSetup parameter at the command line.
2. Specify the property forceEnvSetup="true" in your dbEnvironment to have this be a default setting, and then execute a deploy.
2 changes: 1 addition & 1 deletion obevo-site/src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<item name="HSQLDB" href="general-db-notes.html" />
<item name="H2" href="general-db-notes.html" />
<item name="MongoDB" href="mongodb-notes.html" />
<item name="Oracle" href="general-db-notes.html" />
<item name="Oracle" href="oracle-notes.html" />
<item name="PostgreSQL" href="general-db-notes.html" />
<item name="Redshift" href="redshift-notes.html" />
<item name="SQL Server" href="sybase-ase-notes.html" />
Expand Down

0 comments on commit da2f394

Please sign in to comment.