Package org.apache.sling.serviceusermapping.impl

Examples of org.apache.sling.serviceusermapping.impl.Mapping


    }

    @Test
    public void test_constructor_empty_service_info() {
        try {
            new Mapping("srv:=user");
            TestCase.fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException iae) {
            // expected
        }
    }
View Full Code Here


        }
    }

    @Test
    public void test_constructor_user_with_colon() {
        new Mapping("srv=jcr:user");
    }
View Full Code Here

            spec.append(':').append(subServiceName);
        }
        spec.append('=').append(userName);

        // spec analysis
        final Mapping mapping = new Mapping(spec.toString());
        TestCase.assertEquals(getField(mapping, "serviceName"), serviceName);
        TestCase.assertEquals(getField(mapping, "subServiceName"), subServiceName);
        TestCase.assertEquals(getField(mapping, "userName"), userName);

        // mapping
        TestCase.assertEquals(userName, mapping.map(serviceName, subServiceName));
        if (subServiceName == null) {
            // Mapping without subServiceName must not match request with any
            // subServiceName
            TestCase.assertNull(mapping.map(serviceName, subServiceName + "-garbage"));
        } else {
            // Mapping with subServiceName must not match request without
            // subServiceName
            TestCase.assertNull(mapping.map(serviceName, null));
        }

        // no match for different service name
        TestCase.assertNull(mapping.map(serviceName + "-garbage", subServiceName));

        // no match for null service name
        TestCase.assertNull(mapping.map(null, subServiceName));
    }
View Full Code Here

public class MappingTest {

    @Test
    public void test_constructor_null() {
        try {
            new Mapping(null);
            TestCase.fail("NullPointerException expected");
        } catch (NullPointerException npe) {
            // expected
        }
    }
View Full Code Here

    }

    @Test
    public void test_constructor_empty() {
        try {
            new Mapping("");
            TestCase.fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException iae) {
            // expected
        }
    }
View Full Code Here

    }

    @Test
    public void test_constructor_missing_user_name() {
        try {
            new Mapping("serviceName");
            TestCase.fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException iae) {
            // expected
        }

        try {
            new Mapping("serviceName=");
            TestCase.fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException iae) {
            // expected
        }
    }
View Full Code Here

    }

    @Test
    public void test_constructor_missing_service_name() {
        try {
            new Mapping("=user");
            TestCase.fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException iae) {
            // expected
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.serviceusermapping.impl.Mapping

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.