Revision 0b5641a3
Added by Andreas Müller almost 3 years ago
cdmlib-remote/src/test/java/eu/etaxonomy/cdm/remote/dto/assembler/lsid/AssemblerTest.java | ||
---|---|---|
45 | 45 |
import org.unitils.spring.annotation.SpringBeanByType; |
46 | 46 |
|
47 | 47 |
import eu.etaxonomy.cdm.common.URI; |
48 |
import eu.etaxonomy.cdm.common.UriUtils; |
|
49 | 48 |
import eu.etaxonomy.cdm.model.agent.Person; |
50 | 49 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
51 | 50 |
import eu.etaxonomy.cdm.model.common.Credit; |
... | ... | |
76 | 75 |
import eu.etaxonomy.cdm.remote.dto.oaipmh.OaiDc; |
77 | 76 |
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.SpeciesProfileModel; |
78 | 77 |
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonConcept; |
78 |
import eu.etaxonomy.cdm.remote.view.OaiPmhViewTest; |
|
79 | 79 |
import net.sf.cglib.proxy.Enhancer; |
80 | 80 |
import net.sf.cglib.proxy.MethodInterceptor; |
81 | 81 |
import net.sf.cglib.proxy.MethodProxy; |
... | ... | |
193 | 193 |
@Ignore |
194 | 194 |
@Test |
195 | 195 |
public void testDeepMapping() { |
196 |
|
|
197 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
198 |
return; |
|
199 |
} |
|
200 |
|
|
196 | 201 |
for(int i = 0; i < 3; i++) { |
197 | 202 |
Synonym synonym = Synonym.NewInstance(name,(Reference)sec); |
198 | 203 |
taxon.addSynonym(synonym, SynonymType.SYNONYM_OF()); |
199 | 204 |
} |
200 | 205 |
|
201 |
if(!UriUtils.isInternetAvailable(null)){ |
|
202 |
// dozer requires access to dozer.sourceforge.net |
|
203 |
logger.info("Internet is not available: Skipping test"); |
|
204 |
return; |
|
205 |
} |
|
206 |
|
|
207 | 206 |
TaxonConcept taxonConcept = mapper.map(taxon, TaxonConcept.class); |
208 | 207 |
|
209 | 208 |
assertNotNull("map() should return an object", taxonConcept); |
... | ... | |
228 | 227 |
@Test |
229 | 228 |
public void testLazyInitializationExceptionWithProxy() throws Exception { |
230 | 229 |
|
231 |
if(!UriUtils.isInternetAvailable(null)){ |
|
232 |
// dozer requires access to dozer.sourceforge.net |
|
233 |
logger.info("Internet is not available: Skipping test"); |
|
230 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
234 | 231 |
return; |
235 | 232 |
} |
236 | 233 |
|
... | ... | |
249 | 246 |
@Test |
250 | 247 |
public void testLazyInitializationExceptionWithPersistentCollection() throws Exception { |
251 | 248 |
|
252 |
if(!UriUtils.isInternetAvailable(null)){ |
|
253 |
// dozer requires access to dozer.sourceforge.net |
|
254 |
logger.info("Internet is not available: Skipping test"); |
|
249 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
255 | 250 |
return; |
256 | 251 |
} |
257 | 252 |
|
... | ... | |
272 | 267 |
@Test |
273 | 268 |
public void testSpeciesProfileModelMapping() { |
274 | 269 |
|
275 |
if(!UriUtils.isInternetAvailable(null)){ |
|
276 |
// dozer requires access to dozer.sourceforge.net |
|
277 |
logger.info("Internet is not available: Skipping test"); |
|
270 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
278 | 271 |
return; |
279 | 272 |
} |
280 | 273 |
|
... | ... | |
286 | 279 |
@Test |
287 | 280 |
public void testSimpleDarwinCoreMapping() { |
288 | 281 |
|
289 |
if(!UriUtils.isInternetAvailable(null)){ |
|
290 |
// dozer requires access to dozer.sourceforge.net |
|
291 |
logger.info("Internet is not available: Skipping test"); |
|
282 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
292 | 283 |
return; |
293 | 284 |
} |
294 | 285 |
|
... | ... | |
306 | 297 |
@Test |
307 | 298 |
public void testOAIDublinCoreMapping() { |
308 | 299 |
|
309 |
if(!UriUtils.isInternetAvailable(null)){ |
|
310 |
// dozer requires access to dozer.sourceforge.net |
|
311 |
logger.info("Internet is not available: Skipping test"); |
|
300 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
312 | 301 |
return; |
313 | 302 |
} |
314 | 303 |
|
cdmlib-remote/src/test/java/eu/etaxonomy/cdm/remote/view/OaiPmhViewTest.java | ||
---|---|---|
78 | 78 |
|
79 | 79 |
private eu.etaxonomy.cdm.remote.view.oaipmh.rdf.GetRecordView rdfGetRecordView; |
80 | 80 |
|
81 |
private URI serverURI; |
|
81 |
private URI oahServerURI; |
|
82 |
private static URI dozerXsdServerURI = URI.create("http://dozer.sourceforge.net/"); |
|
82 | 83 |
|
83 | 84 |
@Before |
84 | 85 |
public void setUp() throws Exception { |
... | ... | |
116 | 117 |
|
117 | 118 |
request = new MockHttpServletRequest(); |
118 | 119 |
|
119 |
serverURI = new URI("http://memory.loc.gov");
|
|
120 |
oahServerURI = new URI("http://memory.loc.gov");
|
|
120 | 121 |
|
121 |
request.setServerName(serverURI.toString());
|
|
122 |
request.setServerName(oahServerURI.toString());
|
|
122 | 123 |
request.setServerPort(80); |
123 | 124 |
response = new MockHttpServletResponse(); |
124 | 125 |
} |
... | ... | |
126 | 127 |
@Test |
127 | 128 |
public void testIdentifyView() throws Exception { |
128 | 129 |
|
129 |
if(!serviceIsAvailable()){
|
|
130 |
if(!oaiServiceIsAvailable()){
|
|
130 | 131 |
return; |
131 | 132 |
} |
132 | 133 |
|
... | ... | |
152 | 153 |
@Test |
153 | 154 |
public void testGetRecordView() throws Exception { |
154 | 155 |
|
155 |
if(!serviceIsAvailable()){
|
|
156 |
if(!oaiServiceIsAvailable() || !dozerXsdIsAvailable()){
|
|
156 | 157 |
return; |
157 | 158 |
} |
158 | 159 |
|
... | ... | |
174 | 175 |
@Test |
175 | 176 |
public void testRdfGetRecordView() throws Exception { |
176 | 177 |
|
177 |
if(!serviceIsAvailable()){
|
|
178 |
if(!oaiServiceIsAvailable() || !dozerXsdIsAvailable()){
|
|
178 | 179 |
return; |
179 | 180 |
} |
180 | 181 |
|
... | ... | |
195 | 196 |
@Test |
196 | 197 |
public void testListMetadataFormatsView() throws Exception { |
197 | 198 |
|
198 |
if(!serviceIsAvailable()){
|
|
199 |
if(!oaiServiceIsAvailable()){
|
|
199 | 200 |
return; |
200 | 201 |
} |
201 | 202 |
|
... | ... | |
207 | 208 |
@Test |
208 | 209 |
public void testListSetsView() throws Exception { |
209 | 210 |
|
210 |
if(!serviceIsAvailable()){
|
|
211 |
if(!oaiServiceIsAvailable()){
|
|
211 | 212 |
return; |
212 | 213 |
} |
213 | 214 |
|
... | ... | |
224 | 225 |
@Test |
225 | 226 |
public void testListIdentifiersView() throws Exception { |
226 | 227 |
|
227 |
if(!serviceIsAvailable()){
|
|
228 |
if(!oaiServiceIsAvailable() || !dozerXsdIsAvailable()){
|
|
228 | 229 |
return; |
229 | 230 |
} |
230 | 231 |
|
... | ... | |
261 | 262 |
@Test |
262 | 263 |
public void testListRecordsView() throws Exception { |
263 | 264 |
|
264 |
if(!serviceIsAvailable()){
|
|
265 |
if(!oaiServiceIsAvailable() || !dozerXsdIsAvailable()){
|
|
265 | 266 |
return; |
266 | 267 |
} |
267 | 268 |
|
... | ... | |
294 | 295 |
//System.out.println(new String(response.getContentAsByteArray())); |
295 | 296 |
} |
296 | 297 |
|
297 |
private boolean serviceIsAvailable() { |
|
298 |
if(!UriUtils.isServiceAvailable(serverURI)) { |
|
299 |
logger.info("Service " + serverURI.toString() + " unavailable"); |
|
298 |
private boolean oaiServiceIsAvailable() { |
|
299 |
if(!UriUtils.isServiceAvailable(oahServerURI)) { |
|
300 |
logger.warn("Service " + oahServerURI.toString() + " unavailable"); |
|
301 |
return false; |
|
302 |
} else { |
|
303 |
return true; |
|
304 |
} |
|
305 |
} |
|
306 |
|
|
307 |
public static boolean dozerXsdIsAvailable() { |
|
308 |
// dozer requires access to dozer.sourceforge.net to test schema (.xsd/.dtd) |
|
309 |
if(!UriUtils.isServiceAvailable(dozerXsdServerURI)) { |
|
310 |
logger.warn("Service " + dozerXsdServerURI.toString() + " unavailable"); |
|
300 | 311 |
return false; |
301 | 312 |
} else { |
302 | 313 |
return true; |
cdmlib-remote/src/test/java/eu/etaxonomy/cdm/remote/view/RdfViewTest.java | ||
---|---|---|
163 | 163 |
@Test |
164 | 164 |
public void testNameInformationRdf() throws Exception { |
165 | 165 |
|
166 |
if(!OaiPmhViewTest.dozerXsdIsAvailable()){ |
|
167 |
return; |
|
168 |
} |
|
169 |
|
|
166 | 170 |
Map<String,List<NameInformation>> model = new HashMap<>(); |
167 | 171 |
List<NameInformation> niList = new ArrayList<>(); |
168 | 172 |
NameInformation ni = new NameInformation(); |
Also available in: Unified diff
ref #5095 avoid running dozer tests when dozer.sourceforge.net is not available