FileDocCategorySizeDatePackage
CheckConfigPropertyName.javaAPI DocGlassfish v2 API4218Fri May 04 22:33:28 BST 2007com.sun.enterprise.tools.verifier.tests.connector

CheckConfigPropertyName

public class CheckConfigPropertyName extends ConnectorTest implements ConnectorCheck
author
Jerome Dochez
version

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.ConnectorDescriptor descriptor)

Properties names defined in the resource adapter config-propery should be unique per resource adapter

paramm
descriptor deployment descriptor for the rar file
return
result object containing the result of the individual test performed

        
        Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        Set properties = descriptor.getConfigProperties();
        Iterator iterator = properties.iterator();
        // let's add the propery name
        HashSet<String> hs = new HashSet<String>();
        while (iterator.hasNext()) {
            EnvironmentProperty ep = (EnvironmentProperty) iterator.next();
            if (hs.add(ep.getName())==false) {
                // duplicate name...
                result.addErrorDetails(smh.getLocalString
				       ("tests.componentNameConstructor",
					"For [ {0} ]",
					new Object[] {compName.toString()}));
		result.failed(smh.getLocalString(getClass().getName() + ".failed",
                "Error: More than one propery has a duplicate name [ {0} ] in the deployment descriptors",
		new Object[] {ep.getName()}));                     
                return result;
            }            
        }
        // success
        result.addGoodDetails(smh.getLocalString
			      ("tests.componentNameConstructor",
			       "For [ {0} ]",
			       new Object[] {compName.toString()}));	
	result.passed(smh.getLocalString(getClass().getName() + ".passed",
					 "There are no config properties with a duplicate name"));                     
        return result;