1
|
package eu.dnetlib.msro.workers.aggregation.mdstore;
|
2
|
|
3
|
import java.util.UUID;
|
4
|
|
5
|
import com.mongodb.client.MongoCollection;
|
6
|
import com.mongodb.client.MongoDatabase;
|
7
|
import org.apache.commons.logging.Log;
|
8
|
import org.apache.commons.logging.LogFactory;
|
9
|
import org.junit.runner.RunWith;
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
import org.springframework.boot.test.context.SpringBootTest;
|
12
|
import org.springframework.test.context.ActiveProfiles;
|
13
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
14
|
|
15
|
/**
|
16
|
* Created by claudio on 22/03/2017.
|
17
|
*/
|
18
|
@ActiveProfiles("mdstoreTest")
|
19
|
@RunWith(SpringJUnit4ClassRunner.class)
|
20
|
@SpringBootTest(classes = EmbeddedMongodbConfiguration.class)
|
21
|
public abstract class AbstractMDStoreTest {
|
22
|
|
23
|
protected static final Log log = LogFactory.getLog(AbstractMDStoreTest.class);
|
24
|
|
25
|
protected final static String PACKAGE = "/eu/dnetlib/msro/workers/aggregation/mdstore/";
|
26
|
|
27
|
@Autowired
|
28
|
protected MongoDatabase mongoDatabase;
|
29
|
|
30
|
protected <T>MongoCollection<T> getCollection(final String name, final Class<T> clazz) {
|
31
|
return mongoDatabase.getCollection(name, clazz);
|
32
|
}
|
33
|
|
34
|
protected String mockMDID() {
|
35
|
return UUID.randomUUID().toString();
|
36
|
}
|
37
|
|
38
|
}
|