Package org.fcrepo.server.access

Examples of org.fcrepo.server.access.FedoraAPIAMTOM


        ingestDemoObjects(client, paths);
        client.shutdown();
    }

    public static void ingestDemoObjects(FedoraClient client, String... paths) throws Exception {
        FedoraAPIAMTOM apia = client.getAPIAMTOM();
        FedoraAPIMMTOM apim = client.getAPIMMTOM();
        ingestDemoObjects(apia, apim, paths);
    }
View Full Code Here


        FedoraServerTestCase.purgeDemoObjects(s_client);
    }

    @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());
View Full Code Here

        assertEquals("Wrong method", "content", methods[0].getMethodName());
    }

    @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());
View Full Code Here

        assertEquals("Wrong method", "content2", methods[0].getMethodName());
    }

    @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",
View Full Code Here

                      methods[1].getMethodName());
    }

    @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",
View Full Code Here

                      methods[1].getMethodName());
    }

    @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]
View Full Code Here

    }

    /* Assure that listMethods works as advertised */
    @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);
    }
View Full Code Here

        s_client.shutdown();
    }

    /* Assure that listMethods works as advertised */
    private 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());
View Full Code Here

        // APIA access by user without access- should fail
        try {
            System.out.println("Testing " + functionToTest
                    + " from invalid user: " + username);

            FedoraAPIAMTOM apia1 = user.getAPIAMTOM();
            Method func = apia1.getClass().getMethod(functionToTest, args);
            func.invoke(apia1, parms);
            fail("Illegal access allowed");
        } catch (InvocationTargetException ite) {
            Throwable cause = ite.getCause();
            if (cause instanceof SOAPFaultException) {
View Full Code Here

        // APIA access by user with access- should succeed
        try {
            // testuser1 does have permission to access demo:5 datastreams, so this should succeed
            System.out.println("Testing " + functionToTest
                    + " from valid user: " + username);
            FedoraAPIAMTOM apia1 = user.getAPIAMTOM();
            Method func = apia1.getClass().getMethod(functionToTest, args);
            Object result = func.invoke(apia1, parms);
            assertTrue(result != null);
            System.out.println("Access succeeded");
            return result;
        } catch (InvocationTargetException ite) {
View Full Code Here

TOP

Related Classes of org.fcrepo.server.access.FedoraAPIAMTOM

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.