Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.testtoolinterfaces.testsuiteinterface;
  
  
XmlHandler to read the testgroup part from a TTI-XML file. <testgroup id="..." [any="..."]> <description>...</description> <requirementid>...</requirementid> <prepare> ... </prepare> <testgrouplink> ... </testgrouplink> <testcaselink> ... </testcaselink> <restore> ... </restore> <[any]> ... </[any]> </testgroup>

Author(s):
Arjan Kranenburg
See also:
http://www.testtoolinterfaces.org
 
 public class TestGroupXmlHandler extends XmlHandler
 {
 	public static final String START_ELEMENT = "testgroup";
 	private static final String ATTRIBUTE_ID = "id";
 	private static final String ATTRIBUTE_SEQUENCE = "sequence";
 	
 	private static final String DESCRIPTION_ELEMENT = "description";
 	private static final String REQUIREMENT_ELEMENT = "requirementid";
 
 	private static final String PREPARE_ELEMENT = "prepare";
 	private static final String RESTORE_ELEMENT = "restore";
 
 	private String myTestGroupId;
 	private int mySequenceNr;
 
 	private String myDescription;
     private ArrayList<StringmyRequirementIds;
     private TestStepSequence myPrepareSteps;
     private TestEntrySequence myTestEntries;
     private TestStepSequence myRestoreSteps;
 
Creates the XML Handler

Parameters:
anXmlReader the xmlReader
anInterfaceList a list of interfaces
aCheckStepParameter flag to indicate if specified parameters of a step must be verified in the interface
 
 	public TestGroupXmlHandlerXMLReader anXmlReaderTestInterfaceList anInterfaceListboolean aCheckStepParameter )
 	{
 		super(anXmlReader);
 		
 
 
     	 = new TestStepSequenceXmlHandleranXmlReader,
     	                                                      ,
     	                                                      anInterfaceList,
     	                                                      aCheckStepParameter );
		                                                      ,
		                                                      anInterfaceList,
		                                                      aCheckStepParameter );
		this.reset();
	}
	public void handleStartElement(String aQualifiedName)
	{
   		//nop;
    }
	public void handleCharacters(String aValue)
	{
    }
    
	public void handleEndElement(String aQualifiedName)
	{
		if ( ! aQualifiedName.equalsIgnoreCase() )
    	{
			// TODO This will overwrite previous occurrences of the same elements. But that is possible in XML.
    	}
    }
    public void processElementAttributes(String aQualifiedNameAttributes anAtt)
    {
		Trace.print(."processElementAttributes( " 
	            + aQualifiedNametrue );
     	if (aQualifiedName.equalsIgnoreCase())
    	{
		    for (int i = 0; i < anAtt.getLength(); i++)
		    {
	    		Trace.append.", " + anAtt.getQName(i) + "=" + anAtt.getValue(i) );
		    	if (anAtt.getQName(i).equalsIgnoreCase())
		    	{
		        	 = anAtt.getValue(i);
		    	}
		    	else if (anAtt.getQName(i).equalsIgnoreCase())
		    	{
		        	 = Integer.valueOfanAtt.getValue(i) ).intValue();
		    	}
		    	else
		    	{
		    		.put(anAtt.getQName(i), anAtt.getValue(i));
		    	}
		    }
    	}
		Trace.append." )\n" );
    }
	public void handleGoToChildElement(String aQualifiedName)
	{
		//nop
	}
	public void handleReturnFromChildElement(String aQualifiedNameXmlHandler aChildXmlHandler)
	{
		Trace.println(."handleReturnFromChildElement( " + aQualifiedName + " )"true);
    	{
    	}
    	else if (aQualifiedName.equalsIgnoreCase())
    	{
    	}
    	else if (aQualifiedName.equalsIgnoreCase())
    	{
    	}
    	else if (aQualifiedName.equalsIgnoreCase(.))
    	{
    	}
    	else if (aQualifiedName.equalsIgnoreCase(.))
    	{
    	}
    	else if (aQualifiedName.equalsIgnoreCase())
    	{
    	}
    	else
    	{ // Programming fault
			throw new Error"Child XML Handler returned, but not recognized. The handler was probably defined " +
			                 "in the Constructor but not handled in handleReturnFromChildElement()");
    	}
	}
	public void reset()
	{
	     = 0;
	     = new Hashtable<StringString>();
	     = "";
	     = new ArrayList<String>();
	     = new TestStepSequence();
	     = new TestStepSequence();
	     = "";
	}

    
Creates and returns the TestGroup

Returns:
the TestGroup
Throws:
org.testtoolinterfaces.testsuite.TestSuiteException When the id is empty.
	{
		{
			throw new TestSuiteException"Unknown TestGroup ID" );
		}
      	TestGroup testGroup = (TestGroupnew TestGroupImpl,
      	                                                     ,
           	       										  	 ,
      	                                                     ,
      	                                                     ,
      	                                                     ,
      	                                                     ,
      	                                                     ,
      	                                                      );
		return testGroup;
	}
New to GrepCode? Check out our FAQ X