@@ -0,0 +1,2189 @@
+package org.jgroups.tests;%0A%0Aimport org.jgroups.util.DefaultThreadFactory;%0Aimport org.jgroups.Global;%0Aimport org.testng.annotations.Test;%0A%0A/**%0A * @author Bela Ban%0A * @version $Id: ThreadFactoryTest.java,v 1.1 2008/05/15 13:18:39 belaban Exp $%0A */%0A@Test(groups=Global.FUNCTIONAL,sequential=false)%0Apublic class ThreadFactoryTest %7B%0A    private DefaultThreadFactory factory;%0A    private static final String BASE=%22base%22;%0A    private static final String ADDR=%22192.168.1.5:12345%22;%0A    private static final String CLUSTER=%22MyCluster%22;%0A%0A    public void testNoNumbering() %7B%0A        factory=new DefaultThreadFactory(null, BASE, true, false);%0A        Thread thread=factory.newThread(new MyRunnable(), BASE);%0A        String name=thread.getName();%0A        System.out.println(%22name = %22 + name);%0A        assert name.equals(BASE);%0A    %7D%0A%0A    public void testNumbering() %7B%0A        factory=new DefaultThreadFactory(null, BASE, true, true);%0A        Thread thread=factory.newThread(new MyRunnable(), BASE);%0A        String name=thread.getName();%0A        System.out.println(%22name = %22 + name);%0A        assert name.equals(%22base-1%22);%0A%0A        thread=factory.newThread(new MyRunnable(), BASE);%0A        name=thread.getName();%0A        System.out.println(%22name = %22 + name);%0A        assert name.equals(%22base-2%22);%0A    %7D%0A%0A    public void testPatterns() %7B%0A        factory=new DefaultThreadFactory(null, BASE, true, false);%0A        factory.setAddress(ADDR);%0A        Thread thread=factory.newThread(new MyRunnable(), BASE);%0A        String name=thread.getName();%0A        System.out.println(%22name = %22 + name);%0A        assert name.equals(BASE);%0A%0A        factory.setPattern(%22l%22);%0A        thread=factory.newThread(new MyRunnable(), BASE);%0A        name=thread.getName();%0A        System.out.println(%22name = %22 + name);%0A        assert name.equals(BASE + %22,%22 + ADDR);%0A%0A        factory.setPattern(%22cl%22);%0A        factory.setClusterName(CLUSTER);%0A        thread=factory.newThread(new MyRunnable(), BASE);%0A        name=thread.getName();%0A        System.out.println(%22name = %22 + name);%0A        assert name.equals(BASE + %22,%22 + CLUSTER + %22,%22 + ADDR);%0A    %7D%0A%0A    static class MyRunnable implements Runnable %7B%0A        public void run() %7B%7D%0A    %7D%0A%7D%0A

test for DefaultThreadFactory