Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Java Client API
Commits
607b8f35
Commit
607b8f35
authored
Jan 15, 2021
by
Maxym Borodenko
Browse files
just testing
parent
92b1cbaf
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
607b8f35
stages
:
stages
:
-
compile
-
compile
-
test-oauth
-
deploy
-
deploy
run tests in branches
:
run tests in branches
:
...
@@ -11,6 +12,16 @@ run tests in branches:
...
@@ -11,6 +12,16 @@ run tests in branches:
-
master
-
master
-
/^genesys\-client\-api\-/
-
/^genesys\-client\-api\-/
run tests for OAuth in branches
:
stage
:
test-oauth
image
:
maven:3-jdk-8
script
:
# - MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn -Dbase.url=${BASE_URL} -Dclient.key=${CLIENT_KEY} -Dclient.secret=${CLIENT_SECRET}" mvn test -B
-
MAVEN_OPTS="${MAVEN_OPTS} -Dorg.slf4j.simpleLogger.defaultLogLevel=warn -Dbase.url=testUrl -Dclient.key=testClientKey -Dclient.secret=testClientSecret" mvn test -B
except
:
-
master
-
/^genesys\-client\-api\-/
publish snapshot artifacts
:
publish snapshot artifacts
:
stage
:
deploy
stage
:
deploy
image
:
maven:3-jdk-8
image
:
maven:3-jdk-8
...
...
pom.xml
View file @
607b8f35
...
@@ -69,6 +69,9 @@
...
@@ -69,6 +69,9 @@
<argLine>
-Xms512m -Xmx1024m
</argLine>
<argLine>
-Xms512m -Xmx1024m
</argLine>
<useSystemClassLoader>
false
</useSystemClassLoader>
<useSystemClassLoader>
false
</useSystemClassLoader>
<testFailureIgnore>
false
</testFailureIgnore>
<testFailureIgnore>
false
</testFailureIgnore>
<excludes>
<exclude>
**/SandboxApiTest.java
</exclude>
</excludes>
</configuration>
</configuration>
</plugin>
</plugin>
<plugin>
<plugin>
...
...
src/test/java/org/geneys2/client/oauth/sandbox/SandboxApiTest.java
0 → 100644
View file @
607b8f35
/*
* Copyright 2020 Global Crop Diversity Trust
*
* 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.
*/
package
org.geneys2.client.oauth.sandbox
;
import
static
org
.
hamcrest
.
CoreMatchers
.*;
import
static
org
.
hamcrest
.
MatcherAssert
.*;
import
static
org
.
hamcrest
.
Matchers
.
greaterThan
;
import
static
org
.
hamcrest
.
Matchers
.
isEmptyOrNullString
;
import
static
org
.
junit
.
Assert
.
fail
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.genesys2.client.oauth.GenesysApiException
;
import
org.genesys2.client.oauth.GenesysClient
;
import
org.genesys2.client.oauth.OAuthAuthenticationException
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.runners.MockitoJUnitRunner
;
/**
* @author Maxym Borodenko
*/
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
SandboxApiTest
{
/** The object mapper. */
private
static
final
ObjectMapper
objectMapper
;
protected
static
GenesysClient
genesysClient
;
static
{
objectMapper
=
new
ObjectMapper
();
}
// mvn -Dtest=SandboxApiTest -Dbase.url=http://127.0.0.1:8080 -Dclient.key=YUI1D.MmSCmz67OBsXJjn3oZ7l@localhost -Dclient.secret=y2kDmiaCack5XhogUr1Yx48gAWB0uMRT test
@BeforeClass
public
static
void
initGenesysClient
()
{
final
String
baseUrl
=
System
.
getProperty
(
"base.url"
);
assertThat
(
baseUrl
,
not
(
isEmptyOrNullString
()));
final
String
clientKey
=
System
.
getProperty
(
"client.key"
);
assertThat
(
clientKey
,
not
(
isEmptyOrNullString
()));
final
String
clientSecret
=
System
.
getProperty
(
"client.secret"
);
assertThat
(
clientSecret
,
not
(
isEmptyOrNullString
()));
System
.
out
.
println
(
"base.url -------- "
+
baseUrl
);
System
.
out
.
println
(
"client.key -------- "
+
clientKey
);
System
.
out
.
println
(
"client.secret -------- "
+
clientSecret
);
// genesysClient = new GenesysClient(baseUrl, clientKey, clientSecret, "oob", "write");
// assertThat(genesysClient, notNullValue());
//
// try {
// genesysClient.authenticate();
// final String accessToken = genesysClient.getTokens().getAccessToken();
// assertThat(accessToken, not(isEmptyOrNullString()));
// } catch (OAuthAuthenticationException e) {
// fail("Failed while trying to authenticate: " + e.getMessage());
// }
}
@Test
public
void
getMeTest
()
{
// try {
// String me = genesysClient.me();
// HashMap<String, Object> user = objectMapper.readValue(me, HashMap.class);
// assertThat(user.get("sid"), is(equalTo(System.getProperty("client.key"))));
// assertThat((int) user.get("id"), is(greaterThan(0)));
// } catch (GenesysApiException e) {
// fail("Failed while trying to fetch the profile.");
// } catch (IOException e) {
// fail("Failed while trying to parse the profile data: " + e.getMessage());
// }
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment