Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
19e2fdde
Commit
19e2fdde
authored
Sep 26, 2017
by
Piotr Gawron
Browse files
all unit tests use test database (but they are still slow...)
parent
e16e68e2
Pipeline
#2371
failed with stage
in 36 seconds
Changes
21
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
annotation/src/test/java/lcsb/mapviewer/annotation/AnnotationTestFunctions.java
View file @
19e2fdde
...
...
@@ -57,7 +57,7 @@ import lcsb.mapviewer.persist.dao.cache.CacheTypeDao;
@Transactional
(
value
=
"txManager"
)
@Rollback
(
false
)
@ContextConfiguration
(
locations
=
{
//
"/dataSource.xml"
,
//
"/
test-
dataSource.xml"
,
//
"/applicationContext-annotation.xml"
,
//
"/applicationContext-persist.xml"
,
//
"/test-applicationContext.xml"
,
//
...
...
converter-SBGNML/pom.xml
View file @
19e2fdde
...
...
@@ -95,6 +95,15 @@
<artifactId>
commons-cli
</artifactId>
<version>
${commons-cli.version}
</version>
</dependency>
<!-- Test db definition -->
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
persist
</artifactId>
<version>
1.0
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/DbSerializationTest.java
View file @
19e2fdde
...
...
@@ -20,7 +20,8 @@ import lcsb.mapviewer.persist.DbUtils;
import
lcsb.mapviewer.persist.dao.map.ModelDao
;
@Transactional
(
value
=
"txManager"
)
@ContextConfiguration
(
locations
=
{
"/applicationContext-persist.xml"
,
//
@ContextConfiguration
(
locations
=
{
"/test-dataSource.xml"
,
//
"/applicationContext-persist.xml"
,
//
"/test-applicationContext.xml"
,
//
})
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
...
...
model/src/main/java/lcsb/mapviewer/model/map/graph/DataMining.java
View file @
19e2fdde
...
...
@@ -43,13 +43,13 @@ public class DataMining implements Serializable {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"idDb"
,
unique
=
true
,
nullable
=
false
)
private
I
nt
eger
id
;
private
i
nt
id
;
/**
* For which element this entry was created.
*/
@ManyToOne
(
optional
=
false
)
private
Element
element
;
private
Element
element
;
/**
* List of the suggested connection.
...
...
model/src/main/java/lcsb/mapviewer/model/user/User.java
View file @
19e2fdde
...
...
@@ -40,7 +40,7 @@ public class User implements Serializable, DbObject {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"idDb"
,
unique
=
true
,
nullable
=
false
)
private
I
nt
eger
id
;
private
i
nt
id
;
/**
* User login.
...
...
model/src/main/java/lcsb/mapviewer/model/user/UserAnnotationSchema.java
View file @
19e2fdde
...
...
@@ -38,13 +38,13 @@ public class UserAnnotationSchema implements Serializable {
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
* Default class logger.
*/
@Transient
private
final
transient
Logger
logger
=
Logger
.
getLogger
(
UserAnnotationSchema
.
class
);
private
final
transient
Logger
logger
=
Logger
.
getLogger
(
UserAnnotationSchema
.
class
);
/**
* Unique identifier in the database.
...
...
@@ -52,7 +52,7 @@ public class UserAnnotationSchema implements Serializable {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"idDb"
,
unique
=
true
,
nullable
=
false
)
private
I
nt
eger
id
;
private
i
nt
id
;
/**
* {@link User} for which annotation schema is defined.
...
...
@@ -63,18 +63,18 @@ public class UserAnnotationSchema implements Serializable {
/**
* Should the miriam types be validated?
*/
private
Boolean
validateMiriamTypes
=
false
;
private
Boolean
validateMiriamTypes
=
false
;
/**
* Should map be visualized as sbgn?
*/
private
Boolean
sbgnFormat
=
false
;
private
Boolean
sbgnFormat
=
false
;
/**
* Should the default view be network (if not then it will be pathways and
* compartments)?
*/
private
Boolean
networkLayoutAsDefault
=
false
;
private
Boolean
networkLayoutAsDefault
=
false
;
/**
* List of class annotators for specific object types.
...
...
@@ -82,7 +82,7 @@ public class UserAnnotationSchema implements Serializable {
@Cascade
({
CascadeType
.
ALL
})
@OneToMany
(
mappedBy
=
"annotationSchema"
)
@OrderBy
(
"id"
)
private
List
<
UserClassAnnotators
>
classAnnotators
=
new
ArrayList
<
UserClassAnnotators
>();
private
List
<
UserClassAnnotators
>
classAnnotators
=
new
ArrayList
<
UserClassAnnotators
>();
/**
* List of valid annotations for given object type.
...
...
@@ -90,7 +90,7 @@ public class UserAnnotationSchema implements Serializable {
@Cascade
({
CascadeType
.
ALL
})
@OneToMany
(
mappedBy
=
"annotationSchema"
)
@OrderBy
(
"id"
)
private
List
<
UserClassValidAnnotations
>
classValidAnnotators
=
new
ArrayList
<
UserClassValidAnnotations
>();
private
List
<
UserClassValidAnnotations
>
classValidAnnotators
=
new
ArrayList
<
UserClassValidAnnotations
>();
/**
* List of required annotations for given object type.
...
...
@@ -321,7 +321,8 @@ public class UserAnnotationSchema implements Serializable {
}
/**
* @param sbgnFormat the sbgnFormat to set
* @param sbgnFormat
* the sbgnFormat to set
* @see #sbgnFormat
*/
public
void
setSbgnFormat
(
Boolean
sbgnFormat
)
{
...
...
@@ -337,7 +338,8 @@ public class UserAnnotationSchema implements Serializable {
}
/**
* @param networkLayoutAsDefault the networkLayoutAsDefault to set
* @param networkLayoutAsDefault
* the networkLayoutAsDefault to set
* @see #networkLayoutAsDefault
*/
public
void
setNetworkLayoutAsDefault
(
Boolean
networkLayoutAsDefault
)
{
...
...
model/src/main/java/lcsb/mapviewer/model/user/UserClassAnnotators.java
View file @
19e2fdde
...
...
@@ -32,7 +32,7 @@ public class UserClassAnnotators implements Serializable {
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
* Unique identifier in the database.
...
...
@@ -40,19 +40,19 @@ public class UserClassAnnotators implements Serializable {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"idDb"
,
unique
=
true
,
nullable
=
false
)
private
I
nt
eger
id
;
private
i
nt
id
;
/**
* {@link UserAnnotationSchema} that defines which user is using this set of
* annotators.
*/
@ManyToOne
private
UserAnnotationSchema
annotationSchema
;
private
UserAnnotationSchema
annotationSchema
;
/**
* Class for which this set of annotators is defined.
*/
private
String
className
;
private
String
className
;
/**
* List of strings defining set of annotators (canonical class names).
...
...
@@ -61,7 +61,7 @@ public class UserClassAnnotators implements Serializable {
@CollectionTable
(
name
=
"class_annotator_annotators_table"
,
joinColumns
=
@JoinColumn
(
name
=
"class_annotator_iddb"
))
@IndexColumn
(
name
=
"idx"
)
@Column
(
name
=
"annotator_name"
)
private
List
<
String
>
annotators
=
new
ArrayList
<
String
>();
private
List
<
String
>
annotators
=
new
ArrayList
<
String
>();
/**
* Default constructor.
...
...
model/src/main/java/lcsb/mapviewer/model/user/UserClassRequiredAnnotations.java
View file @
19e2fdde
...
...
@@ -52,7 +52,7 @@ public class UserClassRequiredAnnotations implements Serializable {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"idDb"
,
unique
=
true
,
nullable
=
false
)
private
I
nt
eger
id
;
private
i
nt
id
;
/**
* {@link UserAnnotationSchema} in which this set of required
...
...
model/src/main/java/lcsb/mapviewer/model/user/UserClassValidAnnotations.java
View file @
19e2fdde
...
...
@@ -35,7 +35,7 @@ public class UserClassValidAnnotations implements Serializable {
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
* Unique identifier in the database.
...
...
@@ -43,19 +43,19 @@ public class UserClassValidAnnotations implements Serializable {
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"idDb"
,
unique
=
true
,
nullable
=
false
)
private
I
nt
eger
id
;
private
i
nt
id
;
/**
* {@link UserAnnotationSchema} in which this set of valid {@link MiriamType
* annotations} is used.
*/
@ManyToOne
private
UserAnnotationSchema
annotationSchema
;
private
UserAnnotationSchema
annotationSchema
;
/**
* Name of the class for which this set is defined.
*/
private
String
className
;
private
String
className
;
/**
* List of annotations that are valid.
...
...
@@ -65,7 +65,7 @@ public class UserClassValidAnnotations implements Serializable {
@Column
(
name
=
"miriam_type_name"
,
nullable
=
false
)
@IndexColumn
(
name
=
"idx"
)
@Enumerated
(
EnumType
.
STRING
)
private
List
<
MiriamType
>
validMiriamTypes
=
new
ArrayList
<
MiriamType
>();
private
List
<
MiriamType
>
validMiriamTypes
=
new
ArrayList
<
MiriamType
>();
/**
* Default constructor.
...
...
persist/src/test/java/lcsb/mapviewer/persist/PersistTestFunctions.java
View file @
19e2fdde
...
...
@@ -56,7 +56,7 @@ import lcsb.mapviewer.persist.dao.user.UserDao;
@Transactional
(
value
=
"txManager"
)
@Rollback
(
true
)
@ContextConfiguration
(
locations
=
{
"/dataSource.xml"
,
"/applicationContext-persist.xml"
,
"/test-applicationContext.xml"
})
@ContextConfiguration
(
locations
=
{
"/
test-
dataSource.xml"
,
"/applicationContext-persist.xml"
,
"/test-applicationContext.xml"
})
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
abstract
class
PersistTestFunctions
{
private
Logger
logger
=
Logger
.
getLogger
(
PersistTestFunctions
.
class
);
...
...
persist/src/test/resources/db.properties
deleted
100644 → 0
View file @
e16e68e2
database.uri
=
jdbc:postgresql://localhost:5432/map_viewer_test
\ No newline at end of file
persist/src/test/resources/dataSource.xml
→
persist/src/test/resources/
test-
dataSource.xml
View file @
19e2fdde
...
...
@@ -12,14 +12,14 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd"
>
<context:property-placeholder
location=
"classpath:db.properties"
/>
<context:property-placeholder
location=
"classpath:
test-
db.properties"
/>
<!-- Data Source Declaration -->
<bean
id=
"DataSource"
class=
"org.springframework.jdbc.datasource.DriverManagerDataSource"
>
<property
name=
"driverClassName"
value=
"org.postgresql.Driver"
/>
<property
name=
"url"
value=
"${database.uri}"
/>
<property
name=
"username"
value=
"
map_viewer
"
/>
<property
name=
"password"
value=
"
123qweasdzxc
"
/>
<property
name=
"username"
value=
"
${database.username}
"
/>
<property
name=
"password"
value=
"
${database.password}
"
/>
</bean>
<jdbc:initialize-database
data-source=
"DataSource"
>
...
...
persist/src/test/resources/test-db.properties
0 → 100644
View file @
19e2fdde
database.uri
=
jdbc:postgresql://localhost:5432/map_viewer_test
database.username
=
map_viewer
database.password
=
123qweasdzxc
reactome/pom.xml
View file @
19e2fdde
...
...
@@ -83,6 +83,15 @@
<artifactId>
spring-faces
</artifactId>
<version>
${springframework.webflow.version}
</version>
</dependency>
<!-- Test db definition -->
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
persist
</artifactId>
<version>
1.0
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
reactome/src/test/java/lcsb/mapviewer/reactome/ReactomeTestFunctions.java
View file @
19e2fdde
...
...
@@ -51,26 +51,27 @@ import org.xml.sax.SAXException;
@Transactional
(
value
=
"txManager"
)
@Rollback
(
false
)
@ContextConfiguration
(
locations
=
{
"/applicationContext-annotation.xml"
,
//
@ContextConfiguration
(
locations
=
{
"/test-dataSource.xml"
,
//
"/applicationContext-annotation.xml"
,
//
"/applicationContext-reactome.xml"
,
//
"/applicationContext-persist.xml"
,
//
"/test-applicationContext.xml"
,
//
})
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
abstract
class
ReactomeTestFunctions
{
private
Logger
logger
=
Logger
.
getLogger
(
ReactomeTestFunctions
.
class
);
private
Logger
logger
=
Logger
.
getLogger
(
ReactomeTestFunctions
.
class
);
@Autowired
protected
PermanentDatabaseLevelCacheInterface
cache
;
protected
PermanentDatabaseLevelCacheInterface
cache
;
@Autowired
protected
DataSourceUpdater
rc
;
protected
DataSourceUpdater
rc
;
@Autowired
protected
DbUtils
dbUtils
;
protected
DbUtils
dbUtils
;
@Autowired
protected
ReactomeQueryUtil
rcu
;
protected
ReactomeQueryUtil
rcu
;
protected
String
readFile
(
String
file
)
throws
IOException
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
...
...
@@ -132,7 +133,7 @@ public abstract class ReactomeTestFunctions {
return
doc
;
}
private
static
Map
<
String
,
Model
>
models
=
new
HashMap
<
String
,
Model
>();
private
static
Map
<
String
,
Model
>
models
=
new
HashMap
<
String
,
Model
>();
protected
Model
getModelForFile
(
String
fileName
,
boolean
fromCache
)
throws
Exception
{
if
(!
fromCache
)
{
...
...
@@ -248,8 +249,9 @@ public abstract class ReactomeTestFunctions {
protected
void
waitForRefreshCacheQueueToEmpty
()
throws
InterruptedException
{
while
(
cache
.
refreshIsBusy
())
{
logger
.
debug
(
"Waiting for refresh queue to empty. "
+
cache
.
getRefreshPendingQueueSize
()
+
" pending. "
+
cache
.
getRefreshExecutingTasksSize
()
+
" tasks are executed."
);
logger
.
debug
(
"Waiting for refresh queue to empty. "
+
cache
.
getRefreshPendingQueueSize
()
+
" pending. "
+
cache
.
getRefreshExecutingTasksSize
()
+
" tasks are executed."
);
Thread
.
sleep
(
100
);
}
}
...
...
rest-api/pom.xml
View file @
19e2fdde
...
...
@@ -74,6 +74,15 @@
<version>
${mockito.version}
</version>
<scope>
test
</scope>
</dependency>
<!-- Test db definition -->
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
persist
</artifactId>
<version>
1.0
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
rest-api/src/test/java/lcsb/mapviewer/api/RestTestFunctions.java
View file @
19e2fdde
...
...
@@ -63,8 +63,13 @@ import lcsb.mapviewer.services.view.AuthenticationToken;
@Transactional
(
value
=
"txManager"
)
@Rollback
(
true
)
@ContextConfiguration
(
locations
=
{
"/applicationContext-persist.xml"
,
"/applicationContext-annotation.xml"
,
"/applicationContext-service.xml"
,
"/applicationContext-rest.xml"
})
@ContextConfiguration
(
locations
=
{
"/test-dataSource.xml"
,
//
"/applicationContext-persist.xml"
,
//
"/applicationContext-annotation.xml"
,
//
"/applicationContext-service.xml"
,
//
"/applicationContext-rest.xml"
,
//
})
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
abstract
class
RestTestFunctions
{
private
Logger
logger
=
Logger
.
getLogger
(
RestTestFunctions
.
class
);
...
...
@@ -200,9 +205,9 @@ public abstract class RestTestFunctions {
complexParams
.
entry
(
entry4
);
complexParams
.
entry
(
entry5
);
Model
model
=
parser
.
createModel
(
complexParams
);
Model
model
=
parser
.
createModel
(
complexParams
);
model
.
setTileSize
(
256
);
for
(
ModelSubmodelConnection
connection:
model
.
getSubmodelConnections
())
{
for
(
ModelSubmodelConnection
connection
:
model
.
getSubmodelConnections
())
{
connection
.
getSubmodel
().
setTileSize
(
256
);
}
model
.
setProject
(
new
Project
());
...
...
service/pom.xml
View file @
19e2fdde
...
...
@@ -126,6 +126,15 @@
<scope>
test
</scope>
</dependency>
<!-- Test db definition -->
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
persist
</artifactId>
<version>
1.0
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
service/src/test/java/lcsb/mapviewer/services/ServiceTestFunctions.java
View file @
19e2fdde
...
...
@@ -83,7 +83,11 @@ import lcsb.mapviewer.services.search.db.drug.IDrugService;
@Transactional
(
value
=
"txManager"
)
@Rollback
(
false
)
@ContextConfiguration
(
locations
=
{
"/applicationContext-annotation.xml"
,
"/applicationContext-persist.xml"
,
"/applicationContext-service.xml"
})
@ContextConfiguration
(
locations
=
{
"/test-dataSource.xml"
,
//
"/applicationContext-annotation.xml"
,
//
"/applicationContext-persist.xml"
,
//
"/applicationContext-service.xml"
,
//
})
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
abstract
class
ServiceTestFunctions
{
private
Logger
logger
=
Logger
.
getLogger
(
ServiceTestFunctions
.
class
);
...
...
@@ -178,7 +182,7 @@ public abstract class ServiceTestFunctions {
protected
ReactionDao
reactionDao
;
@Autowired
protected
ElementDao
aliasDao
;
protected
ElementDao
aliasDao
;
protected
User
user
;
protected
User
user2
=
null
;
...
...
web/pom.xml
View file @
19e2fdde
...
...
@@ -194,6 +194,16 @@
<scope>
test
</scope>
</dependency>
<!-- Test db definition -->
<dependency>
<groupId>
lcsb.mapviewer
</groupId>
<artifactId>
persist
</artifactId>
<version>
1.0
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
...
...
Prev
1
2
Next
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