Examples of TextEncoder


Examples of org.jboss.dna.common.text.TextEncoder

        path.getString((NamespaceRegistry)null);
    }

    @Test( expected = IllegalArgumentException.class )
    public void shouldNotAllowNullNamespaceRegistryWithNonNullTextEncoder() {
        TextEncoder encoder = mock(TextEncoder.class);
        path.getString((NamespaceRegistry)null, encoder);
    }
View Full Code Here

Examples of org.jboss.dna.common.text.TextEncoder

        assertThat(segment, is(not(segment2)));
    }

    @Test
    public void shouldUseDelimiterEncoderToEncodeDelimiterBetweenPrefixAndLocalPart() {
        TextEncoder encoder = new Jsr283Encoder();
        validName = new BasicName(DnaLexicon.Namespace.URI, "some:name:with:colons");
        segment = new BasicPathSegment(validName, Path.DEFAULT_INDEX);
        TextEncoder delimiterEncoder = new TextEncoder() {
            public String encode( String text ) {
                if (":".equals(text)) return "\\:";
                if ("{".equals(text)) return "\\{";
                if ("}".equals(text)) return "\\}";
                return text;
View Full Code Here

Examples of org.jboss.dna.common.text.TextEncoder

        this.validLocalName = "localPart";
        this.name = new BasicName(validNamespaceUri, validLocalName);
        this.encoder = Path.URL_ENCODER;
        this.namespaceRegistry = new SimpleNamespaceRegistry();
        this.namespaceRegistry.register(validNamespacePrefix, validNamespaceUri);
        this.delimiterEncoder = new TextEncoder() {
            public String encode( String text ) {
                if (":".equals(text)) return "\\:";
                if ("{".equals(text)) return "\\{";
                if ("}".equals(text)) return "\\}";
                return text;
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

        this.validLocalName = "localPart";
        this.name = new BasicName(validNamespaceUri, validLocalName);
        this.encoder = Path.URL_ENCODER;
        this.namespaceRegistry = new SimpleNamespaceRegistry();
        this.namespaceRegistry.register(validNamespacePrefix, validNamespaceUri);
        this.delimiterEncoder = new TextEncoder() {
            @Override
            public String encode( String text ) {
                if (":".equals(text)) return "\\:";
                if ("{".equals(text)) return "\\{";
                if ("}".equals(text)) return "\\}";
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

        path.getString((NamespaceRegistry)null);
    }

    @Test( expected = IllegalArgumentException.class )
    public void shouldNotAllowNullNamespaceRegistryWithNonNullTextEncoder() {
        TextEncoder encoder = mock(TextEncoder.class);
        path.getString((NamespaceRegistry)null, encoder);
    }
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

    }

    @Test
    public void shouldAlwaysReturnPathWithSingleSlashForGetString() {
        NamespaceRegistry registry = mock(NamespaceRegistry.class);
        TextEncoder encoder = mock(TextEncoder.class);
        when(encoder.encode("/")).thenReturn("/");
        assertThat(root.getString(), is("/"));
        assertThat(root.getString(registry), is("/"));
        assertThat(root.getString(registry, encoder), is("/"));
        assertThat(root.getString(registry, encoder, encoder), is("/"));
        assertThat(root.getString(encoder), is("/"));
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

        assertThat(root.getString(encoder), is("/"));
    }

    @Test
    public void shouldAllowNullNamespaceRegistryWithNonNullTextEncodersSinceRegistryIsNotNeeded() {
        TextEncoder encoder = mock(TextEncoder.class);
        when(encoder.encode("/")).thenReturn("/");
        assertThat(root.getString((NamespaceRegistry)null, encoder, encoder), is("/"));
    }
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

    }

    @Test
    public void shouldNotAllowNullTextEncoderForDelimiterWithNonNullNamespaceRegistry() {
        NamespaceRegistry registry = mock(NamespaceRegistry.class);
        TextEncoder encoder = mock(TextEncoder.class);
        assertThat(root.getString(registry, encoder, (TextEncoder)null), is("/"));
    }
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

        assertThat(segment, is(not(segment2)));
    }

    @Test
    public void shouldUseDelimiterEncoderToEncodeDelimiterBetweenPrefixAndLocalPart() {
        TextEncoder encoder = new Jsr283Encoder();
        validName = new BasicName(ModeShapeLexicon.Namespace.URI, "some:name:with:colons");
        segment = new BasicPathSegment(validName, Path.DEFAULT_INDEX);
        TextEncoder delimiterEncoder = new TextEncoder() {
            @Override
            public String encode( String text ) {
                if (":".equals(text)) return "\\:";
                if ("{".equals(text)) return "\\{";
                if ("}".equals(text)) return "\\}";
View Full Code Here

Examples of org.modeshape.common.text.TextEncoder

        assertThat(path1.equals(path2), is(false));
    }

    @Test
    public void shouldConvertPathToString() {
        TextEncoder encoder = new Jsr283Encoder();
        TextEncoder delimEncoder = new TextEncoder() {
            @Override
            public String encode( String text ) {
                if ("/".equals(text)) return "\\/";
                if (":".equals(text)) return "\\:";
                if ("{".equals(text)) return "\\{";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.