Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
Java Client API
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Genesys PGR
Java Client API
Commits
d7fe2da1
Commit
d7fe2da1
authored
Nov 20, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use API v1 endpoints
parent
58d9733a
Pipeline
#7739
passed with stage
in 27 seconds
Changes
8
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
146 additions
and
993 deletions
+146
-993
src/main/java/org/genesys2/client/oauth/CLI.java
src/main/java/org/genesys2/client/oauth/CLI.java
+0
-631
src/main/java/org/genesys2/client/oauth/GenesysClient.java
src/main/java/org/genesys2/client/oauth/GenesysClient.java
+55
-182
src/main/java/org/genesys2/client/oauth/api/accession/AccessionJson.java
...rg/genesys2/client/oauth/api/accession/AccessionJson.java
+41
-44
src/main/java/org/genesys2/client/oauth/api/accession/Api1Constants.java
...rg/genesys2/client/oauth/api/accession/Api1Constants.java
+10
-5
src/test/java/org/geneys2/client/oauth/AccessionApiTest.java
src/test/java/org/geneys2/client/oauth/AccessionApiTest.java
+21
-22
src/test/java/org/geneys2/client/oauth/ApiTest.java
src/test/java/org/geneys2/client/oauth/ApiTest.java
+0
-90
src/test/java/org/geneys2/client/oauth/MockGenesysServer.java
...test/java/org/geneys2/client/oauth/MockGenesysServer.java
+17
-17
src/test/java/org/geneys2/client/oauth/ModelTests.java
src/test/java/org/geneys2/client/oauth/ModelTests.java
+2
-2
No files found.
src/main/java/org/genesys2/client/oauth/CLI.java
deleted
100644 → 0
View file @
58d9733a
This diff is collapsed.
Click to expand it.
src/main/java/org/genesys2/client/oauth/GenesysClient.java
View file @
d7fe2da1
This diff is collapsed.
Click to expand it.
src/main/java/org/genesys2/client/oauth/api/accession/AccessionJson.java
View file @
d7fe2da1
/*
* Copyright 201
6
Global Crop Diversity Trust
* Copyright 201
8
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.
...
...
@@ -32,16 +32,16 @@ public class AccessionJson {
private
Long
genesysId
;
/** The puid. */
@JsonProperty
(
value
=
Accession
.
PUID
)
private
String
puid
;
@JsonProperty
(
value
=
Accession
.
DOI
)
private
String
doi
;
/** The inst code. */
@JsonProperty
(
value
=
Accession
.
INSTCODE
)
private
String
instCode
;
private
String
inst
itute
Code
;
/** The acce numb. */
@JsonProperty
(
value
=
Accession
.
ACCENUMB
)
private
String
acce
Numb
;
private
String
acce
ssionNumber
;
/** The new acce numb. */
@JsonProperty
(
value
=
Accession
.
ACCENUMB_NEW
)
...
...
@@ -81,7 +81,7 @@ public class AccessionJson {
/** The acq date. */
@JsonProperty
(
value
=
Accession
.
ACQDATE
)
private
String
acqDate
;
private
String
acq
uisition
Date
;
/** The mls stat. */
@JsonProperty
(
value
=
Accession
.
MLSSTAT
)
...
...
@@ -109,7 +109,11 @@ public class AccessionJson {
/** The bred code. */
@JsonProperty
(
value
=
Accession
.
BREDCODE
)
private
String
[]
bredCode
;
private
String
[]
breederCode
;
/** The bred code. */
@JsonProperty
(
value
=
Accession
.
BREDNAME
)
private
String
[]
breederName
;
/** The ancest. */
@JsonProperty
(
value
=
Accession
.
ANCEST
)
...
...
@@ -205,56 +209,49 @@ public class AccessionJson {
* @return the puid
*/
public
String
getPuid
()
{
return
puid
;
}
/**
* @param puid the puid to set
*/
public
void
setPuid
(
String
puid
)
{
this
.
puid
=
puid
;
return
doi
;
}
/**
* Gets the
inst
code.
* Gets the
FAO WIEWS institute
code.
*
* @return the inst code
*/
public
String
getInstCode
()
{
return
instCode
;
public
String
getInst
itute
Code
()
{
return
inst
itute
Code
;
}
/**
* Sets the inst code.
*
* @param instCode the new inst code
* @param inst
itute
Code the new inst code
*/
public
void
setInst
Code
(
final
String
inst
Code
)
{
this
.
inst
Code
=
inst
Code
;
public
void
setInst
ituteCode
(
final
String
institute
Code
)
{
this
.
inst
ituteCode
=
institute
Code
;
}
/**
* Gets the acce
numb
.
* Gets the acce
ssion number
.
*
* @return the acce
numb
* @return the acce
ssion number
*/
public
String
getAcce
Numb
()
{
return
acce
Numb
;
public
String
getAcce
ssionNumber
()
{
return
acce
ssionNumber
;
}
/**
* Sets the acce
numb
.
* Sets the acce
ssion number
.
*
* @param acce
Numb the new acce numb
* @param acce
ssionNumber the new accession number
*/
public
void
setAcce
Numb
(
final
String
acceNumb
)
{
this
.
acce
Numb
=
acceNumb
;
public
void
setAcce
ssionNumber
(
String
accessionNumber
)
{
this
.
acce
ssionNumber
=
accessionNumber
;
}
/**
* Gets the new acce
numb
.
* Gets the new acce
ssion number
.
*
* @return the new acce
numb
* @return the new acce
ssion number
*/
public
String
getNewAcceNumb
()
{
return
newAcceNumb
;
...
...
@@ -414,21 +411,21 @@ public class AccessionJson {
}
/**
* Gets the acq date.
* Gets the acq
uisition
date.
*
* @return the acq date
* @return the acq
uisition
date
*/
public
String
getAcqDate
()
{
return
acqDate
;
public
String
getAcq
uisition
Date
()
{
return
acq
uisition
Date
;
}
/**
* Sets the acq date.
* Sets the acq
uisition
date.
*
* @param acq
Date the new acq
date
* @param acq
uisitionDate the new acquisition
date
*/
public
void
setAcq
Date
(
final
String
acq
Date
)
{
this
.
acq
Date
=
acq
Date
;
public
void
setAcq
uisitionDate
(
String
acquisition
Date
)
{
this
.
acq
uisitionDate
=
acquisition
Date
;
}
/**
...
...
@@ -545,7 +542,7 @@ public class AccessionJson {
* @return the bred code
*/
public
String
[]
getBredCode
()
{
return
bre
d
Code
;
return
bre
eder
Code
;
}
/**
...
...
@@ -554,7 +551,7 @@ public class AccessionJson {
* @param bredCode the new bred code
*/
public
void
setBredCode
(
final
String
[]
bredCode
)
{
this
.
bre
d
Code
=
bredCode
;
this
.
bre
eder
Code
=
bredCode
;
}
/**
...
...
src/main/java/org/genesys2/client/oauth/api/accession/Api1Constants.java
View file @
d7fe2da1
...
...
@@ -40,12 +40,12 @@ public interface Api1Constants {
/**
* WIEWS code of accession holding institute.
*/
public
static
final
String
INSTCODE
=
"instCode"
;
public
static
final
String
INSTCODE
=
"inst
itute
Code"
;
/**
* Accession number.
*/
public
static
final
String
ACCENUMB
=
"acce
Numb
"
;
public
static
final
String
ACCENUMB
=
"acce
ssionNumber
"
;
/** Used to assign new ACCENUMB. */
public
static
final
String
ACCENUMB_NEW
=
"newAcceNumb"
;
...
...
@@ -84,13 +84,13 @@ public interface Api1Constants {
/**
* ISO3 country code of country of origin.
*/
public
static
final
String
ORIGCTY
=
"orgCty"
;
public
static
final
String
ORIGCTY
=
"or
i
gCty"
;
/**
* Date on which the accession entered the collection as YYYYMMDD. Missing data (MM or DD)
* should be indicated with hyphens. Leading zeros are required.
*/
public
static
final
String
ACQDATE
=
"acqDate"
;
public
static
final
String
ACQDATE
=
"acq
uisition
Date"
;
/**
* The status of an accession with regards to the Multilateral System (MLS) of the
...
...
@@ -123,7 +123,12 @@ public interface Api1Constants {
/**
* Corresponds to BREDCODE.
*/
public
static
final
String
BREDCODE
=
"bredCode"
;
public
static
final
String
BREDCODE
=
"breederCode"
;
/**
* Corresponds to BREDNAME.
*/
public
static
final
String
BREDNAME
=
"breederName"
;
/**
* Corresponds to ANCEST.
...
...
src/test/java/org/geneys2/client/oauth/AccessionApiTest.java
View file @
d7fe2da1
...
...
@@ -17,20 +17,14 @@
package
org.geneys2.client.oauth
;
import
static
org
.
hamcrest
.
CoreMatchers
.*;
import
static
org
.
hamcrest
.
MatcherAssert
.
*
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
mockito
.
Matchers
.*;
import
static
org
.
mockito
.
Mockito
.
*
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
org.genesys2.client.oauth.GenesysApiException
;
import
org.genesys2.client.oauth.GenesysClient
;
import
org.genesys2.client.oauth.OAuthAuthenticationException
;
...
...
@@ -44,9 +38,14 @@ import org.mockito.Matchers;
import
org.mockito.Mock
;
import
org.mockito.runners.MockitoJUnitRunner
;
// TODO: Auto-generated Javadoc
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
/**
*
The Class AccessionApiTest.
*
Accession API v1 test
*/
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
AccessionApiTest
{
...
...
@@ -59,7 +58,7 @@ public class AccessionApiTest {
protected
GenesysClient
genesysClient
;
/** The inst code. */
private
final
String
instCode
=
"INS000"
;
private
final
String
inst
itute
Code
=
"INS000"
;
/** The mock server. */
private
final
MockGenesysServer
mockServer
=
new
MockGenesysServer
();
...
...
@@ -99,7 +98,7 @@ public class AccessionApiTest {
@Test
public
void
testAccessions0
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
,
IOException
{
final
List
<
AccessionJson
>
results
=
objectMapper
.
readValue
(
genesysClient
.
listAccessions
(
instCode
,
1
,
null
),
new
TypeReference
<
List
<
AccessionJson
>>()
{
final
List
<
AccessionJson
>
results
=
objectMapper
.
readValue
(
genesysClient
.
listAccessions
(
inst
itute
Code
,
1
,
null
),
new
TypeReference
<
List
<
AccessionJson
>>()
{
});
assertThat
(
"Expected empty list"
,
results
.
size
(),
is
(
0
));
...
...
@@ -117,14 +116,14 @@ public class AccessionApiTest {
@Test
public
void
testAccessions1
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
,
IOException
{
when
(
genesysClient
.
listAccessions
(
inst
Code
,
1
,
null
)).
thenReturn
(
"[{\"instCode\":\"INS000\",\"acceNumb
\":\"ACC-1\"}]"
);
when
(
genesysClient
.
listAccessions
(
inst
ituteCode
,
1
,
null
)).
thenReturn
(
"[{\"instituteCode\":\"INS000\",\"accessionNumber
\":\"ACC-1\"}]"
);
final
List
<
AccessionJson
>
results
=
objectMapper
.
readValue
(
genesysClient
.
listAccessions
(
instCode
,
1
,
null
),
new
TypeReference
<
List
<
AccessionJson
>>()
{
final
List
<
AccessionJson
>
results
=
objectMapper
.
readValue
(
genesysClient
.
listAccessions
(
inst
itute
Code
,
1
,
null
),
new
TypeReference
<
List
<
AccessionJson
>>()
{
});
assertThat
(
"Expected empty list"
,
results
.
size
(),
is
(
1
));
final
AccessionJson
acc1
=
results
.
get
(
0
);
assertThat
(
"INSTCODE doesn't match"
,
acc1
.
getInst
Code
(),
is
(
inst
Code
));
assertThat
(
"INSTCODE doesn't match"
,
acc1
.
getInst
ituteCode
(),
is
(
institute
Code
));
acc1
.
setHistoric
(
true
);
...
...
@@ -143,7 +142,7 @@ public class AccessionApiTest {
@Test
public
void
testUpsertAccessions1
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
,
IOException
,
InterruptedException
{
String
result
=
genesysClient
.
listAccessions
(
instCode
,
1
,
null
);
String
result
=
genesysClient
.
listAccessions
(
inst
itute
Code
,
1
,
null
);
assertThat
(
"Non-null result expected from genesysClient"
,
result
,
notNullValue
());
List
<
AccessionJson
>
results
=
objectMapper
.
readValue
(
result
,
new
TypeReference
<
List
<
AccessionJson
>>()
{
});
...
...
@@ -154,23 +153,23 @@ public class AccessionApiTest {
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
final
AccessionJson
aj
=
new
AccessionJson
();
aj
.
setInst
Code
(
inst
Code
);
aj
.
setAcce
Numb
(
"ACC-"
+
(
i
+
1
));
aj
.
setInst
ituteCode
(
institute
Code
);
aj
.
setAcce
ssionNumber
(
"ACC-"
+
(
i
+
1
));
aj
.
setGenus
(
"Genus"
);
ajList
.
add
(
aj
);
}
result
=
genesysClient
.
updateAccessions
(
instCode
,
ajList
);
result
=
genesysClient
.
updateAccessions
(
inst
itute
Code
,
ajList
);
System
.
err
.
println
(
result
);
results
=
objectMapper
.
readValue
(
genesysClient
.
listAccessions
(
instCode
,
1
,
null
),
new
TypeReference
<
List
<
AccessionJson
>>()
{
results
=
objectMapper
.
readValue
(
genesysClient
.
listAccessions
(
inst
itute
Code
,
1
,
null
),
new
TypeReference
<
List
<
AccessionJson
>>()
{
});
assertThat
(
"Expected list with 4 entries"
,
results
.
size
(),
is
(
4
));
for
(
final
AccessionJson
aj1
:
results
)
{
assertThat
(
"Expected matching INSTCODE"
,
aj1
.
getInst
Code
(),
is
(
inst
Code
));
assertThat
(
"Expected ACCENUMB starting with"
,
aj1
.
getAcce
Numb
(),
CoreMatchers
.
startsWith
(
"ACC-"
));
assertThat
(
"Expected matching INSTCODE"
,
aj1
.
getInst
ituteCode
(),
is
(
institute
Code
));
assertThat
(
"Expected ACCENUMB starting with"
,
aj1
.
getAcce
ssionNumber
(),
CoreMatchers
.
startsWith
(
"ACC-"
));
assertThat
(
"Expected GENUS=Genus"
,
aj1
.
getGenus
(),
is
(
"Genus"
));
assertThat
(
"Expected SPECIES=null"
,
aj1
.
getSpecies
(),
nullValue
());
}
...
...
src/test/java/org/geneys2/client/oauth/ApiTest.java
View file @
d7fe2da1
...
...
@@ -51,7 +51,6 @@ import org.mockito.invocation.InvocationOnMock;
import
org.mockito.runners.MockitoJUnitRunner
;
import
org.mockito.stubbing.Answer
;
// TODO: Auto-generated Javadoc
/**
* The Class ApiTest.
*/
...
...
@@ -105,95 +104,6 @@ public class ApiTest {
MockitoAnnotations
.
initMocks
(
this
);
when
(
httpGetMock
.
getMethod
()).
thenReturn
(
"GET"
);
when
(
httpPostMock
.
getMethod
()).
thenReturn
(
"POST"
);
when
(
genesysClient
.
getCrop
(
"banana"
)).
thenReturn
(
bananaJson
);
}
/**
* Test mock get crop.
*
* @throws OAuthAuthenticationException the o auth authentication exception
* @throws PleaseRetryException the please retry exception
* @throws GenesysApiException the genesys api exception
* @throws JsonProcessingException the json processing exception
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public
void
testMockGetCrop
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
,
IOException
{
final
String
json
=
genesysClient
.
getCrop
(
"banana"
);
assertThat
(
"Returned banana JSON doesn't match"
,
json
,
equalTo
(
bananaJson
));
// Must be able to read the json
objectMapper
.
readTree
(
json
);
}
/**
* Test mock update crop.
*
* @throws OAuthAuthenticationException the o auth authentication exception
* @throws PleaseRetryException the please retry exception
* @throws GenesysApiException the genesys api exception
* @throws JsonProcessingException the json processing exception
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public
void
testMockUpdateCrop
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
,
IOException
{
final
String
json
=
genesysClient
.
getCrop
(
"banana"
);
assertThat
(
"Returned banana JSON doesn't match"
,
json
,
equalTo
(
bananaJson
));
// Must be able to read the json
objectMapper
.
readTree
(
json
);
}
/**
* Test organization members.
*
* @throws OAuthAuthenticationException the o auth authentication exception
* @throws PleaseRetryException the please retry exception
* @throws GenesysApiException the genesys api exception
* @throws JsonProcessingException the json processing exception
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public
void
testOrganizationMembers
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
,
IOException
{
final
String
orgSlug
=
"org"
;
when
(
genesysClient
.
getOrganizationMembers
(
orgSlug
)).
then
(
returnOrganizationMembers
(
orgSlug
));
final
String
members
=
genesysClient
.
getOrganizationMembers
(
orgSlug
);
objectMapper
.
readTree
(
members
);
System
.
err
.
println
(
members
);
}
/**
* Return organization members.
*
* @param orgSlug the org slug
* @return the answer
*/
private
Answer
<
String
>
returnOrganizationMembers
(
final
String
orgSlug
)
{
return
new
Answer
<
String
>()
{
@Override
public
String
answer
(
final
InvocationOnMock
invocation
)
throws
Throwable
{
return
"[\"ORG1\",\"ORG2\"]"
;
}
};
}
/**
* Test please retry exception.
*
* @throws OAuthAuthenticationException the o auth authentication exception
* @throws PleaseRetryException the please retry exception
* @throws GenesysApiException the genesys api exception
* @throws JsonProcessingException the json processing exception
*/
@SuppressWarnings
(
"deprecation"
)
@Test
(
expected
=
PleaseRetryException
.
class
)
public
void
testPleaseRetryException
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
,
JsonProcessingException
{
when
(
genesysClient
.
updateMLS
(
"INS000"
,
null
)).
thenThrow
(
PleaseRetryException
.
class
);
genesysClient
.
updateMLS
(
"INS000"
,
null
);
}
/**
...
...
src/test/java/org/geneys2/client/oauth/MockGenesysServer.java
View file @
d7fe2da1
...
...
@@ -70,12 +70,12 @@ public class MockGenesysServer {
if
(
args
[
2
]
!=
null
)
{
throw
new
MockGenesysException
(
"Querying is not supported."
);
}
final
String
instCode
=
(
String
)
args
[
0
];
final
String
inst
itute
Code
=
(
String
)
args
[
0
];
final
int
page
=
(
Integer
)
args
[
1
];
System
.
err
.
println
(
"Listing accessions inst
Code="
+
inst
Code
+
" page="
+
page
);
System
.
err
.
println
(
"Listing accessions inst
ituteCode="
+
institute
Code
+
" page="
+
page
);
return
objectMapper
.
writeValueAsString
(
getAccessionsPage
(
instCode
,
page
));
return
objectMapper
.
writeValueAsString
(
getAccessionsPage
(
inst
itute
Code
,
page
));
}
};
}
...
...
@@ -90,10 +90,10 @@ public class MockGenesysServer {
@Override
public
String
answer
(
final
InvocationOnMock
invocation
)
throws
Throwable
{
final
Object
[]
args
=
invocation
.
getArguments
();
final
String
instCode
=
(
String
)
args
[
0
];
final
String
inst
itute
Code
=
(
String
)
args
[
0
];
final
List
<?>
arrayNode
=
(
List
<?>)
args
[
1
];
final
String
res
=
objectMapper
.
writeValueAsString
(
upsertAccessions
(
instCode
,
arrayNode
));
final
String
res
=
objectMapper
.
writeValueAsString
(
upsertAccessions
(
inst
itute
Code
,
arrayNode
));
System
.
err
.
println
(
"Result: "
+
res
);
return
res
;
}
...
...
@@ -103,7 +103,7 @@ public class MockGenesysServer {
/**
* Upsert accessions.
*
* @param instCode the inst code
* @param inst
itute
Code the inst code
* @param nodeList the node list
* @return the string
* @throws JsonParseException the json parse exception
...
...
@@ -111,10 +111,10 @@ public class MockGenesysServer {
* @throws IOException Signals that an I/O exception has occurred.
* @throws GenesysApiException the genesys api exception
*/
protected
String
upsertAccessions
(
final
String
instCode
,
final
List
<?>
nodeList
)
throws
JsonParseException
,
JsonMappingException
,
IOException
,
GenesysApiException
{
List
<
AccessionJson
>
accList
=
instAcc
.
get
(
instCode
);
protected
String
upsertAccessions
(
final
String
inst
itute
Code
,
final
List
<?>
nodeList
)
throws
JsonParseException
,
JsonMappingException
,
IOException
,
GenesysApiException
{
List
<
AccessionJson
>
accList
=
instAcc
.
get
(
inst
itute
Code
);
if
(
accList
==
null
)
{
instAcc
.
put
(
instCode
,
accList
=
new
ArrayList
<
AccessionJson
>());
instAcc
.
put
(
inst
itute
Code
,
accList
=
new
ArrayList
<
AccessionJson
>());
}
for
(
int
i
=
0
;
i
<
nodeList
.
size
();
i
++)
{
final
AccessionJson
aj
=
(
AccessionJson
)
nodeList
.
get
(
i
);
...
...
@@ -149,11 +149,11 @@ public class MockGenesysServer {
if
(
aj
.
getMlsStat
()
!=
null
)
{
existing
.
setMlsStat
(
aj
.
getMlsStat
());
}
if
(
aj
.
getAcce
Numb
()
!=
null
)
{
existing
.
setAcce
Numb
(
aj
.
getAcceNumb
());
if
(
aj
.
getAcce
ssionNumber
()
!=
null
)
{
existing
.
setAcce
ssionNumber
(
aj
.
getAccessionNumber
());
}
if
(
aj
.
getAcqDate
()
!=
null
)
{
existing
.
setAcq
Date
(
aj
.
getAcq
Date
());
if
(
aj
.
getAcq
uisition
Date
()
!=
null
)
{
existing
.
setAcq
uisitionDate
(
aj
.
getAcquisition
Date
());
}
if
(
aj
.
getAncest
()
!=
null
)
{
existing
.
setAncest
(
aj
.
getAncest
());
...
...
@@ -226,7 +226,7 @@ public class MockGenesysServer {
return
findMatch
(
accList
,
aj
.
getUuid
());
}
else
{
for
(
final
AccessionJson
m
:
accList
)
{
if
(
m
.
getInst
Code
().
equals
(
aj
.
getInstCode
())
&&
m
.
getAcceNumb
().
equals
(
aj
.
getAcceNumb
())
&&
m
.
getGenus
().
equals
(
aj
.
getGenus
()))
{
if
(
m
.
getInst
ituteCode
().
equals
(
aj
.
getInstituteCode
())
&&
m
.
getAccessionNumber
().
equals
(
aj
.
getAccessionNumber
())
&&
m
.
getGenus
().
equals
(
aj
.
getGenus
()))
{
return
m
;
}
}
...
...
@@ -253,13 +253,13 @@ public class MockGenesysServer {
/**
* Gets the accessions page.
*
* @param instCode the inst code
* @param inst
itute
Code the inst code
* @param page the page
* @return the accessions page
* @throws MockGenesysException the mock genesys exception
*/
protected
List
<
AccessionJson
>
getAccessionsPage
(
final
String
instCode
,
final
int
page
)
throws
MockGenesysException
{
final
List
<
AccessionJson
>
accList
=
instAcc
.
get
(
instCode
);
protected
List
<
AccessionJson
>
getAccessionsPage
(
final
String
inst
itute
Code
,
final
int
page
)
throws
MockGenesysException
{
final
List
<
AccessionJson
>
accList
=
instAcc
.
get
(
inst
itute
Code
);
if
(
accList
==
null
||
accList
.
isEmpty
())
{
System
.
err
.
println
(
"Returning blank list"
);
return
BLANK_LIST
;
...
...
src/test/java/org/geneys2/client/oauth/ModelTests.java
View file @
d7fe2da1
...
...
@@ -57,8 +57,8 @@ public class ModelTests {
@Test
public
void
serializeCore
()
throws
IOException
{
final
AccessionJson
aj
=
new
AccessionJson
();
aj
.
setInstCode
(
"INS000"
);
aj
.
setAcce
Numb
(
"ACC-1"
);
aj
.
setInst
itute
Code
(
"INS000"
);
aj
.
setAcce
ssionNumber
(
"ACC-1"
);
aj
.
setGenus
(
"Genus"
);
final
JsonNode
tree
=
getJsonTree
(
aj
);
...
...
Write
Preview
Markdown
is supported
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