use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemStrategyIntegrationTest method contactPublicationSystemOBDTest.
@Test
public void contactPublicationSystemOBDTest() throws Exception {
System.out.println("PublicationSystemStrategyIntegrationTest.contactPublicationSystemOBDTest");
PublicationSystem publicationSystem = getCabinetManager().getPublicationSystemByNamespace("zcu");
assertNotNull(publicationSystem);
PublicationSystemStrategy prezentator = (PublicationSystemStrategy) Class.forName(publicationSystem.getType()).newInstance();
assertNotNull(prezentator);
PublicationSystemStrategy obd = (PublicationSystemStrategy) Class.forName(publicationSystem.getType()).newInstance();
assertNotNull(obd);
String authorId = "Sitera,Jiří";
int yearSince = 2006;
int yearTill = 2009;
HttpUriRequest request = obd.getHttpRequest(authorId, yearSince, yearTill, publicationSystem);
try {
HttpResponse response = obd.execute(request);
assertNotNull(response);
} catch (CabinetException ex) {
if (!ex.getType().equals(ErrorCodes.HTTP_IO_EXCEPTION)) {
fail("Different exception code, was: " + ex.getType() + ", but expected: HTTP_IO_EXCEPTION.");
// fail if different error
} else {
System.out.println("-- Test silently skipped because of HTTP_IO_EXCEPTION");
}
}
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class MUStrategyUnitTest method getHttpRequest.
@Test
public void getHttpRequest() throws Exception {
System.out.println("MUStrategyUnitTest.getHttpRequest");
PublicationSystem ps = new PublicationSystem();
ps.setLoginNamespace("mu");
ps.setUsername("test");
ps.setPassword("test");
ps.setUrl("http://www.seznam.cz");
HttpUriRequest result = muStrategy.getHttpRequest("1", 2009, 2010, ps);
assert result != null;
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemManagerIntegrationTest method updatePublicationSystem.
@Test
public void updatePublicationSystem() throws Exception {
System.out.println("PublicationSystemManagerIntegrationTest.updatePublicationSystem");
PublicationSystem ps = new PublicationSystem();
ps.setFriendlyName("PS for tests");
ps.setLoginNamespace("some");
ps.setUrl("http://seznam.cz");
ps.setUsername("");
ps.setPassword("");
ps.setType("cz.metacentrum.perun.cabinet.strategy.impl.MUStrategy");
ps = getCabinetManager().createPublicationSystem(sess, ps);
PublicationSystem ps2 = getCabinetManager().getPublicationSystemById(ps.getId());
assertEquals(ps, ps2);
ps.setUrl("http://www.seznam.cz");
ps = getCabinetManager().updatePublicationSystem(sess, ps);
PublicationSystem ps3 = getCabinetManager().getPublicationSystemById(ps.getId());
assertEquals(ps.getUrl(), ps3.getUrl());
assertFalse(Objects.equals(ps2.getUrl(), ps3.getUrl()));
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemManagerIntegrationTest method createPublicationSystem.
@Test
public void createPublicationSystem() throws Exception {
System.out.println("PublicationSystemManagerIntegrationTest.createPublicationSystem");
PublicationSystem ps = new PublicationSystem();
ps.setFriendlyName("PS for tests");
ps.setLoginNamespace("some");
ps.setUrl("http://seznam.cz");
ps.setUsername("");
ps.setPassword("");
ps.setType("cz.metacentrum.perun.cabinet.strategy.impl.MUStrategy");
ps = getCabinetManager().createPublicationSystem(sess, ps);
PublicationSystem ps2 = getCabinetManager().getPublicationSystemById(ps.getId());
assertEquals(ps, ps2);
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemManagerIntegrationTest method getPublicationSystemByNamespace.
@Test
public void getPublicationSystemByNamespace() throws Exception {
System.out.println("PublicationSystemManagerIntegrationTest.getPublicationSystemByNamespace");
PublicationSystem publicationSystem = getCabinetManager().getPublicationSystemByNamespace("mu");
assertNotNull(publicationSystem);
assertTrue(Objects.equals(publicationSystem, pubSysMu));
PublicationSystemStrategy ps = (PublicationSystemStrategy) Class.forName(publicationSystem.getType()).newInstance();
assertNotNull(ps);
}
Aggregations