Commit cdc843a1 authored by Matija Obreza's avatar Matija Obreza
Browse files

API Documentation updated

- Upgrade to application-blocks-security:1.3-SNAPSHOT
- Removed obsolete tests
parent 52d7317e
......@@ -21,19 +21,23 @@ Genebanks maintaining two or more collections of crops would sometimes use the s
accession number, unique within one collection.
Genesys uses the *instCode*, *acceNumb* and *genus* triplet to uniquely identify an
accession in an institute:
accession in an institute. For accessions with a <<doi, DOI>> assigned in <<glis, GLIS>> it will
use the DOI to uniquely identify the record:
[source,json,linenums]
----
{
"instCode": "NGA039", <1>
"acceNumb": "TMp-123", <2>
"genus": "Musa" <3>
"doi": "10.1054/12A1~", <2>
"acceNumb": "TMp-123", <3>
"genus": "Musa", <4>
...
}
----
<1> Holding institute code (INSTCODE)
<2> Accession number (ACCENUMB)
<3> Genus (GENUS)
<2> DOI of the accession as registered in GLIS
<3> Accession number (ACCENUMB)
<4> Genus (GENUS)
=== JSON data model
......@@ -54,6 +58,7 @@ All other fields are optional.
----
{
"instCode": "XYZ111",
"doi": "10.1231/14S41Q",
"acceNumb": "M12345",
"cropName": "banana",
"genus": "Musa",
......@@ -225,4 +230,5 @@ POST /api/v0/acn/SYR002/delete
[bibliography]
- [[[mcpd2]]] Alercia, A; Diulgheroff, S; Mackay, M.
http://www.bioversityinternational.org/e-library/publications/detail/faobioversity-multi-crop-passport-descriptors-v2-mcpd-v2/[FAO/Bioversity Multi-Crop Passport Descriptors V.2]. 2012.
- [[[glis]]] ITPGRFA Secretariat
http://www.fao.org/plant-treaty/areas-of-work/global-information-system/en/[Global Information System].
......@@ -52,7 +52,7 @@ initiated by opening the authorization URL in a browser (please substitute the C
with valid data):
----
https://sandbox.genesys-pgr.org/oauth/authorize?client_id=CLIENTID&client_secret=SECRET&response_type=code&redirect_uri=oob&scope=read%2Cwrite
https://sandbox.genesys-pgr.org/oauth/authorize?client_id=CLIENTID&client_secret=SECRET&response_type=code&redirect_uri=oob&scope=write
----
The server will prompt you to authorize the access to your protected resources on Genesys.
......@@ -97,6 +97,16 @@ or include it in the request URL as a query string parameter:
$ curl 'https://sandbox.genesys-pgr.org/api/v0/me?access_token=OAUTH-ACCESS-TOKEN'
----
=== System-to-System integration
With Genesys release 2.3 the *Client authentication grant* is also supported. Kindly
contact the helpdesk@genesys-pgr.org for information how to enable system-to-system
integration and to grant your Client the appropriate permissions on Genesys.
**Note**: The client will be able to modify any data on Genesys on your behalf.
Read the section <<oauth, Client Credential Grant>>.
=== Using the refresh token
OAuth access tokens have a fairly short lifetime. When an access token expires, the
......@@ -122,7 +132,6 @@ $ curl 'https://sandbox.genesys-pgr.org/oauth/token?grant_type=refresh_token&cli
----
== Client errors
The API returns descriptive information in the response body about why the request failed to execute.
......@@ -141,3 +150,9 @@ WWW-Authenticate: Bearer realm="genesys2", error="unauthorized", error_descripti
{"error":"unauthorized","error_description":"An Authentication object was not found in the SecurityContext"}
----
[bibliography]
- [[[doi]]] https://en.wikipedia.org
https://en.wikipedia.org/wiki/Digital_object_identifier[Digital object identifier].
- [[[oauth]]] A Bilbie
https://alexbilbie.com/guide-to-oauth-2-grants/[A Guide To OAuth 2.0 Grants].
package org.genesys2.hazelcast;
import java.io.IOException;
import org.genesys2.spring.config.SpringProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import com.hazelcast.config.Config;
import com.hazelcast.config.GroupConfig;
import com.hazelcast.config.JoinConfig;
import com.hazelcast.config.NetworkConfig;
import com.hazelcast.config.TcpIpConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.ManagedContext;
import com.hazelcast.spring.context.SpringManagedContext;
public class HazelcastRunner {
@Configuration
@ActiveProfiles("dev")
@Import({ SpringProperties.class })
public static class AppConfig {
protected int hazelPort=5702;
@Value("${hazelcast.instanceName}")
protected String instanceName = "genesys";
@Value("${hazelcast.password}")
protected String password;
@Value("${hazelcast.name}")
protected String name;
@Bean
public Long number() {
return new Long(13);
}
@Bean
public ManagedContext managedContext() {
return new SpringManagedContext();
}
@Bean
public HazelcastInstance hazelcast(ManagedContext managedContext) {
Config cfg = new Config();
cfg.setManagedContext(managedContext);
cfg.setInstanceName(instanceName);
GroupConfig groupConfig = cfg.getGroupConfig();
groupConfig.setName(name);
groupConfig.setPassword(password);
cfg.setProperty("hazelcast.merge.first.run.delay.seconds", "5");
cfg.setProperty("hazelcast.merge.next.run.delay.seconds", "5");
cfg.setProperty("hazelcast.logging.type", "log4j");
cfg.setProperty("hazelcast.icmp.enabled", "true");
NetworkConfig network = cfg.getNetworkConfig();
network.setPort(hazelPort);
network.setPortAutoIncrement(true);
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
tcpIpConfig.setEnabled(true);
tcpIpConfig.setConnectionTimeoutSeconds(20);
// See if there's a local HZ running
tcpIpConfig.addMember("127.0.0.1:5701");
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
return instance;
}
}
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
HazelcastInstance instance = ctx.getBean(HazelcastInstance.class);
System.out.println(instance);
System.out.println("Press any key to quit.");
try {
System.in.read();
} catch (IOException e) {
}
ctx.close();
}
}
......@@ -50,7 +50,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@PropertySource("classpath:/spring/spring.properties")
@EnableJpaRepositories(basePackages = { "org.genesys.blocks.persistence", "org.genesys.blocks.security.persistence", "org.genesys.filerepository.persistence", "org.genesys2.server.persistence.acl", "org.genesys2.server.persistence.domain",
@EnableJpaRepositories(basePackages = { "org.genesys.blocks.persistence", "org.genesys.blocks.security.persistence","org.genesys.blocks.oauth.persistence", "org.genesys.filerepository.persistence", "org.genesys2.server.persistence.acl", "org.genesys2.server.persistence.domain",
"org.genesys2.server.filerepository.persistence" }, repositoryImplementationPostfix = "CustomImpl", entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "transactionManager")
@EnableTransactionManagement
public class JpaDataConfig {
......@@ -80,7 +80,7 @@ public class JpaDataConfig {
bean.setDataSource(dataSource());
bean.setPersistenceUnitName("spring-jpa");
bean.setPackagesToScan("org.genesys.blocks.model", "org.genesys.blocks.security.model", "org.genesys2.server.model", "org.genesys.filerepository.model");
bean.setPackagesToScan("org.genesys.blocks.model", "org.genesys.blocks.security.model", "org.genesys.blocks.oauth.model", "org.genesys2.server.model", "org.genesys.filerepository.model");
bean.setPersistenceProvider(new HibernatePersistenceProvider());
final HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
......
......@@ -26,6 +26,11 @@ import com.hazelcast.core.IQueue;
import org.apache.velocity.app.VelocityEngine;
import org.elasticsearch.common.collect.Sets;
import org.genesys.blocks.oauth.persistence.AccessTokenRepository;
import org.genesys.blocks.oauth.persistence.OAuthClientRepository;
import org.genesys.blocks.oauth.persistence.RefreshTokenRepository;
import org.genesys.blocks.oauth.service.OAuthClientDetailsService;
import org.genesys.blocks.oauth.service.OAuthServiceImpl;
import org.genesys.blocks.security.persistence.AclClassPersistence;
import org.genesys.blocks.security.persistence.AclEntryPersistence;
import org.genesys.blocks.security.persistence.AclObjectIdentityPersistence;
......@@ -61,9 +66,6 @@ import org.genesys2.server.persistence.domain.MaterialSubRequestRepository;
import org.genesys2.server.persistence.domain.MetadataMethodRepository;
import org.genesys2.server.persistence.domain.MetadataRepository;
import org.genesys2.server.persistence.domain.MethodRepository;
import org.genesys2.server.persistence.domain.OAuthAccessTokenPersistence;
import org.genesys2.server.persistence.domain.OAuthClientDetailsPersistence;
import org.genesys2.server.persistence.domain.OAuthRefreshTokenPersistence;
import org.genesys2.server.persistence.domain.OrganizationRepository;
import org.genesys2.server.persistence.domain.ParameterCategoryRepository;
import org.genesys2.server.persistence.domain.ParameterRepository;
......@@ -92,10 +94,8 @@ import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.HtmlSanitizer;
import org.genesys2.server.service.InstituteFilesService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.JPATokenStore;
import org.genesys2.server.service.KPIService;
import org.genesys2.server.service.MappingService;
import org.genesys2.server.service.OAuth2ClientDetailsService;
import org.genesys2.server.service.OrganizationService;
import org.genesys2.server.service.RequestService;
import org.genesys2.server.service.TaxonomyService;
......@@ -121,8 +121,6 @@ import org.genesys2.server.service.impl.InstituteFilesServiceImpl;
import org.genesys2.server.service.impl.InstituteServiceImpl;
import org.genesys2.server.service.impl.KPIServiceImpl;
import org.genesys2.server.service.impl.MappingServiceImpl;
import org.genesys2.server.service.impl.OAuth2ClientDetailsServiceImpl;
import org.genesys2.server.service.impl.OAuth2JPATokenStoreImpl;
import org.genesys2.server.service.impl.OWASPSanitizer;
import org.genesys2.server.service.impl.OrganizationServiceImpl;
import org.genesys2.server.service.impl.RequestServiceImpl;
......@@ -133,6 +131,7 @@ import org.genesys2.server.service.impl.TokenVerificationServiceImpl;
import org.genesys2.server.service.impl.UserServiceImpl;
import org.genesys2.server.service.worker.ElasticUpdater;
import org.genesys2.server.service.worker.GeoRegionDataCLDR;
import org.genesys2.server.servlet.controller.admin.OAuthManagementController;
import org.genesys2.server.servlet.controller.rest.AccessionController;
import org.genesys2.server.servlet.controller.rest.CacheController;
import org.genesys2.server.servlet.controller.rest.CropsController;
......@@ -140,11 +139,9 @@ import org.genesys2.server.servlet.controller.rest.DatasetController;
import org.genesys2.server.servlet.controller.rest.InstituteGalleriesController;
import org.genesys2.server.servlet.controller.rest.KPIController;
import org.genesys2.server.servlet.controller.rest.LookupController;
import org.genesys2.server.servlet.controller.rest.OAuthManagementController;
import org.genesys2.server.servlet.controller.rest.OrganizationController;
import org.genesys2.server.servlet.controller.rest.PermissionController;
import org.genesys2.server.servlet.controller.rest.RequestsController;
import org.genesys2.server.servlet.controller.rest.TokenController;
import org.genesys2.server.servlet.controller.rest.TraitsController;
import org.genesys2.server.servlet.controller.rest.UserController;
import org.genesys2.server.servlet.controller.rest.UsersController;
......@@ -165,7 +162,6 @@ import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.security.oauth2.provider.token.ConsumerTokenServices;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.HierarchyMode;
......@@ -310,8 +306,8 @@ public abstract class AbstractRestTest extends BaseSpringTest {
}
@Bean
public OAuth2ClientDetailsService auth2ClientDetailsService() {
return new OAuth2ClientDetailsServiceImpl();
public OAuthServiceImpl oauthService() {
return new OAuthServiceImpl();
}
@Bean
......@@ -404,23 +400,6 @@ public abstract class AbstractRestTest extends BaseSpringTest {
return new EasySMTAMockConnector();
}
@Bean
public TokenController tokenController() {
return new TokenController();
}
@Bean
public ConsumerTokenServices consumerTokenServices() {
DefaultTokenServices tokenServices = new DefaultTokenServices();
tokenServices.setTokenStore(tokenStore());
return tokenServices;
}
@Bean
public JPATokenStore tokenStore() {
return new OAuth2JPATokenStoreImpl();
}
@Bean
public OAuthManagementController oAuthManagementController() {
return new OAuthManagementController();
......@@ -573,29 +552,20 @@ public abstract class AbstractRestTest extends BaseSpringTest {
// OAuthManagementController oAuthManagementController;
@Autowired
protected OAuthAccessTokenPersistence accessTokenPersistence;
@Autowired
protected OAuthRefreshTokenPersistence refreshTokenPersistence;
protected AccessTokenRepository accessTokenPersistence;
@Autowired
protected OAuthClientDetailsPersistence clientDetailsPersistence;
protected RefreshTokenRepository refreshTokenPersistence;
@Autowired
protected OAuth2ClientDetailsService clientDetailsService;
protected OAuthClientRepository clientDetailsPersistence;
@Autowired
protected TokenController tokenController;
@Autowired
protected ConsumerTokenServices tokenServices;
protected OAuthClientDetailsService clientDetailsService;
@Autowired
protected TokenStore tokenStore;
@Autowired
protected ConsumerTokenServices consumerTokenServices;
@Autowired
protected EasySMTA easySMTAConnector;
......
/*
* Copyright 2016 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.genesys2.tests.resttests;
import static org.hamcrest.Matchers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys.blocks.security.UserException;
import org.genesys.blocks.security.service.PasswordPolicy.PasswordPolicyException;
import org.genesys2.server.model.UserRole;
import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.AccessionId;
import org.genesys2.server.model.genesys.Metadata;
import org.genesys2.server.model.genesys.MetadataMethod;
import org.genesys2.server.model.genesys.Method;
import org.genesys2.server.model.genesys.Parameter;
import org.genesys2.server.model.genesys.ParameterCategory;
import org.genesys2.server.model.genesys.Taxonomy2;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.Crop;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.impl.User;
import org.genesys2.server.model.oauth.OAuthClientDetails;
import org.genesys2.server.model.oauth.OAuthClientType;
import org.genesys2.server.model.oauth.OAuthRefreshToken;
import org.genesys2.server.servlet.controller.rest.AccessionController;
import org.genesys2.server.servlet.controller.rest.model.AccessionHeaderJson;
import org.genesys2.server.servlet.controller.rest.model.AccessionNamesJson;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.DefaultAuthorizationRequest;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@Ignore
public class AccessionControllerTest extends AbstractRestTest {
private static final Log LOG = LogFactory.getLog(AccessionControllerTest.class);
@Autowired
private WebApplicationContext webApplicationContext;
MockMvc mockMvc;
private Metadata metadata;
private FaoInstitute faoInstitute;
private List<FaoInstitute> institutes = new ArrayList<>();
private User user = new User();
private OAuth2AccessToken accessToken;
private OAuthRefreshToken refreshToken;
private OAuthClientDetails oAuthClientDetails;
private Method method;
private Crop crop;
private ParameterCategory category;
private Parameter parameter;
private MetadataMethod metadataMethod;
private Accession accession;
private Country country = new Country();
@Before
public void setup() throws UserException, JsonProcessingException, InterruptedException, PasswordPolicyException {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
oAuthClientDetails = clientDetailsService.addClientDetails("title", "description", "redirectUri", 1, 2, OAuthClientType.SERVICE);
user = new User();
user.setEmail("salexandrbasov@gmail.com");
user.setPassword("Alexandr19011990");
user.setFullName("SYS_ADMIN");
userService.addUser(user);
faoInstitute = new FaoInstitute();
faoInstitute.setFullName("This is name of institute");
faoInstitute.setCurrent(true);
faoInstitute.setPgrActivity(true);
faoInstitute.setMaintainsCollection(true);
faoInstitute.setPgrActivity(true);
faoInstitute.setAccessionCount(1);
faoInstitute.setUniqueAcceNumbs(true);
faoInstitute.setCode("Code");
institutes.add(faoInstitute);
instituteService.update(institutes);
ObjectMapper objectMapper = new ObjectMapper();
crop = cropService.addCrop("shortName", "Name", "description", "en");
traitService.addCategory("nameOfParameterCategory", objectMapper.writeValueAsString("en"));
parameter = traitService.addParameter("rdfUri", crop, "nameOfParameterCategory", "titleOfParameter", objectMapper.writeValueAsString("en"));
method = traitService.addMethod("rdfUriMethod", "descriptionMethod", objectMapper.writeValueAsString("en"), "unitForMethod", "fieldName", 1, 2, "options", "range", parameter);
metadata = datasetService.addDataset(faoInstitute, "TitleMetaData", "Description metaData");
Map<Integer, Boolean> permission = new HashMap<>();
metadataMethod = new MetadataMethod();
metadataMethod.setMetadata(metadata);
metadataMethod.setMethodId(method.getId());
metadataMethodRepository.save(metadataMethod);
permission.put(4, true);
permission.put(1, false);
permission.put(2, false);
permission.put(8, false);
permission.put(16, true);
aclService.addPermissions(metadata.getId(), Metadata.class.getName(), "SYS_ADMIN", true, permission);
HashMap<String, String> authorizationParameters = new HashMap<String, String>();
authorizationParameters.put("scope", "read");
authorizationParameters.put("username", user.getEmail());
authorizationParameters.put("client_id", user.getEmail());
authorizationParameters.put("grant", user.getPassword());
DefaultAuthorizationRequest authorizationRequest = new DefaultAuthorizationRequest(authorizationParameters);
authorizationRequest.setApproved(true);
List<GrantedAuthority> authorities = new ArrayList<>();
GrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(UserRole.ADMINISTRATOR.getName());
authorities.add(simpleGrantedAuthority);
authorizationRequest.setAuthorities(authorities);
HashSet<String> resourceIds = new HashSet<String>();
resourceIds.add(user.getEmail());
authorizationRequest.setResourceIds(resourceIds);
oAuthClientDetails.setResourceIds(user.getEmail());
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user, user, authorities);
OAuth2Authentication authenticationRequest = new OAuth2Authentication(authorizationRequest, authenticationToken);
authenticationRequest.setAuthenticated(true);
accessToken = ((DefaultTokenServices) tokenServices).createAccessToken(authenticationRequest);
refreshToken = new OAuthRefreshToken();
refreshToken.setValue("Value");
refreshToken.setClientId(user.getEmail());
refreshTokenPersistence.save(refreshToken);
Taxonomy2 taxonomy2 = taxonomyService.internalEnsure(String.valueOf(0), "Species taxonomy", "SpAuthor", "SubTaxa", "SubtAuthor");
country.setCode3("UKR");
country.setName("Ukraine");
countryRepository.save(country);
accession = new Accession();
accession.setVersion(1);
accession.setInstitute(faoInstitute);
accession.setAccessionName("NameAccession");
accession.setHistoric(false);
accession.setTaxonomy(taxonomy2);
accession.setCountryOfOrigin(country);
AccessionId accessionId = new AccessionId();
accessionId.setVersion(1);
accession.setAccessionId(accessionId);
List<Accession> accessionList = new ArrayList<>();
accessionList.add(accession);
genesysService.addAccessions(accessionList);
SecurityContextHolder.getContext().setAuthentication(authenticationRequest);
}
@After
public void tearDown() {
methodRepository.deleteAll();
parameterRepository.deleteAll();
parameterCategoryRepository.deleteAll();
cropRepository.deleteAll();
userPersistence.deleteAll();
accessionHistoricRepository.deleteAll();
accessionRepository.deleteAll();
countryRepository.deleteAll();
taxonomy2Repository.deleteAll();
instituteRepository.deleteAll();
metadataMethodRepository.deleteAll();
metadataRepository.deleteAll();
}
@Test
public void existsTest() throws Exception {
LOG.info("Start test-method existsTest");
mockMvc.perform(get("/api/v0/acn/exists/{instCode}/{genus}", accession.getInstituteCode(), accession.getTaxGenus())
.contentType(MediaType.APPLICATION_JSON)
.param("acceNumb", accession.getAccessionName()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().string("true"));
LOG.info("Test existsTest passed.");
}
@Test
public void checkTest() throws Exception {
LOG.info("Start test-method checkTest");
ObjectMapper objectMapper = new ObjectMapper();
mockMvc.perform(post("/api/v0/acn/{instCode}/check", accession.getInstituteCode())
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(accession.getAccessionName())))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$", hasSize(1)))
.andExpect(jsonPath("$[0]", is(Integer.parseInt(accession.getAccessionId().getId().toString()))));
LOG.info("Test checkTest passed.");
}
@Test
public void upsertInstituteAccessionTest() throws Exception {
LOG.info("Start test-method upsertInstituteAccessionTest");
ObjectMapper objectMapper = new ObjectMapper();
String JSON_OK = "{\"result\":true}";