org.kuali.student.mock.mojo
Class ConformanceTestBaseCrudClassServiceWriter

java.lang.Object
  extended by org.kuali.student.contract.writer.XmlWriter
      extended by org.kuali.student.contract.writer.JavaClassWriter
          extended by org.kuali.student.mock.mojo.MockImplServiceWriter
              extended by org.kuali.student.mock.mojo.ConformanceTestBaseCrudClassServiceWriter
Direct Known Subclasses:
ConformanceTestExtendedCrudClassServiceWriter

public class ConformanceTestBaseCrudClassServiceWriter
extends MockImplServiceWriter

This class will generate the base class that does CRUD tests as part of the Conformance Tests for services. The generated class will need to be extended (and abstract methods filled in) to be complete. This class is meant to be generated again and again, and developers should customize tests in the extended class by extending or overwriting methods of this class as needed.

Author:
Mezba Mahtab (mezba.mahtab@utoronto.ca)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.student.mock.mojo.MockImplServiceWriter
MockImplServiceWriter.MethodType
 
Field Summary
protected static String H1_COMMENT_CHAR
           
protected static int H1_COMMENT_MARK_LENGTH
           
static String ROOT_PACKAGE
           
 
Fields inherited from class org.kuali.student.mock.mojo.MockImplServiceWriter
finder, methods, model, servKey
 
Constructor Summary
ConformanceTestBaseCrudClassServiceWriter(ServiceContractModel model, String directory, String rootPackage, String servKey, List<ServiceMethod> methods, boolean isR1)
           
ConformanceTestBaseCrudClassServiceWriter(ServiceContractModel model, String directory, String rootPackage, String servKey, List<ServiceMethod> methods, boolean isR1, String packageName, String className)
           
 
Method Summary
static String calcClassName(String servKey)
          Given the service key (name), returns a calculated class name for the conformance tester.
protected  List<String> calcNamesOfDTOsWithCrudManagedByService()
          Gets a list of all the DTO names that are part of this service.
static String calcPackage(String servKey, String rootPackage)
           
protected  void doTestImportsAdd()
          Does the importsAdd for all files required for testing
static List<Service> filterServices(ServiceContractModel model, ServicesFilter filter)
           
protected  List<String> getDtoObjectNamesWithCrud()
           
 void indentPrintDecoratedComment(String label)
          Writes out a decorated comment.
 void indentPrintDecoratedComment(String label, String decorChar, int decorLength)
          Writes out a decorated comment, with the decoration string passed in.
protected  boolean isServiceMethodTestedAsPartofCrudInBaseConformanceTest(ServiceMethod method)
          Given a method type, returns true if this method is tested as part of CRUD operations tested by the base test conformance class.
 void write()
          Write out the entire file
 void writeTestCreate(String dtoObjectName, List<MessageStructure> messageStructures)
          Write the 'test create' portion.
 void writeTestCrud(String dtoObjectName)
          Write the CRUD test methods
 void writetestCrudXXX_setDTOFieldsForTestCreate(String dtoObjectName, List<MessageStructure> messageStructures)
          Writes the section to set fields specific to this dto for testCreate section.
 void writetestCrudXXX_setDTOFieldsForTestReadAfterUpdate(String dtoObjectName, List<MessageStructure> messageStructures)
          Writes the section to set fields specific to this dto for testReadAfterUpdate sections.
 void writetestCrudXXX_setDTOFieldsForTestUpdate(String dtoObjectName, List<MessageStructure> messageStructures)
          Writes the section to set fields specific to this dto for testUpdate sections.
 void writetestCrudXXX_testDTOFieldsForTestCreateUpdate(String dtoObjectName, List<MessageStructure> messageStructures)
          Writes the section to test fields specific to this dto for testCreate and testUpdate sections.
 void writetestCrudXXX_testDTOFieldsForTestReadAfterUpdate(String dtoObjectName, List<MessageStructure> messageStructures)
          Writes the section to test fields specific to this dto for testReadAfterUpdate sections.
 void writeTestDelete(String dtoObjectName, List<MessageStructure> messageStructures)
          Write the 'delete' portion.
 void writeTestReadAfterUpdate(String dtoObjectName, List<MessageStructure> messageStructures)
          Write the 'read after update' portion.
 void writeTestUpdate(String dtoObjectName, List<MessageStructure> messageStructures)
          Write the 'test update' portion.
 
Methods inherited from class org.kuali.student.mock.mojo.MockImplServiceWriter
calcMethodType, calcObjectName, calcServiceInterfaceClassName, fixServKey, initLower
 
Methods inherited from class org.kuali.student.contract.writer.JavaClassWriter
closeBrace, getBody, getClassName, getDirectory, getFileName, getPackageName, getRootDirectory, importsAdd, indentPrintWrappedComment, openBrace, setPackageName, writeHeader, writeImports, writeJavaClassAndImportsOutToFile
 
