Skip to content

Commit b778b46

Browse files
authored
Merge pull request #2 from xebialabs-community/delphixpy
Delphixpy
2 parents 6bee567 + 9d6abe7 commit b778b46

24 files changed

+942
-162
lines changed

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
.classpath
12
.gradle
3+
.project
4+
.settings/
5+
bin/
26
build
3-
temp
47
supervisord.*
8+
temp
59
xl-release-7.6.1-server
610
*.iml
711
.idea
8-
*.pyc
9-
12+
*.pyc

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
language: java
2-
script: "./gradlew clean build"
3-
before_deploy:
4-
- export UPLOAD_FILE=$(ls build/libs/xlr-delphix-plugin*.jar)
52
deploy:
63
provider: releases
74
api_key:
85
secure: N3WaXeI1y9i+i2nk3Jm3guYxxPRMZ7RuFdox2onFMHM9WGkvM6Bw+i6QuMUkn3bbr3iDmRpQIjBUGBag3cbMwEMTrLRs2nqMhgFlf52n0DFTEY5UWRAS61m5abuPEyR4l5bURg95qafAH+AMIvuToF2EPkL9ILhFkaayU19DNlxEJl5nFx98w7saB17eFgItRhdYeUdYEnyUp2VY2AQRzhZKq3T4OeW3lGiFUSkglQJfFbWyLtag8GUTqucowSM8y+IH4ThSdFGVzndSUcnbztf+La+piyps44+5WXu5PbfPrfQ0INt/2/Em+FDBkxfuUICcwvxjXa6EhKK+E7GvA+/Mj5CK9GHH0t/EsUkPsvDUCOs/W7dBPV5p6qIrTJQE9+AqldDx5AsmwKodkdteU5kg/B3fsBjZ/j3eGSV671yB5nX+7cDuy5TOObChD9kD9j83ExwoUqStYkkHkbVbstt2uvMwLeNvwUnp9oiBr0zjjnYYQmseYLFkn99MBHt/p8RcooT0UNEm0qYIbuMofgJ4bZfgLgnW+v3BCHGcbfJ2Nv4TOvMZn5aTfPg2JyW9YkU1r+DiBPgwfTKcfqa9J5U0KK92MCHw64BBBiKKHBF18odXta0sULaLWVapZSttTTDk5rc1P+CYuqJISq52ThD/R3rP5o70RSCLNO2KqcA=
9-
file: "${UPLOAD_FILE}"
6+
file_glob: true
7+
file: build/lib/*
108
skip_cleanup: true
119
on:
1210
repo: xebialabs-community/xlr-delphix-plugin
11+
all_branches: true
1312
tags: true
1413
notifications:
1514
hipchat:

build.gradle

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,21 @@ plugins {
55
id "com.github.hierynomus.jython" version "0.8.0"
66
id "com.xebialabs.xl.docker" version "1.1.0"
77
id "nebula.release" version "6.0.0"
8-
id "java"
98
}
109

11-
sourceSets.main.resources.srcDirs += ["src/main/jython"]
12-
sourceSets.test.resources.srcDirs += ["src/test/jython"]
13-
1410
apply plugin: 'eclipse'
1511
apply plugin: 'idea'
1612
apply plugin: 'java'
1713
apply plugin: 'maven'
1814

19-
repositories {
20-
mavenLocal()
21-
mavenCentral()
22-
maven {
23-
url 'https://dist.xebialabs.com/public/maven2'
24-
}
15+
xlDocker {
16+
compileImage = 'xebialabsunsupported/xlr_dev_compile'
17+
compileVersion = '8.2.0-1'
18+
runImage = 'xebialabsunsupported/xlr_dev_run'
19+
runVersion = '8.2.0-1'
20+
runPortMapping = '15516:5516'
2521
}
2622

27-
defaultTasks 'build'
28-
2923
if (!project.hasProperty('release.scope')) {
3024
project.ext['release.scope'] = 'patch'
3125
}
@@ -36,14 +30,7 @@ if (!project.hasProperty('release.useLastTag')) {
3630

3731

3832
dependencies {
39-
40-
jython ":requests:2.13.0"
41-
jython python(":six:1.11.0") {
42-
useModuleName = false
43-
copy {
44-
from "six.py"
45-
}
46-
}
33+
jython ":delphixpy:1.10.0.0"
4734
}
4835

4936

@@ -65,9 +52,8 @@ processResources.configure {
6552

6653
license {
6754
header rootProject.file('License.md')
68-
strictCheck false
69-
ignoreFailures true
70-
excludes(["**/*.json", "**/requests/*", "**/responses/**", "**/logback-test.xml", "**/build/jython/**"])
55+
strictCheck true
56+
excludes(["**/*.json", "**/requests/*", "**/responses/**", "**/logback-test.xml", "**/build/jython/**", "**/delphixpy/**"])
7157
ext.year = Calendar.getInstance().get(Calendar.YEAR)
7258
ext.name = 'XEBIALABS'
7359
}

gradle/wrapper/gradle-wrapper.jar

-379 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip

gradlew.bat

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
@if "%DEBUG%" == "" @echo off
2-
@rem ##########################################################################
3-
@rem
4-
@rem Gradle startup script for Windows
5-
@rem
6-
@rem ##########################################################################
7-
8-
@rem Set local scope for the variables with windows NT shell
9-
if "%OS%"=="Windows_NT" setlocal
10-
11-
set DIRNAME=%~dp0
12-
if "%DIRNAME%" == "" set DIRNAME=.
13-
set APP_BASE_NAME=%~n0
14-
set APP_HOME=%DIRNAME%
15-
16-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
18-
19-
@rem Find java.exe
20-
if defined JAVA_HOME goto findJavaFromJavaHome
21-
22-
set JAVA_EXE=java.exe
23-
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
25-
26-
echo.
27-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28-
echo.
29-
echo Please set the JAVA_HOME variable in your environment to match the
30-
echo location of your Java installation.
31-
32-
goto fail
33-
34-
:findJavaFromJavaHome
35-
set JAVA_HOME=%JAVA_HOME:"=%
36-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37-
38-
if exist "%JAVA_EXE%" goto init
39-
40-
echo.
41-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42-
echo.
43-
echo Please set the JAVA_HOME variable in your environment to match the
44-
echo location of your Java installation.
45-
46-
goto fail
47-
48-
:init
49-
@rem Get command-line arguments, handling Windows variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
53-
:win9xME_args
54-
@rem Slurp the command line arguments.
55-
set CMD_LINE_ARGS=
56-
set _SKIP=2
57-
58-
:win9xME_args_slurp
59-
if "x%~1" == "x" goto execute
60-
61-
set CMD_LINE_ARGS=%*
62-
63-
:execute
64-
@rem Setup the command line
65-
66-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67-
68-
@rem Execute Gradle
69-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70-
71-
:end
72-
@rem End local scope for the variables with windows NT shell
73-
if "%ERRORLEVEL%"=="0" goto mainEnd
74-
75-
:fail
76-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77-
rem the _cmd.exe /c_ return code!
78-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79-
exit /b 1
80-
81-
:mainEnd
82-
if "%OS%"=="Windows_NT" endlocal
83-
84-
:omega
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem Gradle startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
set DIRNAME=%~dp0
12+
if "%DIRNAME%" == "" set DIRNAME=.
13+
set APP_BASE_NAME=%~n0
14+
set APP_HOME=%DIRNAME%
15+
16+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17+
set DEFAULT_JVM_OPTS=
18+
19+
@rem Find java.exe
20+
if defined JAVA_HOME goto findJavaFromJavaHome
21+
22+
set JAVA_EXE=java.exe
23+
%JAVA_EXE% -version >NUL 2>&1
24+
if "%ERRORLEVEL%" == "0" goto init
25+
26+
echo.
27+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:findJavaFromJavaHome
35+
set JAVA_HOME=%JAVA_HOME:"=%
36+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37+
38+
if exist "%JAVA_EXE%" goto init
39+
40+
echo.
41+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42+
echo.
43+
echo Please set the JAVA_HOME variable in your environment to match the
44+
echo location of your Java installation.
45+
46+
goto fail
47+
48+
:init
49+
@rem Get command-line arguments, handling Windows variants
50+
51+
if not "%OS%" == "Windows_NT" goto win9xME_args
52+
53+
:win9xME_args
54+
@rem Slurp the command line arguments.
55+
set CMD_LINE_ARGS=
56+
set _SKIP=2
57+
58+
:win9xME_args_slurp
59+
if "x%~1" == "x" goto execute
60+
61+
set CMD_LINE_ARGS=%*
62+
63+
:execute
64+
@rem Setup the command line
65+
66+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67+
68+
@rem Execute Gradle
69+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70+
71+
:end
72+
@rem End local scope for the variables with windows NT shell
73+
if "%ERRORLEVEL%"=="0" goto mainEnd
74+
75+
:fail
76+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77+
rem the _cmd.exe /c_ return code!
78+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79+
exit /b 1
80+
81+
:mainEnd
82+
if "%OS%"=="Windows_NT" endlocal
83+
84+
:omega

src/main/resources/delphix/DelphixClient.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,6 @@ def _get_params(self, vdb):
8989
print('- source reference {vsrc}'.format(**result))
9090
return result
9191

92-
def _refresh(self, vdb):
93-
parameters = self._get_params(vdb=vdb)
94-
print("- refresh ")
95-
headers = {'Content-type': 'application/json'}
96-
data = {
97-
"type": "OracleRefreshParameters",
98-
"timeflowPointParameters": {
99-
"type": "TimeflowPointSemantic",
100-
"container": parameters['cont'],
101-
"location": "LATEST_SNAPSHOT"
102-
}
103-
}
104-
105-
r = requests.post(
106-
'{0}/resources/json/delphix/database/{1}/refresh'.format(self.server['url'], parameters['ref']),
107-
headers=headers,
108-
cookies=self.cookies,
109-
data=json.dumps(data))
110-
if self._response_ok(r):
111-
print("- Job {0}".format(r.json()['job']))
112-
print("- Action {0}".format(r.json()['action']))
113-
return {'job': r.json()['job'], 'action': r.json()['action']}
114-
else:
115-
raise self._response_error(r)
116-
11792
def _rewind(self, vdb):
11893
parameters = self._get_params(vdb=vdb)
11994
print("- rewind ")
@@ -207,13 +182,6 @@ def _response_ok(self, r):
207182
def _response_error(self, r):
208183
return Exception(r.text)
209184

210-
def refresh(self, vdb):
211-
self._login()
212-
print("- Refresh {0} with Delphix".format(vdb))
213-
result = self._refresh(vdb)
214-
self._logout()
215-
return result
216-
217185
def snapshot(self, vdb):
218186
self._login()
219187
print("- Snapshot {0} with Delphix".format(vdb))

src/main/resources/delphix/Rewind.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99
#
10+
1011
if __name__ == '__main__':
1112
import sys
1213

src/main/resources/delphix/Snapshot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99
#
10+
1011
if __name__ == '__main__':
1112
import sys
1213

src/main/resources/delphix/Refresh.py renamed to src/main/resources/delphix/TestConnection.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@
77
#
88
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99
#
10-
if __name__ == '__main__':
11-
import sys
1210

13-
sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
14-
server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
15-
vdb = 'XEBIA'
11+
from delphixpy.web.selfservice.bookmark import bookmark
1612

17-
from delphix.DelphixClient import DelphixClient
13+
from delphix.lib.DelphixSession import DelphixSession
1814

19-
client = DelphixClient(server)
20-
output = client.refresh(vdb)
21-
job = output['job']
22-
action = output['action']
15+
dlpx_obj = DelphixSession.create(configuration)
16+
17+
# Test Connection by calling this api.
18+
bookmark.get_all(dlpx_obj.server_session)

0 commit comments

Comments
 (0)