Revision 45488
Added by Claudio Atzori about 7 years ago
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/tools/registration/ServiceRegistrationManagerImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.tools.registration; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertFalse; |
|
4 |
import static org.junit.Assert.assertTrue; |
|
5 |
import static org.mockito.Matchers.anyObject; |
|
6 |
import static org.mockito.Matchers.anyString; |
|
7 |
import static org.mockito.Mockito.when; |
|
8 |
|
|
9 | 3 |
import java.util.Arrays; |
10 |
|
|
11 | 4 |
import javax.xml.ws.Endpoint; |
12 | 5 |
|
6 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
7 |
import eu.dnetlib.rmi.common.BaseService; |
|
8 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
|
9 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
13 | 10 |
import org.junit.Before; |
14 | 11 |
import org.junit.Ignore; |
15 | 12 |
import org.junit.Test; |
16 | 13 |
import org.junit.runner.RunWith; |
17 | 14 |
import org.mockito.Mock; |
18 |
import org.mockito.runners.MockitoJUnitRunner;
|
|
15 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
19 | 16 |
|
20 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
21 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
|
22 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
17 |
import static org.junit.Assert.assertFalse; |
|
18 |
import static org.junit.Assert.assertTrue; |
|
19 |
import static org.mockito.ArgumentMatchers.any; |
|
20 |
import static org.mockito.Matchers.anyString; |
|
21 |
import static org.mockito.Mockito.when; |
|
23 | 22 |
|
24 | 23 |
/** |
25 | 24 |
* test ServiceRegistrationManagerImpl. |
... | ... | |
86 | 85 |
@Test |
87 | 86 |
@Ignore |
88 | 87 |
public void testTick() throws Exception { |
89 |
when(this.registrator.registerService(anyObject(), (Endpoint) anyObject())).thenReturn("123");
|
|
88 |
when(this.registrator.registerService(any(BaseService.class), any(Endpoint.class))).thenReturn("123");
|
|
90 | 89 |
|
91 | 90 |
assertFalse(this.manager.isDisabled()); |
92 | 91 |
this.manager.registerAllServices(); |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/sn/AbstractSubscriptionRegistryTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.sn; |
2 | 2 |
|
3 |
import static org.junit.Assert.*; // NOPMD |
|
4 |
|
|
3 |
import java.util.Arrays; |
|
5 | 4 |
import java.util.Collection; |
6 | 5 |
|
7 | 6 |
import org.junit.Before; |
8 | 7 |
import org.junit.Test; |
9 | 8 |
|
10 |
import java.util.Arrays; |
|
9 |
import static org.junit.Assert.assertNotNull; |
|
10 |
import static org.junit.Assert.assertNull; |
|
11 | 11 |
|
12 | 12 |
/** |
13 | 13 |
* abstract subscription registry test. |
... | ... | |
35 | 35 |
protected Collection<String> getAcceptedPrefixes() { |
36 | 36 |
return Arrays.asList(new String[] { "CREATE", "DELETE", "UPDATE", "DEEP/SUB" }); |
37 | 37 |
} |
38 |
|
|
39 | 38 |
}; |
40 |
|
|
41 | 39 |
} |
42 | 40 |
|
43 | 41 |
/** |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/sn/NotificationDetectorImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.sn; |
2 | 2 |
|
3 |
import static org.junit.Assert.*; // NOPMD |
|
4 |
import static org.mockito.Mockito.*; // NOPMD |
|
5 |
|
|
6 | 3 |
import java.util.ArrayList; |
7 | 4 |
import java.util.List; |
8 |
|
|
9 | 5 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
10 | 6 |
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; |
11 | 7 |
|
8 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription; |
|
9 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscriptionRegistry; |
|
10 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
12 | 11 |
import org.junit.Before; |
13 | 12 |
import org.junit.Test; |
14 | 13 |
import org.junit.runner.RunWith; |
15 | 14 |
import org.mockito.ArgumentMatcher; |
16 | 15 |
import org.mockito.Mock; |
17 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
16 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
18 | 17 |
|
19 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscription; |
|
20 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateSubscriptionRegistry; |
|
21 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
18 |
import static org.junit.Assert.assertNotNull; |
|
19 |
import static org.mockito.Mockito.*; |
|
22 | 20 |
|
23 | 21 |
/** |
24 | 22 |
* Test the default notification detector implementation. |
... | ... | |
26 | 24 |
* @author marko |
27 | 25 |
* |
28 | 26 |
*/ |
29 |
@RunWith(MockitoJUnit44Runner.class)
|
|
27 |
@RunWith(MockitoJUnitRunner.class) |
|
30 | 28 |
public class NotificationDetectorImplTest { |
31 | 29 |
|
32 | 30 |
/** |
... | ... | |
45 | 43 |
* @author marko |
46 | 44 |
* |
47 | 45 |
*/ |
48 |
private final class CheckMessage extends ArgumentMatcher<NotificationMessage> {
|
|
46 |
private final class CheckMessage implements ArgumentMatcher<NotificationMessage> {
|
|
49 | 47 |
|
50 | 48 |
/** |
51 | 49 |
* prefix. |
... | ... | |
67 | 65 |
* @see org.mockito.ArgumentMatcher#matches(java.lang.Object) |
68 | 66 |
*/ |
69 | 67 |
@Override |
70 |
public boolean matches(final Object argument) { |
|
71 |
final NotificationMessage message = (NotificationMessage) argument; |
|
68 |
public boolean matches(final NotificationMessage message) { |
|
72 | 69 |
return message.getSubscriptionId() == subscription.getSubscriptionId() && message.getResourceId().equals("123") |
73 | 70 |
&& message.getTopic().equals(prefix + ".*.*"); |
74 | 71 |
} |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/sn/resourcestate/ResourceStateSubscriptionRegistryTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.sn.resourcestate; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertEquals; |
|
4 |
import static org.junit.Assert.assertNotNull; // NOPMD |
|
5 |
import static org.mockito.Matchers.argThat; |
|
6 |
import static org.mockito.Mockito.verify; // NOPMD |
|
7 |
|
|
3 |
import eu.dnetlib.enabling.is.sn.SubscriptionRequest; |
|
4 |
import eu.dnetlib.rmi.enabling.SubscriptionRequestRejectedException; |
|
8 | 5 |
import org.junit.Before; |
9 | 6 |
import org.junit.Test; |
10 | 7 |
import org.junit.runner.RunWith; |
11 | 8 |
import org.mockito.ArgumentMatcher; |
12 | 9 |
import org.mockito.Mock; |
13 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
10 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
14 | 11 |
|
15 |
import eu.dnetlib.enabling.is.sn.SubscriptionRequest; |
|
16 |
import eu.dnetlib.rmi.enabling.SubscriptionRequestRejectedException; |
|
12 |
import static org.junit.Assert.assertEquals; |
|
13 |
import static org.junit.Assert.assertNotNull; |
|
14 |
import static org.mockito.Matchers.argThat; |
|
15 |
import static org.mockito.Mockito.verify; |
|
17 | 16 |
|
18 | 17 |
/** |
19 | 18 |
* test ResourceStateSubscriptionRegistryTest. |
... | ... | |
21 | 20 |
* @author marko |
22 | 21 |
* |
23 | 22 |
*/ |
24 |
@RunWith(MockitoJUnit44Runner.class)
|
|
23 |
@RunWith(MockitoJUnitRunner.class) |
|
25 | 24 |
public class ResourceStateSubscriptionRegistryTest { |
26 | 25 |
|
27 | 26 |
/** |
... | ... | |
30 | 29 |
* @author marko |
31 | 30 |
* |
32 | 31 |
*/ |
33 |
public static class MatchSubscription extends ArgumentMatcher<ResourceStateSubscription> {
|
|
32 |
public static class MatchSubscription implements ArgumentMatcher<ResourceStateSubscription> {
|
|
34 | 33 |
|
35 | 34 |
/** |
36 | 35 |
* prefix. |
... | ... | |
70 | 69 |
* @see org.mockito.ArgumentMatcher#matches(java.lang.Object) |
71 | 70 |
*/ |
72 | 71 |
@Override |
73 |
public boolean matches(final Object argument) { |
|
74 |
final ResourceStateSubscription sub = (ResourceStateSubscription) argument; |
|
72 |
public boolean matches(final ResourceStateSubscription sub) { |
|
75 | 73 |
return sub.getPrefix().equals(this.prefix) && sub.getType().equals(this.type) && sub.getResourceId().equals(this.resId); |
76 | 74 |
} |
77 | 75 |
|
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/sn/NotificationTriggerImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.sn; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertNotNull; |
|
4 |
import static org.mockito.Matchers.argThat; |
|
5 |
import static org.mockito.Mockito.verify; |
|
6 |
|
|
7 | 3 |
import java.io.IOException; |
8 | 4 |
import java.io.StringReader; |
9 |
|
|
10 | 5 |
import javax.xml.parsers.DocumentBuilder; |
11 | 6 |
import javax.xml.parsers.DocumentBuilderFactory; |
12 | 7 |
import javax.xml.parsers.ParserConfigurationException; |
13 | 8 |
|
9 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateNotificationDetector; |
|
10 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
14 | 11 |
import org.junit.Before; |
15 | 12 |
import org.junit.Test; |
16 | 13 |
import org.junit.runner.RunWith; |
17 | 14 |
import org.mockito.ArgumentMatcher; |
18 | 15 |
import org.mockito.Mock; |
19 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
16 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
20 | 17 |
import org.w3c.dom.Document; |
21 | 18 |
import org.xml.sax.InputSource; |
22 | 19 |
import org.xml.sax.SAXException; |
23 | 20 |
|
24 |
import eu.dnetlib.enabling.is.sn.resourcestate.ResourceStateNotificationDetector; |
|
25 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
21 |
import static org.junit.Assert.assertNotNull; |
|
22 |
import static org.mockito.Matchers.argThat; |
|
23 |
import static org.mockito.Mockito.verify; |
|
26 | 24 |
|
27 | 25 |
/** |
28 | 26 |
* Test NotificationTriggerImpl, a simple forwarder. |
... | ... | |
30 | 28 |
* @author marko |
31 | 29 |
* |
32 | 30 |
*/ |
33 |
@RunWith(MockitoJUnit44Runner.class)
|
|
31 |
@RunWith(MockitoJUnitRunner.class) |
|
34 | 32 |
public class NotificationTriggerImplTest { |
35 | 33 |
|
36 | 34 |
/** |
... | ... | |
39 | 37 |
* @author marko |
40 | 38 |
* |
41 | 39 |
*/ |
42 |
private static final class MatchResource extends ArgumentMatcher<OpaqueResource> {
|
|
40 |
private static final class MatchResource implements ArgumentMatcher<OpaqueResource> {
|
|
43 | 41 |
/** |
44 | 42 |
* {@inheritDoc} |
45 | 43 |
* |
46 | 44 |
* @see org.mockito.ArgumentMatcher#matches(java.lang.Object) |
47 | 45 |
*/ |
48 | 46 |
@Override |
49 |
public boolean matches(final Object argument) { |
|
50 |
final OpaqueResource resource = (OpaqueResource) argument; |
|
47 |
public boolean matches(final OpaqueResource resource) { |
|
51 | 48 |
return resource.getResourceId().equals("123") && resource.getResourceType().equals("type") && resource.getResourceKind().equals("kind"); |
52 | 49 |
} |
53 | 50 |
} |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/registry/schema/OpaqueResourceValidatorImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.registry.schema; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertNotNull; |
|
4 |
import static org.mockito.Matchers.anyString; |
|
5 |
import static org.mockito.Mockito.when; |
|
6 |
|
|
7 | 3 |
import javax.xml.XMLConstants; |
8 | 4 |
import javax.xml.transform.stream.StreamSource; |
9 | 5 |
import javax.xml.validation.Schema; |
10 | 6 |
import javax.xml.validation.SchemaFactory; |
11 | 7 |
|
8 |
import eu.dnetlib.enabling.tools.StreamOpaqueResource; |
|
12 | 9 |
import org.junit.Before; |
13 | 10 |
import org.junit.Test; |
14 | 11 |
import org.junit.runner.RunWith; |
15 | 12 |
import org.mockito.Mock; |
16 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
13 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
17 | 14 |
import org.xml.sax.SAXException; |
18 | 15 |
|
19 |
import eu.dnetlib.enabling.tools.StreamOpaqueResource; |
|
16 |
import static org.junit.Assert.assertNotNull; |
|
17 |
import static org.mockito.Matchers.anyString; |
|
18 |
import static org.mockito.Mockito.when; |
|
20 | 19 |
|
21 | 20 |
/** |
22 | 21 |
* test schema validator. |
... | ... | |
24 | 23 |
* @author marko |
25 | 24 |
* |
26 | 25 |
*/ |
27 |
@RunWith(MockitoJUnit44Runner.class)
|
|
26 |
@RunWith(MockitoJUnitRunner.class) |
|
28 | 27 |
public class OpaqueResourceValidatorImplTest { |
29 | 28 |
|
30 | 29 |
/** |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/registry/schema/ResourceSchemaDAOImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.registry.schema; |
2 | 2 |
|
3 |
import static org.mockito.Matchers.anyString; |
|
4 |
import static org.mockito.Mockito.when; |
|
5 |
|
|
6 | 3 |
import java.io.StringWriter; |
7 | 4 |
|
5 |
import eu.dnetlib.enabling.tools.StreamOpaqueResource; |
|
6 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
8 | 7 |
import org.apache.commons.io.IOUtils; |
9 | 8 |
import org.junit.Before; |
10 | 9 |
import org.junit.Test; |
11 | 10 |
import org.junit.runner.RunWith; |
12 | 11 |
import org.mockito.Mock; |
13 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
12 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
14 | 13 |
|
15 |
import eu.dnetlib.enabling.tools.StreamOpaqueResource;
|
|
16 |
import eu.dnetlib.rmi.enabling.ISLookUpService;
|
|
14 |
import static org.mockito.Matchers.anyString;
|
|
15 |
import static org.mockito.Mockito.when;
|
|
17 | 16 |
|
18 | 17 |
/** |
19 | 18 |
* test resource schema dao. |
... | ... | |
21 | 20 |
* @author marko |
22 | 21 |
* |
23 | 22 |
*/ |
24 |
@RunWith(MockitoJUnit44Runner.class)
|
|
23 |
@RunWith(MockitoJUnitRunner.class) |
|
25 | 24 |
public class ResourceSchemaDAOImplTest { |
26 | 25 |
|
27 | 26 |
/** |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/registry/ISRegistryServiceImplTest.java | ||
---|---|---|
17 | 17 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
18 | 18 |
import eu.dnetlib.rmi.enabling.ISRegistryDocumentNotFoundException; |
19 | 19 |
import eu.dnetlib.rmi.enabling.ISRegistryException; |
20 |
|
|
21 | 20 |
import org.apache.commons.io.IOUtils; |
22 | 21 |
import org.junit.Before; |
23 | 22 |
import org.junit.Test; |
24 | 23 |
import org.junit.runner.RunWith; |
25 | 24 |
import org.mockito.Mock; |
26 |
import org.mockito.runners.MockitoJUnitRunner;
|
|
25 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
27 | 26 |
import org.xml.sax.SAXException; |
28 | 27 |
|
29 | 28 |
import static org.junit.Assert.*; |
30 |
import static org.mockito.Matchers.anyObject; |
|
31 | 29 |
import static org.mockito.Matchers.anyString; |
32 | 30 |
import static org.mockito.Matchers.eq; |
33 | 31 |
import static org.mockito.Mockito.*; |
... | ... | |
211 | 209 |
public void testRegisterProfile() throws ISRegistryException, ISStoreException, IOException, XPathExpressionException, SAXException, |
212 | 210 |
ParserConfigurationException, ValidationException { |
213 | 211 |
|
214 |
when(profileValidationStrategy.accept((OpaqueResource) anyObject(), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
212 |
when(profileValidationStrategy.accept(any(OpaqueResource.class), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
215 | 213 |
final String newId = registry.registerProfile(profileSource); |
216 | 214 |
|
217 | 215 |
verify(storeService).insertXML(eq(resIdResolver.getFileName(newId)), eq(DB_DRIVER + resIdResolver.getCollectionName(newId)), anyString()); |
... | ... | |
273 | 271 |
ISRegistryException, ValidationException { |
274 | 272 |
final OpaqueResource resource = new StringOpaqueResource(profileSource); |
275 | 273 |
|
276 |
doThrow(new ValidationException("invalid xml")).when(validator).validate((OpaqueResource) anyObject()); |
|
277 |
|
|
278 | 274 |
registry.updateProfile(resource.getResourceId(), "<invalid/>", resource.getResourceType()); |
279 | 275 |
} |
280 | 276 |
|
... | ... | |
308 | 304 |
resource.setResourceId(oldId); |
309 | 305 |
when(lookUpService.getResourceProfile(oldId)).thenReturn(resource.asString()); |
310 | 306 |
when(storeService.deleteXML(resIdResolver.getFileName(oldId), DB_DRIVER + resIdResolver.getCollectionName(oldId))).thenReturn(true); |
311 |
when(profileValidationStrategy.accept((OpaqueResource) anyObject(), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
307 |
when(profileValidationStrategy.accept(any(OpaqueResource.class), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
312 | 308 |
|
313 | 309 |
final String newId = registry.validateProfile(oldId); |
314 | 310 |
|
... | ... | |
355 | 351 |
verify(storeService).insertXML(eq(resIdResolver.getFileName(newId)), eq(DB_DRIVER + resIdResolver.getCollectionName(newId)), anyString()); |
356 | 352 |
|
357 | 353 |
assertFalse("the id should be be unstable", resIdResolver.getFileName(oldId).equals(resIdResolver.getFileName(newId))); |
358 |
|
|
359 | 354 |
} |
360 | 355 |
|
361 | 356 |
/** |
... | ... | |
463 | 458 |
final StringWriter profile = new StringWriter(); |
464 | 459 |
IOUtils.copy(getClass().getResourceAsStream("userProfile.xml"), profile); |
465 | 460 |
when(lookUpService.getResourceProfile(resourceProfId)).thenReturn(profile.toString()); |
466 |
when(profileValidationStrategy.accept((OpaqueResource) anyObject(), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
461 |
when(profileValidationStrategy.accept(any(OpaqueResource.class), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
467 | 462 |
|
468 | 463 |
final StringWriter secure = new StringWriter(); |
469 | 464 |
IOUtils.copy(getClass().getResourceAsStream("securityProfile.xml"), secure); |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/registry/RegistryBlackboardManagerImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.registry; // NOPMD |
2 | 2 |
|
3 |
import static org.junit.Assert.assertEquals; |
|
4 |
import static org.junit.Assert.assertNull; |
|
5 |
import static org.junit.Assert.fail; |
|
6 |
import static org.mockito.Matchers.anyString; |
|
7 |
import static org.mockito.Matchers.argThat; |
|
8 |
import static org.mockito.Matchers.eq; |
|
9 |
import static org.mockito.Mockito.verify; |
|
10 |
import static org.mockito.Mockito.when; |
|
11 |
|
|
12 | 3 |
import java.io.IOException; |
13 | 4 |
import java.io.StringWriter; |
14 |
|
|
15 | 5 |
import javax.xml.bind.JAXBException; |
16 | 6 |
import javax.xml.transform.dom.DOMSource; |
17 | 7 |
import javax.xml.xpath.XPathConstants; |
18 | 8 |
import javax.xml.xpath.XPathFactory; |
19 | 9 |
|
10 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
11 |
import eu.dnetlib.enabling.tools.StringOpaqueResource; |
|
12 |
import eu.dnetlib.enabling.tools.blackboard.*; |
|
13 |
import eu.dnetlib.miscutils.jaxb.JaxbFactory; |
|
14 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
|
15 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
16 |
import eu.dnetlib.rmi.enabling.ISRegistryException; |
|
17 |
import eu.dnetlib.rmi.enabling.ISRegistryService; |
|
20 | 18 |
import org.apache.commons.io.IOUtils; |
21 | 19 |
import org.apache.commons.logging.Log; |
22 | 20 |
import org.apache.commons.logging.LogFactory; |
23 | 21 |
import org.junit.Before; |
24 | 22 |
import org.junit.Test; |
25 | 23 |
import org.junit.runner.RunWith; |
26 |
import org.mockito.ArgumentMatcher; |
|
27 | 24 |
import org.mockito.Mock; |
28 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
25 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
29 | 26 |
import org.w3c.dom.Element; |
30 | 27 |
import org.w3c.dom.Node; |
31 | 28 |
|
32 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
|
33 |
import eu.dnetlib.enabling.tools.StringOpaqueResource; |
|
34 |
import eu.dnetlib.enabling.tools.blackboard.ActionStatus; |
|
35 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardMessage; |
|
36 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardMessageImpl; |
|
37 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardParameter; |
|
38 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardParameterImpl; |
|
39 |
import eu.dnetlib.miscutils.jaxb.JaxbFactory; |
|
40 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
|
41 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
42 |
import eu.dnetlib.rmi.enabling.ISRegistryException; |
|
43 |
import eu.dnetlib.rmi.enabling.ISRegistryService; |
|
29 |
import static org.junit.Assert.*; |
|
30 |
import static org.mockito.Matchers.*; |
|
31 |
import static org.mockito.Mockito.verify; |
|
32 |
import static org.mockito.Mockito.when; |
|
44 | 33 |
|
45 | 34 |
/** |
46 | 35 |
* RegistryBlackboardManagerImpl test. |
... | ... | |
48 | 37 |
* @author marko |
49 | 38 |
* |
50 | 39 |
*/ |
51 |
@RunWith(MockitoJUnit44Runner.class)
|
|
40 |
@RunWith(MockitoJUnitRunner.class) |
|
52 | 41 |
public class RegistryBlackboardManagerImplTest { |
53 | 42 |
|
54 | 43 |
/** |
... | ... | |
156 | 145 |
|
157 | 146 |
manager.addMessage(PROF_ID, MSG_ID, manager.getMessageFactory().serialize(message)); |
158 | 147 |
|
159 |
verify(registryService).updateProfile(eq(PROF_ID), argThat(new ArgumentMatcher<String>() { |
|
148 |
verify(registryService).updateProfile(eq(PROF_ID), argThat(argument -> { |
|
149 |
log.info("arg: " + argument); |
|
160 | 150 |
|
161 |
@Override |
|
162 |
public boolean matches(final Object argument) { |
|
163 |
log.info("arg: " + argument); |
|
151 |
try { |
|
152 |
final OpaqueResource updatedResource = new StringOpaqueResource(argument); |
|
153 |
final Node messageNode = (Node) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/MESSAGE[last()]", |
|
154 |
updatedResource.asDom(), XPathConstants.NODE); |
|
164 | 155 |
|
165 |
try { |
|
166 |
final OpaqueResource updatedResource = new StringOpaqueResource((String) argument); |
|
167 |
final Node messageNode = (Node) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/MESSAGE[last()]", |
|
168 |
updatedResource.asDom(), XPathConstants.NODE); |
|
156 |
final BlackboardMessage updatedMessage = manager.getMessageFactory().parse(new DOMSource(messageNode)); |
|
169 | 157 |
|
170 |
final BlackboardMessage updatedMessage = manager.getMessageFactory().parse(new DOMSource(messageNode));
|
|
158 |
assertEquals("messages should match", message, updatedMessage);
|
|
171 | 159 |
|
172 |
assertEquals("messages should match", message, updatedMessage); |
|
173 |
|
|
174 |
final Element lastUpdated = (Element) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/LAST_REQUEST", |
|
175 |
updatedResource.asDom(), XPathConstants.NODE); |
|
176 |
assertEquals("stamp date", manager.getMessageDater().getNumericStamp(), lastUpdated.getAttribute("date")); |
|
177 |
assertEquals("stamp message", MSG_ID, lastUpdated.getTextContent()); |
|
178 |
} catch (Exception e) { |
|
179 |
fail("got exception" + e); |
|
180 |
} |
|
181 |
return true; |
|
160 |
final Element lastUpdated = (Element) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/LAST_REQUEST", |
|
161 |
updatedResource.asDom(), XPathConstants.NODE); |
|
162 |
assertEquals("stamp date", manager.getMessageDater().getNumericStamp(), lastUpdated.getAttribute("date")); |
|
163 |
assertEquals("stamp message", MSG_ID, lastUpdated.getTextContent()); |
|
164 |
} catch (Exception e) { |
|
165 |
fail("got exception" + e); |
|
182 | 166 |
} |
167 |
return true; |
|
183 | 168 |
}), anyString()); |
184 | 169 |
} |
185 | 170 |
|
... | ... | |
202 | 187 |
|
203 | 188 |
manager.deleteMessage(PROF_ID, MSG_ID); |
204 | 189 |
|
205 |
verify(registryService).updateProfile(eq(PROF_ID), argThat(new ArgumentMatcher<String>() { |
|
190 |
verify(registryService).updateProfile(eq(PROF_ID), argThat(argument -> { |
|
191 |
log.debug("arg: " + argument); |
|
206 | 192 |
|
207 |
@Override |
|
208 |
public boolean matches(final Object argument) { |
|
209 |
log.debug("arg: " + argument); |
|
193 |
try { |
|
194 |
final OpaqueResource updatedResource = new StringOpaqueResource(argument); |
|
210 | 195 |
|
211 |
try {
|
|
212 |
final OpaqueResource updatedResource = new StringOpaqueResource((String) argument);
|
|
196 |
final Node messageNode = (Node) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/MESSAGE[last()]",
|
|
197 |
updatedResource.asDom(), XPathConstants.NODE);
|
|
213 | 198 |
|
214 |
final Node messageNode = (Node) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/MESSAGE[last()]", |
|
215 |
updatedResource.asDom(), XPathConstants.NODE); |
|
216 |
|
|
217 |
assertNull("message should be deleted", messageNode); |
|
218 |
} catch (Exception e) { |
|
219 |
fail("got exception" + e); |
|
220 |
} |
|
221 |
return true; |
|
199 |
assertNull("message should be deleted", messageNode); |
|
200 |
} catch (Exception e) { |
|
201 |
fail("got exception" + e); |
|
222 | 202 |
} |
203 |
return true; |
|
223 | 204 |
}), anyString()); |
224 | 205 |
|
225 | 206 |
// assertNotNull("dummy", manager); |
... | ... | |
262 | 243 |
|
263 | 244 |
manager.replyMessage(PROF_ID, manager.getMessageFactory().serialize(message)); |
264 | 245 |
|
265 |
verify(registryService).updateProfile(eq(PROF_ID), argThat(new ArgumentMatcher<String>() { |
|
246 |
verify(registryService).updateProfile(eq(PROF_ID), argThat(argument -> { |
|
247 |
log.info("arg: " + argument); |
|
266 | 248 |
|
267 |
@Override |
|
268 |
public boolean matches(final Object argument) { |
|
269 |
log.info("arg: " + argument); |
|
249 |
try { |
|
250 |
final OpaqueResource updatedResource = new StringOpaqueResource(argument); |
|
270 | 251 |
|
271 |
try {
|
|
272 |
final OpaqueResource updatedResource = new StringOpaqueResource((String) argument);
|
|
252 |
final Node messageNode = (Node) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/MESSAGE[last()]",
|
|
253 |
updatedResource.asDom(), XPathConstants.NODE);
|
|
273 | 254 |
|
274 |
final Node messageNode = (Node) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/MESSAGE[last()]", |
|
275 |
updatedResource.asDom(), XPathConstants.NODE); |
|
255 |
final BlackboardMessage updatedMessage = manager.getMessageFactory().parse(new DOMSource(messageNode)); |
|
276 | 256 |
|
277 |
final BlackboardMessage updatedMessage = manager.getMessageFactory().parse(new DOMSource(messageNode));
|
|
257 |
assertEquals("messages should match", message, updatedMessage);
|
|
278 | 258 |
|
279 |
assertEquals("messages should match", message, updatedMessage); |
|
280 |
|
|
281 |
final Element lastUpdated = (Element) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/LAST_RESPONSE", |
|
282 |
updatedResource.asDom(), XPathConstants.NODE); |
|
283 |
assertEquals("stamp date", manager.getMessageDater().getNumericStamp(), lastUpdated.getAttribute("date")); |
|
284 |
assertEquals("stamp message", MSG_ID, lastUpdated.getTextContent()); |
|
285 |
} catch (Exception e) { |
|
286 |
fail("got exception" + e); |
|
287 |
} |
|
288 |
return true; |
|
259 |
final Element lastUpdated = (Element) XPathFactory.newInstance().newXPath().evaluate("//BLACKBOARD/LAST_RESPONSE", |
|
260 |
updatedResource.asDom(), XPathConstants.NODE); |
|
261 |
assertEquals("stamp date", manager.getMessageDater().getNumericStamp(), lastUpdated.getAttribute("date")); |
|
262 |
assertEquals("stamp message", MSG_ID, lastUpdated.getTextContent()); |
|
263 |
} catch (Exception e) { |
|
264 |
fail("got exception" + e); |
|
289 | 265 |
} |
266 |
return true; |
|
290 | 267 |
}), anyString()); |
291 | 268 |
} |
292 | 269 |
|
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/registry/CompatPendingResourceManagerImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.registry; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertEquals; |
|
4 |
import static org.junit.Assert.assertNotNull; |
|
5 |
import static org.junit.Assert.assertNull; |
|
6 |
import static org.mockito.Matchers.anyObject; |
|
7 |
import static org.mockito.Matchers.anyString; |
|
8 |
import static org.mockito.Matchers.eq; |
|
9 |
import static org.mockito.Mockito.verify; |
|
10 |
import static org.mockito.Mockito.when; |
|
11 |
|
|
12 | 3 |
import javax.xml.xpath.XPathExpressionException; |
13 | 4 |
|
14 |
import org.junit.Before; |
|
15 |
import org.junit.Test; |
|
16 |
import org.junit.runner.RunWith; |
|
17 |
import org.mockito.Mock; |
|
18 |
import org.mockito.runners.MockitoJUnit44Runner; |
|
19 |
|
|
20 | 5 |
import eu.dnetlib.enabling.is.registry.schema.ValidationException; |
21 | 6 |
import eu.dnetlib.enabling.is.registry.validation.ProfileValidationStrategy; |
22 |
import eu.dnetlib.enabling.is.registry.validation.RegistrationPhase; |
|
23 | 7 |
import eu.dnetlib.enabling.tools.OpaqueResource; |
24 | 8 |
import eu.dnetlib.rmi.enabling.ISRegistryException; |
25 | 9 |
import eu.dnetlib.rmi.enabling.ISRegistryService; |
10 |
import org.junit.Before; |
|
11 |
import org.junit.Test; |
|
12 |
import org.junit.runner.RunWith; |
|
13 |
import org.mockito.Mock; |
|
14 |
import org.mockito.junit.MockitoJUnitRunner; |
|
26 | 15 |
|
16 |
import static org.junit.Assert.*; |
|
17 |
import static org.mockito.ArgumentMatchers.anyString; |
|
18 |
import static org.mockito.Mockito.verify; |
|
19 |
import static org.mockito.Mockito.when; |
|
20 |
|
|
27 | 21 |
/** |
28 | 22 |
* test compatibility pending resource manager implementation. |
29 | 23 |
* |
30 | 24 |
* @author marko |
31 | 25 |
* |
32 | 26 |
*/ |
33 |
@RunWith(MockitoJUnit44Runner.class)
|
|
27 |
@RunWith(MockitoJUnitRunner.class) |
|
34 | 28 |
public class CompatPendingResourceManagerImplTest { |
35 | 29 |
|
36 | 30 |
/** |
... | ... | |
112 | 106 |
@Test |
113 | 107 |
public void testSetValid() throws ISRegistryException, ValidationException { |
114 | 108 |
final String profId = "123"; |
115 |
when(resource.getResourceId()).thenReturn("123");
|
|
116 |
when(profileValidationStrategy.accept((OpaqueResource) anyObject(), eq(RegistrationPhase.Register))).thenReturn(true);
|
|
109 |
when(resource.asString()).thenReturn("");
|
|
110 |
when(resource.getResourceId()).thenReturn(profId);
|
|
117 | 111 |
|
118 | 112 |
pendingManager.setValid(resource); |
119 | 113 |
|
... | ... | |
132 | 126 |
@Test |
133 | 127 |
public void testSetPending() throws ISRegistryException { |
134 | 128 |
final String profId = "321"; |
135 |
when(resource.getResourceId()).thenReturn("321"); |
|
129 |
when(resource.asString()).thenReturn(""); |
|
130 |
when(resource.getResourceId()).thenReturn(profId); |
|
136 | 131 |
when(resource.getResourceType()).thenReturn("RepositoryServiceResourceType"); |
137 | 132 |
|
138 | 133 |
pendingManager.setPending(resource); |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/lookup/ISLookUpServiceImplTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.enabling.is.lookup; |
2 | 2 |
|
3 |
import static org.junit.Assert.assertEquals; |
|
4 |
import static org.junit.Assert.assertNotNull; |
|
5 |
import static org.mockito.Matchers.anyString; |
|
6 |
import static org.mockito.Mockito.when; |
|
7 |
|
|
8 | 3 |
import java.io.IOException; |
9 | 4 |
import java.io.StringReader; |
10 | 5 |
import java.io.StringWriter; |
... | ... | |
13 | 8 |
|
14 | 9 |
import eu.dnetlib.enabling.is.store.ISStore; |
15 | 10 |
import eu.dnetlib.enabling.is.store.ISStoreException; |
11 |
import eu.dnetlib.enabling.tools.XQueryUtilsImpl; |
|
12 |
import eu.dnetlib.rmi.enabling.ISLookUpDocumentNotFoundException; |
|
13 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
|
16 | 14 |
import org.apache.commons.io.IOUtils; |
17 | 15 |
import org.dom4j.Document; |
18 | 16 |
import org.dom4j.DocumentException; |
... | ... | |
21 | 19 |
import org.junit.Test; |
22 | 20 |
import org.junit.runner.RunWith; |
23 | 21 |
import org.mockito.Mock; |
24 |
import org.mockito.runners.MockitoJUnit44Runner;
|
|
22 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
25 | 23 |
|
26 |
import eu.dnetlib.enabling.tools.XQueryUtilsImpl; |
|
27 |
import eu.dnetlib.rmi.enabling.ISLookUpDocumentNotFoundException; |
|
28 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
|
24 |
import static org.junit.Assert.assertEquals; |
|
25 |
import static org.junit.Assert.assertNotNull; |
|
26 |
import static org.mockito.Matchers.anyString; |
|
27 |
import static org.mockito.Mockito.when; |
|
29 | 28 |
|
30 |
import org.mockito.runners.MockitoJUnitRunner; |
|
31 |
|
|
32 | 29 |
/** |
33 | 30 |
* ISLookUpService test. |
34 | 31 |
* |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/store/ISStoreServiceTest.java | ||
---|---|---|
9 | 9 |
import org.junit.Test; |
10 | 10 |
import org.junit.runner.RunWith; |
11 | 11 |
import org.mockito.Mock; |
12 |
import org.mockito.runners.MockitoJUnitRunner;
|
|
12 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
13 | 13 |
import org.xmldb.api.base.XMLDBException; |
14 | 14 |
|
15 | 15 |
import static org.junit.Assert.*; |
... | ... | |
68 | 68 |
@Mock |
69 | 69 |
private transient XMLDatabase xdb; |
70 | 70 |
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 | 71 |
/** |
76 | 72 |
* setup the ISStore instance, injecting all the dependencies. |
77 | 73 |
* |
... | ... | |
87 | 83 |
store = ismo; |
88 | 84 |
} |
89 | 85 |
|
90 |
|
|
91 |
|
|
92 |
|
|
93 | 86 |
/** |
94 | 87 |
* create collection. |
95 | 88 |
* |
... | ... | |
107 | 100 |
/** |
108 | 101 |
* delete collection. |
109 | 102 |
* |
103 |
* @throws ISStoreException |
|
104 |
* shouldn't happen |
|
110 | 105 |
* @throws XMLDBException |
111 | 106 |
* shouldn't happen |
112 |
* @throws ISStoreException |
|
113 |
* shouldn't happen |
|
114 | 107 |
*/ |
115 | 108 |
@Test |
116 |
public void testDeleteFileColl() throws XMLDBException, ISStoreException {
|
|
109 |
public void testDeleteFileColl() throws ISStoreException, XMLDBException {
|
|
117 | 110 |
assertTrue("delete collection", store.deleteFileColl(TEST_COLLECTION)); |
118 | 111 |
verify(xdb).removeCollection(TEST_COLLECTION); |
119 | 112 |
} |
... | ... | |
197 | 190 |
/** |
198 | 191 |
* read an xml file using a xquery. |
199 | 192 |
* |
193 |
* @throws ISStoreException |
|
194 |
* shouldn't happen |
|
200 | 195 |
* @throws XMLDBException |
201 | 196 |
* shouldn't happen |
202 |
* @throws ISStoreException |
|
203 |
* shouldn't happen |
|
204 | 197 |
*/ |
205 | 198 |
@Test |
206 |
public void testGetXMLbyQuery() throws XMLDBException, ISStoreException {
|
|
199 |
public void testGetXMLbyQuery() throws ISStoreException, XMLDBException {
|
|
207 | 200 |
prepareXMLDBResultSet(); |
208 | 201 |
final String res = store.getXMLbyQuery(SOME_QUERY); |
209 | 202 |
assertEquals("get xml by query", ONE, res); |
... | ... | |
211 | 204 |
|
212 | 205 |
/** |
213 | 206 |
* helper method. Prepares a common result mock. |
214 |
* |
|
215 |
* @throws XMLDBException |
|
216 |
* the declaration of this exception is just a syntactic necessity |
|
217 | 207 |
*/ |
218 | 208 |
private void prepareXMLDBResultSet() throws XMLDBException { |
219 | 209 |
List<String> myList = Arrays.asList(ONE,TWO); |
... | ... | |
239 | 229 |
* |
240 | 230 |
* @throws ISStoreException |
241 | 231 |
* happens |
242 |
* @throws XMLDBException |
|
243 |
* happens |
|
244 | 232 |
*/ |
245 | 233 |
@Test |
246 | 234 |
public void testQuickSearchXML() throws ISStoreException, XMLDBException { |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/enabling/is/store/ISStoreServiceImplTest.java | ||
---|---|---|
3 | 3 |
import java.util.ArrayList; |
4 | 4 |
import java.util.List; |
5 | 5 |
|
6 |
|
|
7 | 6 |
import eu.dnetlib.xml.database.XMLDatabase; |
8 | 7 |
import org.junit.Before; |
9 | 8 |
import org.junit.Test; |
10 | 9 |
import org.junit.runner.RunWith; |
11 | 10 |
import org.mockito.Mock; |
12 |
import org.mockito.runners.MockitoJUnitRunner;
|
|
11 |
import org.mockito.junit.MockitoJUnitRunner;
|
|
13 | 12 |
import org.xmldb.api.base.XMLDBException; |
14 | 13 |
|
15 | 14 |
import static org.junit.Assert.assertNotNull; |
16 | 15 |
import static org.junit.Assert.assertTrue; |
17 | 16 |
import static org.mockito.Matchers.anyString; |
18 |
import static org.mockito.Mockito.mock; |
|
19 | 17 |
import static org.mockito.Mockito.when; |
20 | 18 |
|
21 | 19 |
/** |
... | ... | |
50 | 48 |
/** |
51 | 49 |
* test that quick search profile returns null instead of an empty list. |
52 | 50 |
* |
51 |
* @throws ISStoreException shouldn't happen |
|
53 | 52 |
* @throws XMLDBException shouldn't happen |
54 |
* @throws ISStoreException shouldn't happen |
|
55 | 53 |
*/ |
56 | 54 |
@Test |
57 |
public void testQuickSearchXML() throws XMLDBException, ISStoreException {
|
|
55 |
public void testQuickSearchXML() throws ISStoreException, XMLDBException {
|
|
58 | 56 |
|
59 | 57 |
when(xmlDatabase.xquery(anyString())).thenReturn(new ArrayList<String>().iterator()); |
60 | 58 |
final List<String> res = storeService.quickSearchXML("someQuery"); |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/xml/database/exist/TestExistTrigger.java | ||
---|---|---|
42 | 42 |
} |
43 | 43 |
} |
44 | 44 |
|
45 |
|
|
46 |
|
|
47 | 45 |
@Override |
48 | 46 |
public void beforeCreateDocument(final DBBroker dbBroker, final Txn txn, final XmldbURI xmldbURI) throws TriggerException { |
49 | 47 |
|
... | ... | |
116 | 114 |
} catch (XPathExpressionException e) { |
117 | 115 |
log.fatal("xpatthing", e); |
118 | 116 |
} |
119 |
|
|
120 | 117 |
} |
121 | 118 |
|
122 | 119 |
@Override |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/xml/database/exist/ExistDatabaseTest.java | ||
---|---|---|
438 | 438 |
*/ |
439 | 439 |
@Test |
440 | 440 |
public void testSetExistTrigger() throws XMLDBException { |
441 |
final Map<String, String> params = new HashMap<String, String>();
|
|
441 |
final Map<String, String> params = new HashMap<>(); |
|
442 | 442 |
params.put("listenerBean", "pippo"); |
443 | 443 |
|
444 | 444 |
database.createCollection(DB_TEST); |
445 |
edb.setExistTrigger(TestExistTrigger.class, DB_TEST, Arrays.asList(new String[] { "store", "update", "delete" }), params);
|
|
445 |
edb.setExistTrigger(TestExistTrigger.class, DB_TEST, Arrays.asList("store", "update", "delete"), params);
|
|
446 | 446 |
|
447 | 447 |
// assertNotNull("check that the conf is stored", database.read(ExistDatabase.COLLECTION_XCONF, DB_ROOT + "/system/config" + DB_TEST)); |
448 | 448 |
|
... | ... | |
642 | 642 |
|
643 | 643 |
database.registerTrigger(trigger, DB_ROOT); |
644 | 644 |
|
645 |
final List<SimpleParallelJob> threads = new ArrayList<SimpleParallelJob>(); // NOPMD
|
|
645 |
final List<SimpleParallelJob> threads = new ArrayList<>(); // NOPMD |
|
646 | 646 |
for (int i = 0; i < PAR_TIMES; i++) |
647 | 647 |
threads.add(new SimpleParallelJob(i)); // NOPMD |
648 | 648 |
for (Thread thread : threads) { // NOPMD |
modules/dnet-information-service/trunk/src/test/java/eu/dnetlib/xml/database/exist/DOMConverterTestTrigger.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.xml.database.exist; |
2 | 2 |
|
3 |
import org.exist.collections.triggers.FilteringTrigger; |
|
4 | 3 |
import org.exist.collections.triggers.SAXTrigger; |
5 | 4 |
import org.exist.collections.triggers.TriggerException; |
6 |
|
|
7 | 5 |
import org.exist.dom.persistent.DocumentImpl; |
8 | 6 |
import org.exist.storage.DBBroker; |
9 | 7 |
import org.exist.storage.txn.Txn; |
10 | 8 |
import org.exist.xmldb.XmldbURI; |
11 |
import org.w3c.dom.Document; |
|
12 | 9 |
|
13 | 10 |
/** |
14 | 11 |
* helper class for the ExistDOMConverterTest. |
... | ... | |
21 | 18 |
*/ |
22 | 19 |
public class DOMConverterTestTrigger extends SAXTrigger { |
23 | 20 |
|
24 |
|
|
25 |
|
|
26 |
|
|
27 | 21 |
@Override |
28 | 22 |
public void beforeCreateDocument(final DBBroker dbBroker, final Txn txn, final XmldbURI xmldbURI) throws TriggerException { |
29 | 23 |
ExistDOMConverterTest.setTriggered(true); |
modules/dnet-information-service/trunk/pom.xml | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
3 |
<parent>
|
|
4 |
<groupId>eu.dnetlib</groupId>
|
|
5 |
<artifactId>dnet-parent</artifactId>
|
|
6 |
<version>2.0.0-SNAPSHOT</version>
|
|
7 |
<relativePath />
|
|
8 |
</parent>
|
|
9 |
<modelVersion>4.0.0</modelVersion>
|
|
10 |
<groupId>eu.dnetlib</groupId>
|
|
11 |
<artifactId>dnet-information-service</artifactId>
|
|
12 |
<packaging>jar</packaging>
|
|
13 |
<version>1.0.0-SNAPSHOT</version>
|
|
14 |
<scm>
|
|
15 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet50/modules/dnet-information-service/trunk</developerConnection>
|
|
16 |
</scm>
|
|
3 |
<parent>
|
|
4 |
<groupId>eu.dnetlib</groupId>
|
|
5 |
<artifactId>dnet-parent</artifactId>
|
|
6 |
<version>2.0.0-SNAPSHOT</version>
|
|
7 |
<relativePath/>
|
|
8 |
</parent>
|
|
9 |
<modelVersion>4.0.0</modelVersion>
|
|
10 |
<groupId>eu.dnetlib</groupId>
|
|
11 |
<artifactId>dnet-information-service</artifactId>
|
|
12 |
<packaging>jar</packaging>
|
|
13 |
<version>1.0.0-SNAPSHOT</version>
|
|
14 |
<scm>
|
|
15 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet50/modules/dnet-information-service/trunk</developerConnection>
|
|
16 |
</scm>
|
|
17 | 17 |
|
18 |
<repositories> |
|
19 |
<repository> |
|
20 |
<id>exist</id> |
|
21 |
<url>https://raw.github.com/eXist-db/mvn-repo/master/</url> |
|
22 |
</repository> |
|
18 | 23 |
|
19 |
<dependencies> |
|
20 |
<!-- Dnet Dependencies --> |
|
24 |
</repositories> |
|
25 |
<dependencies> |
|
26 |
<!-- Dnet Dependencies --> |
|
21 | 27 |
|
22 |
<dependency>
|
|
23 |
<groupId>eu.dnetlib</groupId>
|
|
24 |
<artifactId>dnet-core-components</artifactId>
|
|
25 |
<version>1.0.0-SNAPSHOT</version>
|
|
26 |
</dependency>
|
|
28 |
<dependency>
|
|
29 |
<groupId>eu.dnetlib</groupId>
|
|
30 |
<artifactId>dnet-core-components</artifactId>
|
|
31 |
<version>1.0.0-SNAPSHOT</version>
|
|
32 |
</dependency>
|
|
27 | 33 |
|
28 |
<dependency>
|
|
29 |
<groupId>org.exist-db</groupId>
|
|
30 |
<artifactId>exist-core</artifactId>
|
|
31 |
<version>3.0.RC1</version>
|
|
32 |
<exclusions>
|
|
33 |
<exclusion>
|
|
34 |
<groupId>asm</groupId>
|
|
35 |
<artifactId>asm</artifactId>
|
|
36 |
</exclusion>
|
|
37 |
<exclusion>
|
|
38 |
<groupId>antlr</groupId>
|
|
39 |
<artifactId>antlr</artifactId>
|
|
40 |
</exclusion>
|
|
41 |
<exclusion>
|
|
42 |
<groupId>org.aspectj</groupId>
|
|
43 |
<artifactId>aspectjrt</artifactId>
|
|
44 |
</exclusion>
|
|
45 |
<exclusion>
|
|
46 |
<groupId>org.eclipse.jetty</groupId>
|
|
47 |
<artifactId>jetty-security</artifactId>
|
|
48 |
</exclusion>
|
|
49 |
<exclusion>
|
|
50 |
<groupId>org.eclipse.jetty</groupId>
|
|
51 |
<artifactId>jetty-server</artifactId>
|
|
52 |
</exclusion>
|
|
53 |
<exclusion>
|
|
54 |
<groupId>org.eclipse.jetty</groupId>
|
|
55 |
<artifactId>jetty-util</artifactId>
|
|
56 |
</exclusion>
|
|
57 |
<exclusion>
|
|
58 |
<artifactId>javax.servlet</artifactId>
|
|
59 |
<groupId>org.eclipse.jetty.orbit</groupId>
|
|
60 |
</exclusion>
|
|
61 |
<exclusion>
|
|
62 |
<groupId>net.sf.saxon</groupId>
|
|
63 |
<artifactId>Saxon-HE</artifactId>
|
|
64 |
</exclusion>
|
|
65 |
</exclusions>
|
|
66 |
</dependency>
|
|
67 |
<dependency>
|
|
68 |
<groupId>javax.servlet</groupId>
|
|
69 |
<artifactId>javax.servlet-api</artifactId>
|
|
70 |
<version>${javax.servlet.version}</version>
|
|
71 |
<scope>provided</scope>
|
|
72 |
</dependency>
|
|
34 |
<dependency>
|
|
35 |
<groupId>org.exist-db</groupId>
|
|
36 |
<artifactId>exist-core</artifactId>
|
|
37 |
<version>${exist.version}</version>
|
|
38 |
<exclusions>
|
|
39 |
<exclusion>
|
|
40 |
<groupId>asm</groupId>
|
|
41 |
<artifactId>asm</artifactId>
|
|
42 |
</exclusion>
|
|
43 |
<exclusion>
|
|
44 |
<groupId>antlr</groupId>
|
|
45 |
<artifactId>antlr</artifactId>
|
|
46 |
</exclusion>
|
|
47 |
<exclusion>
|
|
48 |
<groupId>org.aspectj</groupId>
|
|
49 |
<artifactId>aspectjrt</artifactId>
|
|
50 |
</exclusion>
|
|
51 |
<exclusion>
|
|
52 |
<groupId>org.eclipse.jetty</groupId>
|
|
53 |
<artifactId>jetty-security</artifactId>
|
|
54 |
</exclusion>
|
|
55 |
<exclusion>
|
|
56 |
<groupId>org.eclipse.jetty</groupId>
|
|
57 |
<artifactId>jetty-server</artifactId>
|
|
58 |
</exclusion>
|
|
59 |
<exclusion>
|
|
60 |
<groupId>org.eclipse.jetty</groupId>
|
|
61 |
<artifactId>jetty-util</artifactId>
|
|
62 |
</exclusion>
|
|
63 |
<exclusion>
|
|
64 |
<artifactId>javax.servlet</artifactId>
|
|
65 |
<groupId>org.eclipse.jetty.orbit</groupId>
|
|
66 |
</exclusion>
|
|
67 |
<exclusion>
|
|
68 |
<groupId>net.sf.saxon</groupId>
|
|
69 |
<artifactId>Saxon-HE</artifactId>
|
|
70 |
</exclusion>
|
|
71 |
</exclusions>
|
|
72 |
</dependency>
|
|
73 |
<dependency>
|
|
74 |
<groupId>javax.servlet</groupId>
|
|
75 |
<artifactId>javax.servlet-api</artifactId>
|
|
76 |
<version>${javax.servlet.version}</version>
|
|
77 |
<scope>provided</scope>
|
|
78 |
</dependency>
|
|
73 | 79 |
|
74 |
<dependency>
|
|
75 |
<artifactId>exist-start</artifactId>
|
|
76 |
<groupId>org.exist-db</groupId>
|
|
77 |
<version>3.0.RC1</version>
|
|
78 |
</dependency>
|
|
80 |
<dependency>
|
|
81 |
<artifactId>exist-start</artifactId>
|
|
82 |
<groupId>org.exist-db</groupId>
|
|
83 |
<version>${exist.version}</version>
|
|
84 |
</dependency>
|
|
79 | 85 |
|
80 |
<dependency>
|
|
81 |
<groupId>org.aspectj</groupId>
|
|
82 |
<artifactId>aspectjtools</artifactId>
|
|
83 |
<version>1.8.9</version>
|
|
84 |
</dependency>
|
|
86 |
<dependency>
|
|
87 |
<groupId>org.aspectj</groupId>
|
|
88 |
<artifactId>aspectjrt</artifactId>
|
|
89 |
<version>[1.8.9]</version>
|
|
90 |
</dependency>
|
|
85 | 91 |
|
86 | 92 |
|
93 |
<!-- DB Dependencies --> |
|
87 | 94 |
|
95 |
<dependency> |
|
96 |
<groupId>org.springframework</groupId> |
|
97 |
<artifactId>spring-beans</artifactId> |
|
98 |
<version>${spring.version}</version> |
|
99 |
</dependency> |
|
100 |
<dependency> |
|
101 |
<groupId>org.springframework</groupId> |
|
102 |
<artifactId>spring-jdbc</artifactId> |
|
103 |
<version>${spring.version}</version> |
|
104 |
</dependency> |
|
105 |
<dependency> |
|
106 |
<groupId>org.springframework</groupId> |
|
107 |
<artifactId>spring-tx</artifactId> |
|
108 |
<version>${spring.version}</version> |
|
109 |
</dependency> |
|
110 |
<dependency> |
|
111 |
<groupId>org.springframework</groupId> |
|
112 |
<artifactId>spring-orm</artifactId> |
|
113 |
<version>${spring.version}</version> |
|
114 |
</dependency> |
|
115 |
<dependency> |
|
116 |
<groupId>org.postgresql</groupId> |
|
117 |
<artifactId>jdbc4driver</artifactId> |
|
118 |
<version>8.3</version> |
|
119 |
</dependency> |
|
88 | 120 |
|
89 |
<!-- DB Dependencies --> |
|
121 |
<dependency> |
|
122 |
<groupId>org.xerial</groupId> |
|
123 |
<artifactId>sqlite-jdbc</artifactId> |
|
124 |
<version>3.8.11.2</version> |
|
125 |
</dependency> |
|
90 | 126 |
|
91 |
<dependency> |
|
92 |
<groupId>org.springframework</groupId> |
|
93 |
<artifactId>spring-beans</artifactId> |
|
94 |
<version>${spring.version}</version> |
|
95 |
</dependency> |
|
96 |
<dependency> |
|
97 |
<groupId>org.springframework</groupId> |
|
98 |
<artifactId>spring-jdbc</artifactId> |
|
99 |
<version>${spring.version}</version> |
|
100 |
</dependency> |
|
101 |
<dependency> |
|
102 |
<groupId>org.springframework</groupId> |
|
103 |
<artifactId>spring-tx</artifactId> |
|
104 |
<version>${spring.version}</version> |
|
105 |
</dependency> |
|
106 |
<dependency> |
|
107 |
<groupId>org.springframework</groupId> |
|
108 |
<artifactId>spring-orm</artifactId> |
|
109 |
<version>${spring.version}</version> |
|
110 |
</dependency> |
|
111 |
<dependency> |
|
112 |
<groupId>org.postgresql</groupId> |
|
113 |
<artifactId>jdbc4driver</artifactId> |
|
114 |
<version>8.3</version> |
|
115 |
</dependency> |
|
127 |
<dependency> |
|
128 |
<groupId>org.hibernate</groupId> |
|
129 |
<artifactId>hibernate-entitymanager</artifactId> |
|
130 |
<version>5.0.8.Final</version> |
|
131 |
<exclusions> |
|
132 |
<exclusion> |
|
133 |
<groupId>antlr</groupId> |
|
134 |
<artifactId>antlr</artifactId> |
|
135 |
</exclusion> |
|
136 |
</exclusions> |
|
137 |
</dependency> |
|
116 | 138 |
|
117 |
<dependency> |
|
118 |
<groupId>org.xerial</groupId> |
|
119 |
<artifactId>sqlite-jdbc</artifactId> |
|
120 |
<version>3.8.11.2</version> |
|
121 |
</dependency> |
|
122 | 139 |
|
123 |
<dependency> |
|
124 |
<groupId>org.hibernate</groupId> |
|
125 |
<artifactId>hibernate-entitymanager</artifactId> |
|
126 |
<version>5.0.8.Final</version> |
|
127 |
<exclusions> |
|
128 |
<exclusion> |
|
129 |
<groupId>antlr</groupId> |
|
130 |
<artifactId>antlr</artifactId> |
|
131 |
</exclusion> |
|
132 |
</exclusions> |
|
133 |
</dependency> |
|
134 | 140 |
|
135 | 141 |
|
136 |
<dependency> |
|
137 |
<groupId>hsqldb</groupId> |
|
138 |
<artifactId>hsqldb</artifactId> |
|
139 |
<version>1.8.0.7</version> |
|
140 |
<scope>test</scope> |
|
141 |
</dependency> |
|
142 |
<dependency> |
|
143 |
<groupId>org.apache.commons</groupId> |
|
144 |
<artifactId>commons-dbcp2</artifactId> |
|
145 |
<version>2.1.1</version> |
|
146 |
</dependency> |
|
147 |
<dependency> |
|
148 |
<groupId>commons-beanutils</groupId> |
|
149 |
<artifactId>commons-beanutils</artifactId> |
|
150 |
<version>1.8.3</version> |
|
151 |
</dependency> |
|
142 | 152 |
|
143 |
<dependency> |
|
144 |
<groupId>org.apache.commons</groupId> |
|
145 |
<artifactId>commons-dbcp2</artifactId> |
|
146 |
<version>2.1.1</version> |
|
147 |
</dependency> |
|
148 |
<dependency> |
|
149 |
<groupId>org.aspectj</groupId> |
|
150 |
<artifactId>aspectjrt</artifactId> |
|
151 |
<version>1.6.3</version> |
|
152 |
<scope>test</scope> |
|
153 |
</dependency> |
|
154 |
<dependency> |
|
155 |
<groupId>org.aspectj</groupId> |
|
156 |
<artifactId>aspectjweaver</artifactId> |
|
157 |
<version>1.6.3</version> |
|
158 |
<scope>test</scope> |
|
159 |
</dependency> |
|
153 |
<dependency> |
|
154 |
<groupId>org.aspectj</groupId> |
|
155 |
<artifactId>aspectjweaver</artifactId> |
|
156 |
<version>1.6.3</version> |
|
157 |
<scope>test</scope> |
|
158 |
</dependency> |
|
159 |
<dependency> |
|
160 |
<groupId>hsqldb</groupId> |
|
161 |
<artifactId>hsqldb</artifactId> |
|
162 |
<version>1.8.0.7</version> |
|
163 |
<scope>test</scope> |
|
164 |
</dependency> |
|
165 |
<dependency> |
|
166 |
<groupId>junit</groupId> |
|
167 |
<artifactId>junit</artifactId> |
|
168 |
<version>${junit.version}</version> |
|
169 |
<scope>test</scope> |
|
170 |
</dependency> |
|
171 |
<dependency> |
|
172 |
<groupId>org.mockito</groupId> |
|
173 |
<artifactId>mockito-core</artifactId> |
|
174 |
<version>${mockito.version}</version> |
|
175 |
<scope>test</scope> |
|
176 |
</dependency> |
|
177 |
<dependency> |
|
178 |
<groupId>xml-apis</groupId> |
|
179 |
<artifactId>xml-apis</artifactId> |
|
180 |
<version>1.4.01</version> |
|
181 |
<scope>test</scope> |
|
182 |
</dependency> |
|
183 |
<dependency> |
|
184 |
<groupId>commons-collections</groupId> |
|
185 |
<artifactId>commons-collections</artifactId> |
|
186 |
<version>3.2.2</version> |
|
187 |
<scope>test</scope> |
|
188 |
</dependency> |
|
160 | 189 |
|
161 | 190 |
|
191 |
</dependencies> |
|
162 | 192 |
|
163 | 193 |
|
164 |
|
|
165 |
<dependency> |
|
166 |
<groupId>org.springframework</groupId> |
|
167 |
<artifactId>spring-tx</artifactId> |
|
168 |
<version>${spring.version}</version> |
|
169 |
</dependency> |
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
<dependency> |
|
174 |
<groupId>junit</groupId> |
|
175 |
<artifactId>junit</artifactId> |
|
176 |
<version>${junit.version}</version> |
|
177 |
<scope>test</scope> |
|
178 |
</dependency> |
|
179 |
|
|
180 |
<dependency> |
|
181 |
<groupId>commons-beanutils</groupId> |
|
182 |
<artifactId>commons-beanutils</artifactId> |
|
183 |
<version>1.8.3</version> |
|
184 |
|
|
185 |
</dependency> |
|
186 |
|
|
187 |
|
|
188 |
<dependency> |
|
189 |
<groupId>xml-apis</groupId> |
|
190 |
<artifactId>xml-apis</artifactId> |
|
191 |
<version>1.4.01</version> |
|
192 |
<scope>test</scope> |
|
193 |
</dependency> |
|
194 |
<dependency> |
|
195 |
<groupId>commons-collections</groupId> |
|
196 |
<artifactId>commons-collections</artifactId> |
|
197 |
<version>3.2.2</version> |
|
198 |
<scope>test</scope> |
|
199 |
</dependency> |
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
</dependencies> |
|
204 |
|
|
205 |
<repositories> |
|
206 |
<repository> |
|
207 |
<id>exist</id> |
|
208 |
<url>https://raw.github.com/eXist-db/mvn-repo/master/</url> |
|
209 |
</repository> |
|
210 |
|
|
211 |
</repositories> |
|
212 |
|
|
213 |
|
|
214 |
|
|
215 | 194 |
</project> |
Also available in: Unified diff
using updated mockito version