Methods inherited from class org.kuali.student.contract.writer.XmlWriter
decrementIndent, escapeXML, getIndent, getOut, incrementIndent, indent, indent, indentPrint, indentPrintln, print, println, setIndent, setOut, writeAttribute, writeComment, writeCommentBox, writeTag, writeTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_PACKAGE

public static final String ROOT_PACKAGE
See Also:
Constant Field Values

H1_COMMENT_CHAR

protected static final String H1_COMMENT_CHAR
See Also:
Constant Field Values

H1_COMMENT_MARK_LENGTH

protected static final int H1_COMMENT_MARK_LENGTH
See Also:
Constant Field Values
Constructor Detail

ConformanceTestBaseCrudClassServiceWriter

public ConformanceTestBaseCrudClassServiceWriter(ServiceContractModel model,
                                                 String directory,
                                                 String rootPackage,
                                                 String servKey,
                                                 List<ServiceMethod> methods,
                                                 boolean isR1)

ConformanceTestBaseCrudClassServiceWriter

public ConformanceTestBaseCrudClassServiceWriter(ServiceContractModel model,
                                                 String directory,
                                                 String rootPackage,
                                                 String servKey,
                                                 List<ServiceMethod> methods,
                                                 boolean isR1,
                                                 String packageName,
                                                 String className)
Method Detail

getDtoObjectNamesWithCrud

protected List<String> getDtoObjectNamesWithCrud()

calcPackage

public static String calcPackage(String servKey,
                                 String rootPackage)

calcClassName

public static String calcClassName(String servKey)
Given the service key (name), returns a calculated class name for the conformance tester.


filterServices

public static List<Service> filterServices(ServiceContractModel model,
                                           ServicesFilter filter)

write

public void write()
Write out the entire file

Overrides:
write in class MockImplServiceWriter

writeTestCrud

public void writeTestCrud(String dtoObjectName)
Write the CRUD test methods


writeTestCreate

public void writeTestCreate(String dtoObjectName,
                            List<MessageStructure> messageStructures)
Write the 'test create' portion.


writeTestUpdate

public void writeTestUpdate(String dtoObjectName,
                            List<MessageStructure> messageStructures)
Write the 'test update' portion.


writeTestReadAfterUpdate

public void writeTestReadAfterUpdate(String dtoObjectName,
                                     List<MessageStructure> messageStructures)
Write the 'read after update' portion.


writeTestDelete

public void writeTestDelete(String dtoObjectName,
                            List<MessageStructure> messageStructures)
Write the 'delete' portion.


indentPrintDecoratedComment

public void indentPrintDecoratedComment(String label)
Writes out a decorated comment.


indentPrintDecoratedComment

public void indentPrintDecoratedComment(String label,
                                        String decorChar,
                                        int decorLength)
Writes out a decorated comment, with the decoration string passed in.


writetestCrudXXX_setDTOFieldsForTestCreate

public void writetestCrudXXX_setDTOFieldsForTestCreate(String dtoObjectName,
                                                       List<MessageStructure> messageStructures)
Writes the section to set fields specific to this dto for testCreate section.


writetestCrudXXX_testDTOFieldsForTestCreateUpdate

public void writetestCrudXXX_testDTOFieldsForTestCreateUpdate(String dtoObjectName,
                                                              List<MessageStructure> messageStructures)
Writes the section to test fields specific to this dto for testCreate and testUpdate sections.


writetestCrudXXX_setDTOFieldsForTestUpdate

public void writetestCrudXXX_setDTOFieldsForTestUpdate(String dtoObjectName,
                                                       List<MessageStructure> messageStructures)
Writes the section to set fields specific to this dto for testUpdate sections.


writetestCrudXXX_testDTOFieldsForTestReadAfterUpdate

public void writetestCrudXXX_testDTOFieldsForTestReadAfterUpdate(String dtoObjectName,
                                                                 List<MessageStructure> messageStructures)
Writes the section to test fields specific to this dto for testReadAfterUpdate sections.


writetestCrudXXX_setDTOFieldsForTestReadAfterUpdate

public void writetestCrudXXX_setDTOFieldsForTestReadAfterUpdate(String dtoObjectName,
                                                                List<MessageStructure> messageStructures)
Writes the section to set fields specific to this dto for testReadAfterUpdate sections.


isServiceMethodTestedAsPartofCrudInBaseConformanceTest

protected boolean isServiceMethodTestedAsPartofCrudInBaseConformanceTest(ServiceMethod method)
Given a method type, returns true if this method is tested as part of CRUD operations tested by the base test conformance class.


calcNamesOfDTOsWithCrudManagedByService

protected List<String> calcNamesOfDTOsWithCrudManagedByService()
Gets a list of all the DTO names that are part of this service.


doTestImportsAdd

protected void doTestImportsAdd()
Does the importsAdd for all files required for testing



Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.