@Before public void setUp() throws Exception { apia = s_client.getAPIAMTOM(); }
private int listDatastreams(FedoraClient client, int numTimes) { LOGGER.info("Listing object datastreams via API-A SOAP {} times...", numTimes); int failCount = 0; FedoraAPIAMTOM apia = null; for (int i = 0; i < numTimes; i++) { try { if (apia == null) { apia = client.getAPIAMTOM(); } apia.listDatastreams(TEST_PID, null); } catch (Exception e) { failCount++; } } LOGGER.info("Failed {} times", failCount); return failCount; }
@Before public void setUp() throws Exception { apia = s_client.getAPIAMTOM(); Map<String, String> nsMap = new HashMap<String, String>(); nsMap.put(OAI_DC.prefix, OAI_DC.uri); nsMap.put(DC.prefix, DC.uri); NamespaceContext ctx = new SimpleNamespaceContext(nsMap); XMLUnit.setXpathNamespaceContext(ctx); }
@Before public void setUp() throws Exception { apia = s_client.getAPIAMTOM(); apim = s_client.getAPIMMTOM(); }
public static void ingestDemoObjects(FedoraClient client, String... paths) throws Exception { FedoraAPIAMTOM apia = client.getAPIAMTOM(); FedoraAPIMMTOM apim = client.getAPIMMTOM(); ingestDemoObjects(apia, apim, paths); }
@Test public void testListMethods2() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_2_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Wrong number of methods!", 1, methods.length); assertEquals("Wrong method SDef!", SDEF_2_PID, methods[0] .getServiceDefinitionPID()); assertEquals("Wrong method", "content2", methods[0].getMethodName()); }
@Test public void testListMethods1() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_1_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Wrong number of methods", 1, methods.length); assertEquals("Wrong method SDep", SDEF_1_PID, methods[0] .getServiceDefinitionPID()); assertEquals("Wrong method", "content", methods[0].getMethodName()); }
@Test public void testListMethods() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Wrong number of methods", 1, methods.length); assertEquals(methods[0].getServiceDefinitionPID(), SDEF_PID); assertEquals(methods[0].getMethodName(), SDEF_METHOD); }
public void init(String host, String port, String context, String username, String password) throws Exception { this.host = host; this.port = port; this.username = username; this.password = password; this.context = context; String baseURL = "http://" + host + ":" + port + "/" + context; FedoraClient fedoraClient = new FedoraClient(baseURL, username, password); apim = fedoraClient.getAPIMMTOM(); apia = fedoraClient.getAPIAMTOM(); fedoraClient.shutdown(); PIDS = apim.getNextPID(new BigInteger(Integer.valueOf(iterations).toString()), "demo").toArray(new String[]{}); FOXML = new byte[iterations][]; for (int i = 0; i < iterations; i++) { FOXML[i] = DEMO_FOXML_TEXT.replaceAll(pid, PIDS[i]).getBytes("UTF-8"); } }
public static String getDissemination(FedoraClient client, String pid, String sDef, String method) throws Exception { return new String(TypeUtility.convertDataHandlerToBytes(client .getAPIAMTOM().getDissemination(pid, sDef, method, null, null) .getStream()), "UTF-8"); }
public static int ingestTestObjects(FedoraClient client, String path) throws Exception { File dir = null; String specificPath = resourcePath(path); System.out.println("Ingesting test objects in FOXML format from " + specificPath); dir = new File(specificPath); IngestCounter counter = new IngestCounter(); Ingest.multiFromDirectory(dir, FOXML1_1.uri, client.getAPIAMTOM(), client.getAPIMMTOM(), null, new PrintStream(File.createTempFile("demo", null)), counter); return counter.successes; } }
@Before public void setUp() throws Exception { fedoraClient = getFedoraClient(); apim = fedoraClient.getAPIMMTOM(); apia = fedoraClient.getAPIAMTOM(); }
@Before public void setUp() throws Exception { apia = s_client.getAPIAMTOM(); apim = s_client.getAPIMMTOM(); apim.ingest(TypeUtility.convertBytesToDataHandler(DEMO_REST_FOXML), FOXML1_1.uri, "TestRESTAPI.setUp: ingesting new foxml object " + DEMO_REST_PID); }
@Before public void setUp() throws Exception { FedoraClient client = getFedoraClient(); apia = client.getAPIAMTOM(); apim = client.getAPIMMTOM(); client.shutdown(); }
@Before public void setUp() throws Exception { apim = s_client.getAPIMMTOM(); apia = s_client.getAPIAMTOM(); // clone some demo objects to managed-content equivalents for reserved datastreams (RELS-*, DC) ManagedContentTranslator.createManagedClone(apim, PENS_PID, MANAGED_PENS_PID); ManagedContentTranslator.createManagedClone(apim, GLASS_PID, MANAGED_GLASS_PID); }
@Test public void testListMethods1_2() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_1_2_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Too many methods!", 2, methods.length); assertNotSame("SDefs are duplicated", methods[0] .getServiceDefinitionPID(), methods[1] .getServiceDefinitionPID()); assertNotSame("methods are duplicated", methods[0].getMethodName(), methods[1].getMethodName()); }
@Test public void testListMethods() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_1_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Wrong number of methods", 2, methods.length); assertNotSame("SDeps are not distinct", methods[0] .getServiceDefinitionPID(), methods[1] .getServiceDefinitionPID()); assertNotSame("Methods are not distinct", methods[0].getMethodName(), methods[1].getMethodName()); /* Order may not be deterministic, but that's OK */ if (methods[0].getServiceDefinitionPID().equals(SDEF_1_PID)) { assertEquals(methods[1].getServiceDefinitionPID(), SDEF_2_PID); assertEquals(methods[0].getMethodName(), SDEF_1_METHOD); assertEquals(methods[1].getMethodName(), SDEF_2_METHOD); } else if (methods[0].getServiceDefinitionPID().equals(SDEF_2_PID)) { assertEquals(methods[1].getServiceDefinitionPID(), SDEF_1_PID); assertEquals(methods[0].getMethodName(), SDEF_2_METHOD); assertEquals(methods[1].getMethodName(), SDEF_1_METHOD); } }
@Test public void testListMethods3() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_3_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Too many methods!", 2, methods.length); assertNotSame("SDefs are duplicated", methods[0] .getServiceDefinitionPID(), methods[1] .getServiceDefinitionPID()); assertNotSame("methods are duplicated", methods[0].getMethodName(), methods[1].getMethodName()); }
public RemoteObjectSource(ServiceInfo serviceInfo) throws ServiceException, IOException { FedoraClient fc = new FedoraClient(serviceInfo.getBaseUrlString(), serviceInfo.getUsername(), serviceInfo.getPassword()); apia = fc.getAPIAMTOM(); apim = fc.getAPIMMTOM(); fc.shutdown(); }
@Test public void testListMethods4() throws Exception { FedoraAPIAMTOM apia = s_client.getAPIAMTOM(); ObjectMethodsDef[] methods; methods = filterMethods(apia.listMethods(OBJECT_4_PID, null).toArray(new ObjectMethodsDef[0])); assertEquals("Too many methods!", 3, methods.length); assertNotSame("SDefs are duplicated", methods[0] .getServiceDefinitionPID(), methods[1] .getServiceDefinitionPID()); assertNotSame("SDefs are duplicated", methods[0] .getServiceDefinitionPID(), methods[2] .getServiceDefinitionPID()); assertNotSame("SDefs are duplicated", methods[1] .getServiceDefinitionPID(), methods[2] .getServiceDefinitionPID()); assertNotSame("methods are duplicated", methods[0].getMethodName(), methods[1].getMethodName()); assertNotSame("methods are duplicated", methods[0].getMethodName(), methods[2].getMethodName()); assertNotSame("methods are duplicated", methods[1].getMethodName(), methods[2].getMethodName()); }