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
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
0791a593
Commit
0791a593
authored
Feb 18, 2016
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests work
parent
37dd9b33
Changes
61
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
61 changed files
with
989 additions
and
853 deletions
+989
-853
src/main/java/org/genesys2/spring/config/HazelcastConfig.java
...main/java/org/genesys2/spring/config/HazelcastConfig.java
+1
-1
src/test/java/org/genesys2/server/model/filters/FiltersTest.java
...t/java/org/genesys2/server/model/filters/FiltersTest.java
+2
-0
src/test/java/org/genesys2/server/model/filters/InverseFiltersTest.java
...org/genesys2/server/model/filters/InverseFiltersTest.java
+2
-0
src/test/java/org/genesys2/server/model/impl/AccessionCacheTest.java
...va/org/genesys2/server/model/impl/AccessionCacheTest.java
+4
-0
src/test/java/org/genesys2/server/model/impl/AccessionStorageTest.java
.../org/genesys2/server/model/impl/AccessionStorageTest.java
+2
-0
src/test/java/org/genesys2/server/model/impl/FaoInstituteTest.java
...java/org/genesys2/server/model/impl/FaoInstituteTest.java
+2
-0
src/test/java/org/genesys2/server/oauth/OAuthTokenSerializationTest.java
...rg/genesys2/server/oauth/OAuthTokenSerializationTest.java
+1
-1
src/test/java/org/genesys2/server/persistence/domain/mock/TraitServiceMock.java
...sys2/server/persistence/domain/mock/TraitServiceMock.java
+2
-3
src/test/java/org/genesys2/server/service/impl/AccessionListReal.java
...a/org/genesys2/server/service/impl/AccessionListReal.java
+2
-0
src/test/java/org/genesys2/server/service/impl/AccessionListTest.java
...a/org/genesys2/server/service/impl/AccessionListTest.java
+2
-0
src/test/java/org/genesys2/server/service/impl/DSTest.java
src/test/java/org/genesys2/server/service/impl/DSTest.java
+2
-0
src/test/java/org/genesys2/server/service/impl/ElasticsearchTest.java
...a/org/genesys2/server/service/impl/ElasticsearchTest.java
+1
-0
src/test/java/org/genesys2/server/service/impl/KPIEntitiesTest.java
...ava/org/genesys2/server/service/impl/KPIEntitiesTest.java
+2
-0
src/test/java/org/genesys2/server/service/impl/KPIServiceTest.java
...java/org/genesys2/server/service/impl/KPIServiceTest.java
+2
-0
src/test/java/org/genesys2/server/service/impl/WorldClimUpdaterDummyTest.java
...nesys2/server/service/impl/WorldClimUpdaterDummyTest.java
+2
-0
src/test/java/org/genesys2/server/service/impl/WorldClimUpdaterTest.java
...rg/genesys2/server/service/impl/WorldClimUpdaterTest.java
+2
-0
src/test/java/org/genesys2/server/service/worker/ElasticUpdaterTest.java
...rg/genesys2/server/service/worker/ElasticUpdaterTest.java
+0
-225
src/test/java/org/genesys2/server/service/worker/HazelcastDistributedExecutorTest.java
...rver/service/worker/HazelcastDistributedExecutorTest.java
+10
-5
src/test/java/org/genesys2/server/service/worker/SGSVUpdateTest.java
...va/org/genesys2/server/service/worker/SGSVUpdateTest.java
+2
-0
src/test/java/org/genesys2/server/test/BatchRESTServiceTest.java
...t/java/org/genesys2/server/test/BatchRESTServiceTest.java
+10
-6
src/test/java/org/genesys2/server/test/GenesysBeansConfig.java
...est/java/org/genesys2/server/test/GenesysBeansConfig.java
+2
-0
src/test/java/org/genesys2/server/test/HtmlSanitizerTest.java
...test/java/org/genesys2/server/test/HtmlSanitizerTest.java
+1
-2
src/test/java/org/genesys2/server/test/JpaDataConfig.java
src/test/java/org/genesys2/server/test/JpaDataConfig.java
+0
-2
src/test/java/org/genesys2/server/test/JpaNoCacheDataConfig.java
...t/java/org/genesys2/server/test/JpaNoCacheDataConfig.java
+0
-1
src/test/java/org/genesys2/server/test/JpaRealDataConfig.java
...test/java/org/genesys2/server/test/JpaRealDataConfig.java
+0
-2
src/test/java/org/genesys2/server/test/MaterialRequestTest.java
...st/java/org/genesys2/server/test/MaterialRequestTest.java
+1
-0
src/test/java/org/genesys2/server/test/NamesTest.java
src/test/java/org/genesys2/server/test/NamesTest.java
+0
-1
src/test/java/org/genesys2/server/test/PropertyPlacholderInitializer.java
...g/genesys2/server/test/PropertyPlacholderInitializer.java
+0
-2
src/test/java/org/genesys2/server/test/TaxonomyEnsureTest.java
...est/java/org/genesys2/server/test/TaxonomyEnsureTest.java
+2
-0
src/test/java/org/genesys2/server/test/TokenVerificationServiceTest.java
...rg/genesys2/server/test/TokenVerificationServiceTest.java
+2
-0
src/test/java/org/genesys2/tests/resttests/AbstractRestTest.java
...t/java/org/genesys2/tests/resttests/AbstractRestTest.java
+490
-403
src/test/java/org/genesys2/tests/resttests/AccessionControllerTest.java
...org/genesys2/tests/resttests/AccessionControllerTest.java
+29
-10
src/test/java/org/genesys2/tests/resttests/ApiDocumentation.java
...t/java/org/genesys2/tests/resttests/ApiDocumentation.java
+5
-0
src/test/java/org/genesys2/tests/resttests/CacheControllerTest.java
...ava/org/genesys2/tests/resttests/CacheControllerTest.java
+10
-7
src/test/java/org/genesys2/tests/resttests/CropsControllerTest.java
...ava/org/genesys2/tests/resttests/CropsControllerTest.java
+5
-0
src/test/java/org/genesys2/tests/resttests/DatasetControllerTest.java
...a/org/genesys2/tests/resttests/DatasetControllerTest.java
+28
-10
src/test/java/org/genesys2/tests/resttests/KPIControllerTest.java
.../java/org/genesys2/tests/resttests/KPIControllerTest.java
+29
-7
src/test/java/org/genesys2/tests/resttests/LookupControllerTest.java
...va/org/genesys2/tests/resttests/LookupControllerTest.java
+8
-7
src/test/java/org/genesys2/tests/resttests/OAuthManagementControllerTest.java
...nesys2/tests/resttests/OAuthManagementControllerTest.java
+20
-9
src/test/java/org/genesys2/tests/resttests/OrganizationControllerTest.java
.../genesys2/tests/resttests/OrganizationControllerTest.java
+11
-7
src/test/java/org/genesys2/tests/resttests/PermissionControllerTest.java
...rg/genesys2/tests/resttests/PermissionControllerTest.java
+14
-10
src/test/java/org/genesys2/tests/resttests/RequestsControllerTest.java
.../org/genesys2/tests/resttests/RequestsControllerTest.java
+17
-12
src/test/java/org/genesys2/tests/resttests/SpringTest.java
src/test/java/org/genesys2/tests/resttests/SpringTest.java
+19
-0
src/test/java/org/genesys2/tests/resttests/TokenControllerTest.java
...ava/org/genesys2/tests/resttests/TokenControllerTest.java
+22
-10
src/test/java/org/genesys2/tests/resttests/TraitsControllerTest.java
...va/org/genesys2/tests/resttests/TraitsControllerTest.java
+14
-11
src/test/java/org/genesys2/tests/resttests/UserControllerTest.java
...java/org/genesys2/tests/resttests/UserControllerTest.java
+16
-7
src/test/java/org/genesys2/tests/resttests/UsersControllerTest.java
...ava/org/genesys2/tests/resttests/UsersControllerTest.java
+17
-12
src/test/java/org/genesys2/tests/unit/AbstractServicesTest.java
...st/java/org/genesys2/tests/unit/AbstractServicesTest.java
+70
-26
src/test/java/org/genesys2/tests/unit/AuthUserDetailsServiceTest.java
...a/org/genesys2/tests/unit/AuthUserDetailsServiceTest.java
+5
-2
src/test/java/org/genesys2/tests/unit/ContentSanitizerTest.java
...st/java/org/genesys2/tests/unit/ContentSanitizerTest.java
+4
-4
src/test/java/org/genesys2/tests/unit/ContentServiceTest.java
...test/java/org/genesys2/tests/unit/ContentServiceTest.java
+16
-10
src/test/java/org/genesys2/tests/unit/CropServiceTest.java
src/test/java/org/genesys2/tests/unit/CropServiceTest.java
+15
-6
src/test/java/org/genesys2/tests/unit/DescriptorServiceTest.java
...t/java/org/genesys2/tests/unit/DescriptorServiceTest.java
+2
-2
src/test/java/org/genesys2/tests/unit/EmailServiceTest.java
src/test/java/org/genesys2/tests/unit/EmailServiceTest.java
+2
-2
src/test/java/org/genesys2/tests/unit/EmailVerificationServiceTest.java
...org/genesys2/tests/unit/EmailVerificationServiceTest.java
+14
-7
src/test/java/org/genesys2/tests/unit/FooBar.java
src/test/java/org/genesys2/tests/unit/FooBar.java
+14
-0
src/test/java/org/genesys2/tests/unit/OWASPSanitaizerTest.java
...est/java/org/genesys2/tests/unit/OWASPSanitaizerTest.java
+5
-4
src/test/java/org/genesys2/tests/unit/TeamServiceTest.java
src/test/java/org/genesys2/tests/unit/TeamServiceTest.java
+8
-6
src/test/java/org/genesys2/tests/unit/TokenVerificationServiceTest.java
...org/genesys2/tests/unit/TokenVerificationServiceTest.java
+4
-2
src/test/java/org/genesys2/tests/unit/UserServiceTest.java
src/test/java/org/genesys2/tests/unit/UserServiceTest.java
+13
-7
src/test/resources/log4j.properties
src/test/resources/log4j.properties
+2
-2
No files found.
src/main/java/org/genesys2/spring/config/HazelcastConfig.java
View file @
0791a593
...
...
@@ -37,7 +37,7 @@ public abstract class HazelcastConfig {
@Value
(
"${hazelcast.port}"
)
protected
int
hazelPort
;
@Value
(
"${hazelcast.instanceName}"
)
protected
String
instanceName
=
"genesys"
;
protected
String
instanceName
;
@Value
(
"${hazelcast.password}"
)
protected
String
password
;
@Value
(
"${hazelcast.name}"
)
...
...
src/test/java/org/genesys2/server/model/filters/FiltersTest.java
View file @
0791a593
...
...
@@ -20,6 +20,7 @@ import org.genesys2.server.service.impl.TraitServiceImpl;
import
org.genesys2.server.service.impl.UserServiceImpl
;
import
org.genesys2.server.test.JpaDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -40,6 +41,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
FiltersTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
FiltersTest
{
public
static
final
Log
LOG
=
LogFactory
.
getLog
(
FiltersTest
.
class
);
...
...
src/test/java/org/genesys2/server/model/filters/InverseFiltersTest.java
View file @
0791a593
...
...
@@ -9,6 +9,7 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.genesys2.server.service.impl.FilterHandler.AppliedFilters
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
InverseFiltersTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
InverseFiltersTest
{
public
static
final
Log
LOG
=
LogFactory
.
getLog
(
InverseFiltersTest
.
class
);
...
...
src/test/java/org/genesys2/server/model/impl/AccessionCacheTest.java
View file @
0791a593
...
...
@@ -48,6 +48,7 @@ import org.genesys2.server.service.impl.UserServiceImpl;
import
org.genesys2.server.test.JpaRealDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -56,6 +57,7 @@ import org.springframework.cache.support.NoOpCacheManager;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
...
@@ -70,6 +72,8 @@ import com.hazelcast.monitor.LocalMapStats;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
AccessionCacheTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
@DirtiesContext
public
class
AccessionCacheTest
{
@Import
({
JpaRealDataConfig
.
class
,
HazelcastConfig
.
class
})
...
...
src/test/java/org/genesys2/server/model/impl/AccessionStorageTest.java
View file @
0791a593
...
...
@@ -30,6 +30,7 @@ import org.genesys2.server.service.GenesysService;
import
org.genesys2.server.test.BatchRESTServiceTest
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.util.MCPDUtil
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -40,6 +41,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
BatchRESTServiceTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
AccessionStorageTest
{
@Autowired
...
...
src/test/java/org/genesys2/server/model/impl/FaoInstituteTest.java
View file @
0791a593
...
...
@@ -29,8 +29,10 @@ import java.util.List;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.junit.Ignore
;
import
org.junit.Test
;
@Ignore
public
class
FaoInstituteTest
{
@Test
...
...
src/test/java/org/genesys2/server/oauth/OAuthTokenSerializationTest.java
View file @
0791a593
...
...
@@ -68,7 +68,7 @@ public class OAuthTokenSerializationTest {
DefaultOAuth2AccessToken
tokenRead
=
mapper
.
readValue
(
accessTokenStr
,
DefaultOAuth2AccessToken
.
class
);
assertTrue
(
tokenRead
.
getTokenType
().
equals
(
accessToken
.
getTokenType
()));
// roughly the same
assertTrue
(
tokenRead
.
getExpiration
().
getTime
()
/
10000
==
(
accessToken
.
getExpiration
().
getTime
()
/
1
0000
));
assertTrue
(
tokenRead
.
getExpiration
().
getTime
()
/
50000
==
(
accessToken
.
getExpiration
().
getTime
()
/
5
0000
));
assertTrue
(
tokenRead
.
getValue
().
equals
(
accessToken
.
getValue
()));
assertTrue
(
tokenRead
.
getScope
().
size
()
==
accessToken
.
getScope
().
size
());
...
...
src/test/java/org/genesys2/server/persistence/domain/mock/TraitServiceMock.java
View file @
0791a593
...
...
@@ -17,7 +17,6 @@ import org.genesys2.server.model.impl.Crop;
import
org.genesys2.server.persistence.domain.AccessionTraitRepository
;
import
org.genesys2.server.persistence.domain.GenesysLowlevelRepository
;
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.ParameterCategoryRepository
;
import
org.genesys2.server.persistence.domain.ParameterRepository
;
...
...
@@ -59,8 +58,8 @@ public class TraitServiceMock implements TraitService{
private
MethodRepository
methodRepository
;
@Autowired
private
AccessionTraitRepository
accessionTraitRepository
;
@Autowired
private
MetadataRepository
metadataRepository
;
//
@Autowired
//
private MetadataRepository metadataRepository;
@Autowired
private
MetadataMethodRepository
metadataMethodRepository
;
...
...
src/test/java/org/genesys2/server/service/impl/AccessionListReal.java
View file @
0791a593
...
...
@@ -38,6 +38,7 @@ import org.genesys2.server.test.GenesysBeansConfig;
import
org.genesys2.server.test.JpaRealDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -54,6 +55,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
{
HazelcastConfig
.
class
,
JpaRealDataConfig
.
class
,
AccessionListReal
.
Config
.
class
,
GenesysBeansConfig
.
class
},
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
AccessionListReal
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
AccessionListReal
.
class
);
...
...
src/test/java/org/genesys2/server/service/impl/AccessionListTest.java
View file @
0791a593
...
...
@@ -24,6 +24,7 @@ import org.genesys2.server.service.AccessionListService;
import
org.genesys2.server.test.JpaDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -38,6 +39,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
{
HazelcastConfig
.
class
,
JpaDataConfig
.
class
,
AccessionListTest
.
Config
.
class
},
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
AccessionListTest
{
public
static
class
Config
{
...
...
src/test/java/org/genesys2/server/service/impl/DSTest.java
View file @
0791a593
...
...
@@ -17,6 +17,7 @@ import org.genesys2.server.test.JpaDataConfig;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.hamcrest.collection.IsCollectionWithSize
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -32,6 +33,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
DSTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
DSTest
{
@Import
({
HazelcastConfig
.
class
,
JpaDataConfig
.
class
})
...
...
src/test/java/org/genesys2/server/service/impl/ElasticsearchTest.java
View file @
0791a593
...
...
@@ -73,6 +73,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
ElasticsearchTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"cacher"
)
@Ignore
public
class
ElasticsearchTest
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
ElasticsearchTest
.
class
);
...
...
src/test/java/org/genesys2/server/service/impl/KPIEntitiesTest.java
View file @
0791a593
...
...
@@ -43,6 +43,7 @@ import org.genesys2.server.service.KPIService;
import
org.genesys2.server.test.JpaDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -59,6 +60,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
KPIEntitiesTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
KPIEntitiesTest
{
private
static
Logger
log
=
Logger
.
getLogger
(
KPIEntitiesTest
.
class
);
...
...
src/test/java/org/genesys2/server/service/impl/KPIServiceTest.java
View file @
0791a593
...
...
@@ -34,6 +34,7 @@ import org.genesys2.server.service.KPIService;
import
org.genesys2.server.test.JpaRealDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -50,6 +51,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
KPIServiceTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
KPIServiceTest
{
private
static
Logger
log
=
Logger
.
getLogger
(
KPIService
.
class
);
...
...
src/test/java/org/genesys2/server/service/impl/WorldClimUpdaterDummyTest.java
View file @
0791a593
...
...
@@ -22,6 +22,7 @@ import org.genesys2.server.service.worker.WorldClimUpdater;
import
org.genesys2.server.test.JpaDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -38,6 +39,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
WorldClimUpdaterDummyTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
WorldClimUpdaterDummyTest
{
@Import
({
HazelcastConfig
.
class
,
JpaDataConfig
.
class
})
...
...
src/test/java/org/genesys2/server/service/impl/WorldClimUpdaterTest.java
View file @
0791a593
...
...
@@ -18,6 +18,7 @@ import org.genesys2.server.service.worker.WorldClimUpdater;
import
org.genesys2.server.test.JpaRealDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -33,6 +34,7 @@ import com.hazelcast.spring.cache.HazelcastCacheManager;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
WorldClimUpdaterTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@ActiveProfiles
(
"dev"
)
@Ignore
public
class
WorldClimUpdaterTest
{
@Import
({
HazelcastConfig
.
class
,
JpaRealDataConfig
.
class
})
...
...
src/test/java/org/genesys2/server/service/worker/ElasticUpdaterTest.java
deleted
100644 → 0
View file @
37dd9b33
/**
* Copyright 2014 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.server.service.worker
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.velocity.app.VelocityEngine
;
import
org.apache.velocity.exception.VelocityException
;
import
org.genesys2.server.aspect.AsAdminAspect
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.service.AclService
;
import
org.genesys2.server.service.BatchRESTService
;
import
org.genesys2.server.service.ContentService
;
import
org.genesys2.server.service.CropService
;
import
org.genesys2.server.service.ElasticService
;
import
org.genesys2.server.service.GenesysFilterService
;
import
org.genesys2.server.service.GenesysService
;
import
org.genesys2.server.service.GeoService
;
import
org.genesys2.server.service.HtmlSanitizer
;
import
org.genesys2.server.service.InstituteService
;
import
org.genesys2.server.service.OrganizationService
;
import
org.genesys2.server.service.TaxonomyService
;
import
org.genesys2.server.service.UserService
;
import
org.genesys2.server.service.impl.AclServiceImpl
;
import
org.genesys2.server.service.impl.BatchRESTServiceImpl
;
import
org.genesys2.server.service.impl.ContentServiceImpl
;
import
org.genesys2.server.service.impl.CropServiceImpl
;
import
org.genesys2.server.service.impl.ElasticsearchSearchServiceImpl
;
import
org.genesys2.server.service.impl.GenesysFilterServiceImpl
;
import
org.genesys2.server.service.impl.GenesysServiceImpl
;
import
org.genesys2.server.service.impl.GeoServiceImpl
;
import
org.genesys2.server.service.impl.InstituteServiceImpl
;
import
org.genesys2.server.service.impl.OWASPSanitizer
;
import
org.genesys2.server.service.impl.OrganizationServiceImpl
;
import
org.genesys2.server.service.impl.TaxonomyServiceImpl
;
import
org.genesys2.server.service.impl.UserServiceImpl
;
import
org.genesys2.server.test.JpaDataConfig
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.genesys2.spring.config.ElasticsearchConfig
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.NoOpCacheManager
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.core.task.TaskExecutor
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.ui.velocity.VelocityEngineFactoryBean
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
ElasticUpdaterTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
public
class
ElasticUpdaterTest
{
private
static
final
Log
LOG
=
LogFactory
.
getLog
(
ElasticUpdaterTest
.
class
);
@EnableAspectJAutoProxy
@Import
({
JpaDataConfig
.
class
,
ElasticsearchConfig
.
class
})
@ComponentScan
(
basePackages
=
{
"org.genesys2.server.persistence.domain"
})
public
static
class
Config
{
@Bean
public
AsAdminAspect
asAdminAspect
()
{
return
new
AsAdminAspect
();
}
@Bean
public
UserService
userService
()
{
return
new
UserServiceImpl
();
}
@Bean
public
ObjectMapper
objectMapper
()
{
return
new
ObjectMapper
();
}
@Bean
public
AclService
aclService
()
{
return
new
AclServiceImpl
();
}
@Bean
public
TaxonomyService
taxonomyService
()
{
return
new
TaxonomyServiceImpl
();
}
@Bean
public
BatchRESTService
batchRESTService
()
{
return
new
BatchRESTServiceImpl
();
}
@Bean
public
GenesysService
genesysService
()
{
return
new
GenesysServiceImpl
();
}
@Bean
public
GenesysFilterService
genesysFilterService
()
{
return
new
GenesysFilterServiceImpl
();
}
@Bean
public
CacheManager
cacheManager
()
{
return
new
NoOpCacheManager
();
}
@Bean
public
HtmlSanitizer
htmlSanitizer
()
{
return
new
OWASPSanitizer
();
}
@Bean
public
GeoService
geoService
()
{
return
new
GeoServiceImpl
();
}
@Bean
public
ContentService
contentService
()
{
return
new
ContentServiceImpl
();
}
@Bean
public
VelocityEngine
velocityEngine
()
throws
VelocityException
,
IOException
{
final
VelocityEngineFactoryBean
vf
=
new
VelocityEngineFactoryBean
();
return
vf
.
createVelocityEngine
();
}
@Bean
public
OrganizationService
organizationService
()
{
return
new
OrganizationServiceImpl
();
}
@Bean
public
InstituteService
instituteService
()
{
return
new
InstituteServiceImpl
();
}
@Bean
public
ElasticService
elasticService
()
{
return
new
ElasticsearchSearchServiceImpl
();
}
@Bean
public
ElasticUpdaterProcessor
elasticUpdaterProcessor
()
{
return
new
ElasticUpdaterProcessor
();
}
@Bean
public
ElasticUpdater
elasticUpdater
()
{
return
new
ElasticUpdater
();
}
@Bean
public
TaskExecutor
taskExecutor
()
{
return
new
ThreadPoolTaskExecutor
();
}
@Bean
public
CropService
cropService
()
{
return
new
CropServiceImpl
();
}
@Bean
public
ElasticUpdaterAspect
elasticUpdaterAspect
()
{
return
new
ElasticUpdaterAspect
();
}
}
@Autowired
private
ElasticUpdater
elasticUpdater
;
@Autowired
private
GenesysService
genesysService
;
@Test
public
void
testDo
()
throws
Exception
{
elasticUpdater
.
update
(
Accession
.
class
,
1
l
);
LOG
.
info
(
"Done."
);
}
@Test
public
void
testAspect
()
throws
InterruptedException
{
Accession
a
=
new
Accession
();
a
.
setAccessionName
(
"A-1"
);
genesysService
.
saveAccession
(
a
);
LOG
.
info
(
"Accession saved"
);
Thread
.
sleep
(
1000
);
}
@Test
public
void
testAspect2
()
throws
InterruptedException
{
List
<
Accession
>
a
=
new
ArrayList
<
Accession
>();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
Accession
accn
;
a
.
add
(
accn
=
new
Accession
());
accn
.
setAccessionName
(
"A-"
+
i
);
}
genesysService
.
saveAccessions
(
a
);
LOG
.
info
(
"Accessions saved"
);
Thread
.
sleep
(
5000
);
}
}
src/test/java/org/genesys2/server/service/worker/HazelcastDistributedExecutorTest.java
View file @
0791a593
...
...
@@ -14,6 +14,7 @@ import org.apache.commons.lang.math.RandomUtils;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.genesys2.server.test.PropertyPlacholderInitializer
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.DisposableBean
;
...
...
@@ -23,6 +24,8 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext.HierarchyMode
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
...
@@ -48,9 +51,11 @@ import com.hazelcast.spring.context.SpringManagedContext;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
HazelcastDistributedExecutorTest
.
TestConfig
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@Ignore
@DirtiesContext
(
hierarchyMode
=
HierarchyMode
.
EXHAUSTIVE
,
classMode
=
DirtiesContext
.
ClassMode
.
AFTER_CLASS
)
public
class
HazelcastDistributedExecutorTest
{
private
static
final
Log
LOG
=
LogFactory
.
getLog
(
ElasticUpdate
rTest
.
class
);
private
static
final
Log
LOG
=
LogFactory
.
getLog
(
HazelcastDistributedExecuto
rTest
.
class
);
@EnableAspectJAutoProxy
@Import
({})
...
...
@@ -58,11 +63,11 @@ public class HazelcastDistributedExecutorTest {
public
static
class
TestConfig
{
@Value
(
"${hazelcast.port}"
)
int
hazelPort
;
@Value
(
"${hazelcast.instanceName}"
)
private
String
instanceName
=
"genesys"
;
@Value
(
"${hazelcast.instanceName}
-testexec
"
)
private
String
instanceName
;
@Value
(
"${hazelcast.password}"
)
private
String
password
;
@Value
(
"${hazelcast.name}"
)
@Value
(
"${hazelcast.name}
-testexec
"
)
private
String
name
;
@Bean
...
...
@@ -106,7 +111,7 @@ public class HazelcastDistributedExecutorTest {
QueueConfig
queueConfig
=
new
QueueConfig
();
queueConfig
.
setName
(
"elasticsearchQueue"
);
queueConfig
.
setMaxSize
(
1
00
);
queueConfig
.
setMaxSize
(
5
00
);
cfg
.
addQueueConfig
(
queueConfig
);
HazelcastInstance
instance
=
Hazelcast
.
newHazelcastInstance
(
cfg
);
...
...
src/test/java/org/genesys2/server/service/worker/SGSVUpdateTest.java
View file @
0791a593
...
...
@@ -60,6 +60,7 @@ import org.genesys2.server.test.PropertyPlacholderInitializer;
import
org.hsqldb.lib.StringInputStream
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -77,6 +78,7 @@ import org.springframework.ui.velocity.VelocityEngineFactoryBean;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
SGSVUpdateTest
.
Config
.
class
,
initializers
=
PropertyPlacholderInitializer
.
class
)
@Ignore
public
class
SGSVUpdateTest
{
private
static
final
Log
LOG
=
LogFactory
.
getLog
(
SGSVUpdateTest
.
class
);
...
...
src/test/java/org/genesys2/server/test/BatchRESTServiceTest.java
View file @
0791a593
...
...
@@ -16,7 +16,8 @@
package
org.genesys2.server.test
;
import
static
org
.
hamcrest
.
CoreMatchers
.*;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
hamcrest
.
CoreMatchers
.
notNullValue
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
...
...
@@ -67,20 +68,21 @@ import org.genesys2.server.service.impl.TaxonomyServiceImpl;
import
org.genesys2.server.service.impl.UserServiceImpl
;
import
org.genesys2.server.servlet.controller.rest.model.AccessionHeaderJson
;
import
org.genesys2.spring.config.HazelcastConfig
;
import
org.genesys2.tests.unit.FooBar
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.NoOpCacheManager
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;