Revision 47724
Added by Claudio Atzori almost 7 years ago
modules/cnr-test-utils/tags/cnr-test-utils-1.0.1/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/cnr-test-utils/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "cnr-test-utils"} |
modules/cnr-test-utils/tags/cnr-test-utils-1.0.1/src/main/java/eu/dnetlib/test/utils/EPRTestUtil.java | ||
---|---|---|
1 |
package eu.dnetlib.test.utils; |
|
2 |
|
|
3 |
import javax.xml.namespace.QName; |
|
4 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
5 |
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; |
|
6 |
|
|
7 |
/** |
|
8 |
* Test units have to create some EPRs. This class offers static methods for this quick and dirty task. |
|
9 |
* |
|
10 |
* @author marko |
|
11 |
* |
|
12 |
*/ |
|
13 |
public final class EPRTestUtil { |
|
14 |
|
|
15 |
/** |
|
16 |
* coverage tests complain about missing private constructor invocation: here it is. |
|
17 |
*/ |
|
18 |
@SuppressWarnings("unused") |
|
19 |
private static EPRTestUtil useless = new EPRTestUtil(); |
|
20 |
|
|
21 |
/** |
|
22 |
* prevents instantiation. |
|
23 |
*/ |
|
24 |
private EPRTestUtil() { |
|
25 |
// prevents instantiation |
|
26 |
} |
|
27 |
|
|
28 |
/** |
|
29 |
* creates a test epr with some fixed address. |
|
30 |
* |
|
31 |
* @return a test epr |
|
32 |
*/ |
|
33 |
public static W3CEndpointReference getTestEpr() { |
|
34 |
return getTestEpr("http://test"); |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* sometimes you may need different eprs. |
|
39 |
* |
|
40 |
* @param address some fake address |
|
41 |
* @return a test epr |
|
42 |
*/ |
|
43 |
public static W3CEndpointReference getTestEpr(final String address) { |
|
44 |
final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); |
|
45 |
builder.address(address); |
|
46 |
builder.serviceName(new QName("http://something", "myService")); |
|
47 |
return builder.build(); |
|
48 |
} |
|
49 |
} |
modules/cnr-test-utils/tags/cnr-test-utils-1.0.1/src/main/java/eu/dnetlib/test/utils/MockBeanFactory.java | ||
---|---|---|
1 |
package eu.dnetlib.test.utils; |
|
2 |
|
|
3 |
|
|
4 |
import static org.mockito.Mockito.mock; |
|
5 |
|
|
6 |
import org.springframework.beans.factory.FactoryBean; |
|
7 |
|
|
8 |
/** |
|
9 |
* Return a mockito mock for a given class. |
|
10 |
* This class should be updated according to new Spring4 factory Bean |
|
11 |
* |
|
12 |
* @author marko |
|
13 |
* |
|
14 |
*/ |
|
15 |
@Deprecated |
|
16 |
public class MockBeanFactory implements FactoryBean { |
|
17 |
|
|
18 |
/** |
|
19 |
* class to mock. |
|
20 |
*/ |
|
21 |
private Class<?> clazz; |
|
22 |
|
|
23 |
/** |
|
24 |
* {@inheritDoc} |
|
25 |
* @see org.springframework.beans.factory.FactoryBean#getObject() |
|
26 |
*/ |
|
27 |
public Object getObject() throws Exception { |
|
28 |
return mock(clazz); |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* {@inheritDoc} |
|
33 |
* @see org.springframework.beans.factory.FactoryBean#getObjectType() |
|
34 |
*/ |
|
35 |
public Class<?> getObjectType() { |
|
36 |
return clazz; |
|
37 |
} |
|
38 |
|
|
39 |
/** |
|
40 |
* {@inheritDoc} |
|
41 |
* @see org.springframework.beans.factory.FactoryBean#isSingleton() |
|
42 |
*/ |
|
43 |
public boolean isSingleton() { |
|
44 |
return true; |
|
45 |
} |
|
46 |
|
|
47 |
public Class<?> getClazz() { |
|
48 |
return clazz; |
|
49 |
} |
|
50 |
|
|
51 |
public void setClazz(final Class<?> clazz) { |
|
52 |
this.clazz = clazz; |
|
53 |
} |
|
54 |
|
|
55 |
} |
modules/cnr-test-utils/tags/cnr-test-utils-1.0.1/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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>dnet45-parent</artifactId> |
|
6 |
<version>1.0.0</version> |
|
7 |
</parent> |
|
8 |
<modelVersion>4.0.0</modelVersion> |
|
9 |
<groupId>eu.dnetlib</groupId> |
|
10 |
<artifactId>cnr-test-utils</artifactId> |
|
11 |
<packaging>jar</packaging> |
|
12 |
<version>1.0.1</version> |
|
13 |
<scm> |
|
14 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/cnr-test-utils/tags/cnr-test-utils-1.0.1</developerConnection> |
|
15 |
</scm> |
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>junit</groupId> |
|
19 |
<artifactId>junit</artifactId> |
|
20 |
<version>${junit.version}</version> |
|
21 |
<scope>test</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>apache</groupId> |
|
25 |
<artifactId>oro</artifactId> |
|
26 |
<version>2.0.8</version> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.apache.cxf</groupId> |
|
30 |
<artifactId>cxf-rt-frontend-jaxws</artifactId> |
|
31 |
<version>${cxf.version}</version> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.mockito</groupId> |
|
35 |
<artifactId>mockito-core</artifactId> |
|
36 |
<version>${mockito.version}</version> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.springframework</groupId> |
|
40 |
<artifactId>spring-beans</artifactId> |
|
41 |
<version>${spring.version}</version> |
|
42 |
</dependency> |
|
43 |
|
|
44 |
</dependencies> |
|
45 |
|
|
46 |
|
|
47 |
</project> |
Also available in: Unified diff
[maven-release-plugin] copy for tag cnr-test-utils-1.0.1