1 22 package org.objectweb.petals.jbi.transport.util; 23 24 import java.io.DataInputStream ; 25 import java.io.File ; 26 import java.io.FileInputStream ; 27 import java.io.IOException ; 28 29 import org.objectweb.petals.jbi.transport.util.JoramConfigurationBuilder; 30 31 import junit.framework.TestCase; 32 33 38 public class JoramConfigurationBuilderTest extends TestCase { 39 40 public void testBuildFullMasterConf() throws IOException { 41 String conf = JoramConfigurationBuilder.buildFullMasterConf("test", 42 "0", "0", "127.0.0.1", "petals", "petals", "16200", "16300", "001"); 43 String baseDir = this.getClass().getResource(".").toString(); 44 baseDir = baseDir.substring(0, baseDir.indexOf("target")); 45 baseDir = baseDir.substring(baseDir.indexOf(":") + 1); 46 DataInputStream dis = new DataInputStream (new FileInputStream (baseDir 47 + "src" + File.separator + "test-data" + File.separator + "joram" 48 + File.separator + "joram-conf.xml")); 49 byte[] content = new byte[dis.available()]; 50 dis.readFully(content); 51 assertEquals(conf, new String (content)); 52 } 53 54 public void testBuildFullConfiguration() throws IOException { 55 String conf = JoramConfigurationBuilder.buildFullMasterConf("test", 56 "0", "0", "127.0.0.1", "petals", "petals", "16200", "16300", "001"); 57 String fullConf = JoramConfigurationBuilder.buildFullConfiguration( 58 conf, "test", "1", "1", "127.0.0.1", "petals", "petals", "16201", 59 "16301", "002"); 60 String baseDir = this.getClass().getResource(".").toString(); 61 baseDir = baseDir.substring(0, baseDir.indexOf("target")); 62 baseDir = baseDir.substring(baseDir.indexOf(":") + 1); 63 DataInputStream dis = new DataInputStream (new FileInputStream (baseDir 64 + "src" + File.separator + "test-data" + File.separator + "joram" 65 + File.separator + "joram-conf-dist.xml")); 66 byte[] content = new byte[dis.available()]; 67 dis.readFully(content); 68 assertEquals(fullConf, new String (content)); 69 } 70 } 71 | Popular Tags |