Package org.jgroups.util

Examples of org.jgroups.util.AsciiString


     * <li>Calls stop() on the protocol
     * </ol>
     */
    public void stopStack(String cluster) {
        if(stopped) return;
        final AsciiString cluster_name=new AsciiString(cluster);
        for(final Protocol prot: getProtocols()) {
            if(prot instanceof TP) {
                TP transport=(TP)prot;
                if(transport.isSingleton()) {
                    String singleton_name=transport.getSingletonName();
View Full Code Here


@Test(groups=Global.FUNCTIONAL)
public class AsciiStringTest {

    public void testCreation() {
        String orig="hello";
        AsciiString str=new AsciiString(orig);
        assert str.length() == orig.length();
        assert str.toString().equals(orig);

        AsciiString str2=new AsciiString(str);
        assert str2.equals(str);
        assert str2.length() == str.length();

        str2=new AsciiString(new byte[]{'h', 'e', 'l', 'l', 'o'});
        assert str2.equals(str);
        assert str2.length() == str.length();
    }
View Full Code Here

        assert str2.equals(str);
        assert str2.length() == str.length();
    }

    public void testCompareTo() {
        AsciiString str=new AsciiString("hello"), str2=new AsciiString("hello world");
        int comp=str.compareTo(str2);
        assert comp < 0;
    }
View Full Code Here

        int comp=str.compareTo(str2);
        assert comp < 0;
    }

    public void testHashcode() {
        AsciiString str=new AsciiString("hello"), str2=new AsciiString("hello");
        assert str.hashCode() == str2.hashCode();

        str2=new AsciiString("hello world");
        assert str.hashCode() != str2.hashCode();

        Map<AsciiString,Integer> map=new HashMap<AsciiString,Integer>(5);
        map.put(new AsciiString("a"), 1);
        assert map.get(new AsciiString("a")) == 1;

        map.put(new AsciiString("b"), 2);
        assert map.get(new AsciiString("b")) == 2;

        map.put(new AsciiString("a"), 2);
        assert map.get(new AsciiString("a")) == 2;
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.AsciiString

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.