Package org.apache.harmony.jndi.provider.ldap.asn1

Examples of org.apache.harmony.jndi.provider.ldap.asn1.ASN1Null


        if (type == null) {
            type = (ASN1Choice) LdapASN1Constant.Filter;
        }
        // has not been decoded
        if (!(out.content instanceof byte[])) {
            ChosenValue chosen = (ChosenValue) out.content;
            int index = chosen.getIndex();
            byte[] bytes = type.type[index].encode(chosen.getValue());
            out.content = bytes;
            out.length = bytes.length;
        }
        // TODO: Any way better to do this(append out.content to out.encoded)?
        out.encodeString();
View Full Code Here


    public void setEncodingContent(BerOutputStream out) {
        if (type == null) {
            type = (ASN1Choice) LdapASN1Constant.Filter;
        }

        ChosenValue chosen = null;
        if (out.content instanceof Filter) {
            Object[] values = new Object[1];
            ((Filter) out.content).encodeValues(values);
            chosen = (ChosenValue) values[0];
        } else {
            chosen = (ChosenValue) out.content;
        }

        int index = chosen.getIndex();
        byte[] bytes = type.type[index].encode(chosen.getValue());

        out.content = bytes;
        out.length = bytes.length;
    }
View Full Code Here

        assertEquals(SubstringFilter.class, filter.getValue().getClass());
        SubstringFilter sub = (SubstringFilter) filter.getValue();
        assertEquals("cn", sub.getType());
        // TODO: not sure whether '*' should be part of 'any'
        // assertEquals(1, sub.getSubstrings().size());
        ChosenValue chosen = sub.getSubstrings().get(0);
        assertEquals("Babs J", chosen.getValue());
        assertEquals(0, chosen.getIndex());
    }
View Full Code Here

            Assert.assertTrue(objs[0] instanceof Integer);

            int index = ((Integer) objs[0]).intValue();
            checkEncode(objs[1], type.type[index]);
        } else if (value instanceof ChosenValue) {
            ChosenValue chosen = (ChosenValue) value;
            checkEncode(chosen.getValue(), type.type[chosen.getIndex()]);
        } else if (value instanceof ASN1Encodable) {
            Object[] objs = new Object[1];
            ((ASN1Encodable) value).encodeValues(objs);
            checkEncode(objs[0], type);
        } else {
View Full Code Here

    public void test_getIndex_LObject() {
        Object[] values = new Object[] { Integer.valueOf(1),
                Integer.valueOf(100) };
        assertEquals(1, choice.getIndex(values));

        ChosenValue chosen = new ChosenValue(2, Boolean.valueOf(true));
        assertEquals(2, choice.getIndex(chosen));
    }
View Full Code Here

    public void test_getObjectToEncode_LObject() {
        Object[] values = new Object[] { Integer.valueOf(1),
                Integer.valueOf(100) };
        assertEquals(values[1], choice.getObjectToEncode(values));

        ChosenValue chosen = new ChosenValue(0, "hello");
        assertEquals(chosen.getValue(), choice.getObjectToEncode(chosen));
    }
View Full Code Here

        Object[] values = new Object[] { Integer.valueOf(index), value };
        byte[] encoded = choice.encode(values);
        Object decoded = choice.decode(encoded);

        assertTrue(decoded instanceof ChosenValue);
        ChosenValue chosen = (ChosenValue) decoded;

        assertEquals(index, chosen.getIndex());
        assertEquals(value, chosen.getValue());
    }
View Full Code Here

        public String getType() {
            return type;
        }

        public void addInitial(String initial) {
            substrings.add(new ChosenValue(0, initial));
        }
View Full Code Here

        public void addInitial(String initial) {
            substrings.add(new ChosenValue(0, initial));
        }

        public void addAny(String any) {
            substrings.add(new ChosenValue(1, any));
        }
View Full Code Here

        public void addAny(String any) {
            substrings.add(new ChosenValue(1, any));
        }

        public void addFinal(String initial) {
            substrings.add(new ChosenValue(2, initial));
        }
View Full Code Here

TOP

Related Classes of org.apache.harmony.jndi.provider.ldap.asn1.ASN1Null

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.