/* * MailResourceDeployerTest.java * * Created on December 10, 2003, 11:55 AM */ package com.sun.enterprise.resource; import com.sun.enterprise.config.serverbeans.ElementProperty; import java.util.Properties; import junit.framework.*; import junit.textui.TestRunner; /** * Unit test for ConnectorConnectionPoolDeployer. * * @author Rob Ruyak */ public class GlobalResourceDeployerTest extends TestCase { MailResourceDeployer deployer; ElementProperty [] testProps; String [] testNames; String [] testValues; /** Creates a new instance of ConnectorConnectionPoolDeployerTest */ public GlobalResourceDeployerTest(String name) { super(name); } /** * Tests the getPropNamesAsStrArr method. * */ public void testGetPropNamesAsStrArr() { String [] result = deployer.getPropNamesAsStrArr(testProps); assertNotNull(result); assertEquals(result[0], testNames[0]); assertEquals(result[1], testNames[1]); assertEquals(result[2], testNames[2]); } /** * Tests the getPropNamesAsStrArr method with null param. * */ public void testGetPropNamesAsStrArrWithNull() { String [] result = deployer.getPropNamesAsStrArr(null); assertNull(result); } /** * Tests the getPropValuesAsStrArr method. * */ public void testGetPropValuesAsStrArr() { String [] result = deployer.getPropValuesAsStrArr(testProps); assertNotNull(result); assertEquals(result[0], testValues[0]); assertEquals(result[1], testValues[1]); assertEquals(result[2], testValues[2]); } /** * Tests the getPropValuesAsStrArr method with null param. */ public void testGetPropValuesAsStrArrWithNull() { String [] result = deployer.getPropValuesAsStrArr(null); assertNull(result); } protected void setUp() { deployer = new MailResourceDeployer(); ElementProperty prop1 = new ElementProperty(); prop1.setName("user"); prop1.setValue("admin"); ElementProperty prop2 = new ElementProperty(); prop2.setName("password"); prop2.setValue("adminadmin"); ElementProperty prop3 = new ElementProperty(); prop3.setName("status"); prop3.setValue("enabled"); testProps = new ElementProperty[] {prop1, prop2, prop3}; testNames = new String[] {"user","password","status"}; testValues = new String[] {"admin","adminadmin","enabled"}; } protected void tearDown() { } public static junit.framework.Test suite() { TestSuite suite = new TestSuite(GlobalResourceDeployerTest.class); return suite; } public static void main(String args[]) throws Exception { final TestRunner runner= new TestRunner(); final TestResult result = runner.doRun(GlobalResourceDeployerTest.suite(), false); System.exit(result.errorCount() + result.failureCount()); } }