Package net.officefloor.polyglot.test
Class AbstractPolyglotProcedureTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
net.officefloor.frame.test.OfficeFrameTestCase
net.officefloor.polyglot.test.AbstractPolyglotProcedureTest
- All Implemented Interfaces:
junit.framework.Test
Abstract tests for a polyglot
Procedure via a SectionSource.- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHandles the return of collection types.static classHandles various flow outputs from the procedure.static classHandles the return of object types.static classPasses a parameter to the procedure.static classReturns parameter types from the procedure.static classHandles the return of primitive types.protected static interfaceBuilds theProcedure.static classPasses variables through to the procedure.static classReturns variable types from the procedure.Nested classes/interfaces inherited from class net.officefloor.frame.test.OfficeFrameTestCase
OfficeFrameTestCase.FailOperation, OfficeFrameTestCase.GuiTest, OfficeFrameTestCase.MultithreadedTestLogic<T extends Throwable>, OfficeFrameTestCase.StressTest, OfficeFrameTestCase.TestCapture<T extends Throwable>, OfficeFrameTestCase.TestLogic<R,T extends Throwable>, OfficeFrameTestCase.UsesDockerTest, OfficeFrameTestCase.UsesGCloudTest, OfficeFrameTestCase.WaitForTruePredicate<T extends Throwable> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.fasterxml.jackson.databind.ObjectMapperObjectMapper.protected OfficeFloorFields inherited from class net.officefloor.frame.test.OfficeFrameTestCase
CLASS_LOADER_EXTRA_CLASS_NAME, CLASS_LOADER_EXTRA_PACKAGE_NAME, classLoaderTestSupport, END_OF_LINE, fileTestSupport, logTestSupport, mockTestSupport, threadedTestSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected OfficeSectionaddProcedure(String resourceName, Class<? extends ProcedureSourceServiceFactory> serviceFactory, String procedureName, boolean isNext, PropertyList properties, CompileOfficeContext context) Convenience method to add aProcedure.protected StringasynchronousFlow(CompileOfficeContext context) Invokes asynchronous flow via the procedure.protected abstract voidasynchronousFlow(AsynchronousFlow flowOne, AsynchronousFlow flowTwo) Invokes asynchronous flow directly.protected abstract voidBuilds the asynchronous flow procedure.protected abstract CollectionTypescollections(List<Integer> list, Set<Character> set, Map<String, JavaObject> map) Invokes collection types directly.protected Stringcollections(CompileOfficeContext context, OfficeSectionInput handleResult) Invokes collections via the procedure.protected abstract voidBuilds the collections procedure.protected Stringflow(CompileOfficeContext context, OfficeSectionInput next, OfficeSectionInput flow, OfficeSectionInput flowWithCallback, OfficeSectionInput flowWithParameterAndCallback, OfficeSectionInput flowWithParameter, OfficeSectionInput exception) Invokes flow via the procedure.protected abstract voidBuilds the flow procedure.protected abstract Class<? extends ProcedureSourceServiceFactory>Obtains theProcedureSourceServiceFactoryClass.protected StringgetSourceName(Class<? extends ProcedureSourceServiceFactory> serviceFactory) Obtains the source name for theProcedureSourceServiceFactory.protected abstract voidInvokes http exception directly.protected voidhttpException(OfficeFlowSourceNode pass, CompileWebContext context) Invokes http exception via the procedure.protected abstract voidBuilds the http exception procedure.protected booleanSome languages do not provide exceptions.protected abstract ObjectTypesobjects(String string, JavaObject object, int[] primitiveArray, JavaObject[] objectArray) Invokes object types directly.protected Stringobjects(CompileOfficeContext context, OfficeSectionInput handleResult) Invokes objects via the procedure.protected abstract voidBuilds the objects procedure.protected abstract ParameterTypesInvokes parameter types directly.protected voidparameter(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult) Invokes parameter via the procedure.protected abstract voidBuilds the parameter procedure.protected abstract PrimitiveTypesprimitives(boolean _boolean, byte _byte, short _short, char _char, int _int, long _long, float _float, double _double) Invokes primitive types directly.protected Stringprimitives(CompileOfficeContext context, OfficeSectionInput handleResult) Invokes primitives via the procedure.protected abstract voidBuilds the primitives procedure.protected voidtearDown()voidEnsure correctProcedureType.voidEnsure correctProcedureType.voidValidate directAsynchronousFlow.voidEnsure can pass collections.voidEnsure can run direct forHttpException.voidEnsure safe to run directly multi-threaded.voidEnsure can pass in a Java object.voidEnsure can provideParameter.voidEnsure can use primitive types.voidEnsure can handle variables.voidEnsure can run direct for web.voidtestFlow()Ensure can invoke flow.voidEnsure correctProcedureType.voidEnsure correctProcedureType.voidEnsure can invokeAsynchronousFlow.voidEnsure can invoke collections.voidEnsure can invoke to handleHttpException.voidEnsure safe to run invoked multi-threaded.voidEnsure can invoke object types.voidEnsure can use parameter.voidEnsure can invoke primitive types.voidEnsure can using variables.voidEnsure can invoke for web.voidEnsure correctProcedureType.voidEnsure correctProcedureType.voidEnsure correctProcedureType.voidEnsure correctProcedureType.protected abstract VariableTypesInvokes variable types directly.protected voidvariables(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult) Invokes variables via the procedure.protected abstract voidBuilds the variables procedure.protected abstract voidweb(String pathParameter, String queryParameter, String headerParameter, String cookieParameter, MockHttpParameters httpParameters, MockHttpObject httpObject, ObjectResponse<WebTypes> response) Invokes web types directly.protected voidweb(OfficeFlowSourceNode pass, CompileWebContext context) Invokes web via the procedure.protected abstract voidBuilds the web procedure.Methods inherited from class net.officefloor.frame.test.OfficeFrameTestCase
assertContents, assertContents, assertFail, assertFail, assertFail, assertGraph, assertList, assertList, assertList, assertList, assertList, assertProperties, assertTextEquals, assertXmlEquals, captureLoggerOutput, clearDirectory, copyDirectory, createFile, createMock, createNewClassLoader, createPlatformIndependentText, createSynchronizedMock, deleteDirectory, displayGraph, displayGraph, doMultiThreadedTest, doMultiThreadedTest, doTest, fail, findFile, findFile, findInputStream, getDisplayRunTime, getDisplayRunTime, getFileContents, getFileLocation, getItem, getPackageRelativePath, getProperty, isGuiAvailable, isPrintMessages, isSkipStressTests, isSkipTestsUsingDocker, isSkipTestsUsingGCloud, param, paramType, printHeapMemoryDiagnostics, printMessage, printMessage, printMessage, recordReturn, recordReturn, recordThrows, recordVoid, removeXmlWhiteSpacing, replayMockObjects, runBare, setDebugVerbose, setLogGC, setName, setVerbose, sleep, throwException, timeout, timeout, verifyMockObjects, waitForTrue, waitForTrueMethods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setUp, toString
-
Field Details
-
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapperObjectMapper. -
officeFloor
-
-
Constructor Details
-
AbstractPolyglotProcedureTest
public AbstractPolyglotProcedureTest()
-
-
Method Details
-
tearDown
- Overrides:
tearDownin classjunit.framework.TestCase- Throws:
Exception
-
addProcedure
protected OfficeSection addProcedure(String resourceName, Class<? extends ProcedureSourceServiceFactory> serviceFactory, String procedureName, boolean isNext, PropertyList properties, CompileOfficeContext context) Convenience method to add aProcedure.- Parameters:
resourceName- Name of resource.serviceFactory-ProcedureSourceServiceFactory.procedureName- Name ofProcedure.isNext- Indicates if nextFlow.properties-PropertyList.context-CompileOfficeContext.- Returns:
OfficeSectionfor theProcedure.
-
getProcedureSourceServiceFactoryClass
protected abstract Class<? extends ProcedureSourceServiceFactory> getProcedureSourceServiceFactoryClass()Obtains theProcedureSourceServiceFactoryClass.- Returns:
ProcedureSourceServiceFactoryClass.
-
getSourceName
Obtains the source name for theProcedureSourceServiceFactory.- Parameters:
serviceFactory-ProcedureSourceServiceFactoryClass.- Returns:
- Source name.
-
isSupportExceptions
protected boolean isSupportExceptions()Some languages do not provide exceptions.- Returns:
trueif supportException.
-
testDirectPrimitives
Ensure can use primitive types.- Throws:
Exception- On test failure.
-
primitives
protected abstract PrimitiveTypes primitives(boolean _boolean, byte _byte, short _short, char _char, int _int, long _long, float _float, double _double) throws Exception Invokes primitive types directly.- Parameters:
_boolean- Boolean primitive._byte- Byte primitive._short- Short primitive._char- Char primitive._int- Int primitive._long- Long primitive._float- Float primitive._double- Double primitive.- Returns:
PrimitiveTypesresult.- Throws:
Exception- If fails.
-
testPrimitivesType
public void testPrimitivesType()Ensure correctProcedureType. -
testInvokePrimitives
Ensure can invoke primitive types.- Throws:
Throwable- On test failure.
-
primitives
Invokes primitives via the procedure.- Parameters:
context-CompileOfficeContext.handleResult-OfficeSectionInputto handle the result.- Returns:
- Name of the managed function.
-
primitives
Builds the primitives procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectObject
Ensure can pass in a Java object.- Throws:
Exception- On test failure.
-
objects
protected abstract ObjectTypes objects(String string, JavaObject object, int[] primitiveArray, JavaObject[] objectArray) throws Exception Invokes object types directly.- Parameters:
string- String value.object-JavaObjectvalue.primitiveArray- Primitive array value.objectArray- Object array value.- Returns:
ObjectTypesresult.- Throws:
Exception- If fails.
-
testObjectType
public void testObjectType()Ensure correctProcedureType. -
testInvokeObject
Ensure can invoke object types.- Throws:
Throwable- On test failure.
-
objects
Invokes objects via the procedure.- Parameters:
context-CompileOfficeContext.handleResult-OfficeSectionInputto handle the result.- Returns:
- Name of the managed function.
-
objects
Builds the objects procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectCollections
Ensure can pass collections.- Throws:
Exception- On test failure.
-
collections
protected abstract CollectionTypes collections(List<Integer> list, Set<Character> set, Map<String, JavaObject> map) throws ExceptionInvokes collection types directly.- Parameters:
list-Listvalue.set-Setvalue.map-Mapvalue.- Returns:
CollectionTypesresult.- Throws:
Exception- If fails.
-
testCollectionsType
public void testCollectionsType()Ensure correctProcedureType. -
testInvokeCollections
Ensure can invoke collections.- Throws:
Throwable- On test failure.
-
collections
Invokes collections via the procedure.- Parameters:
context-CompileOfficeContext.handleResult-OfficeSectionInputto handle the result.- Returns:
- Name of the managed function.
-
collections
Builds the collections procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectVariables
Ensure can handle variables.- Throws:
Exception- On test failure.
-
variables
protected abstract VariableTypes variables(char val, In<String> in, Out<JavaObject> out, Var<Integer> var) throws Exception Invokes variable types directly.- Parameters:
val- Variable character value.in- Input variable.out- Output variable.var- In/out variable.- Returns:
VariableTypesresult.- Throws:
Exception- If fails.
-
testVariablesType
public void testVariablesType()Ensure correctProcedureType. -
testInvokeVariables
Ensure can using variables.- Throws:
Throwable- On test failure.
-
variables
protected void variables(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult) Invokes variables via the procedure.- Parameters:
pass-OfficeSectionOutputto pass into the procedure.context-CompileOfficeContext.handleResult-OfficeSectionInputto handle the result.
-
variables
Builds the variables procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectParameter
Ensure can provideParameter.- Throws:
Exception- On test failure.
-
parameter
Invokes parameter types directly.- Parameters:
parameter- Parameter string value.- Returns:
ParameterTypesresult.- Throws:
Exception- If fails.
-
testParameterType
public void testParameterType()Ensure correctProcedureType. -
testInvokeParameter
Ensure can use parameter.- Throws:
Throwable- On test failure.
-
parameter
protected void parameter(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult) Invokes parameter via the procedure.- Parameters:
pass-OfficeSectionOutputto pass into the procedure.context-CompileOfficeContext.handleResult-OfficeSectionInputto handle the result.
-
parameter
Builds the parameter procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectMultiThreaded
Ensure safe to run directly multi-threaded.- Throws:
Exception- On test failure.
-
testInvokeMultiThreaded
Ensure safe to run invoked multi-threaded.- Throws:
Throwable- On test failure.
-
testDirectWeb
Ensure can run direct for web.- Throws:
Exception- On test failure.
-
web
protected abstract void web(String pathParameter, String queryParameter, String headerParameter, String cookieParameter, MockHttpParameters httpParameters, MockHttpObject httpObject, ObjectResponse<WebTypes> response) throws Exception Invokes web types directly.- Parameters:
pathParameter- Path parameter value.queryParameter- Query parameter value.headerParameter- Header parameter value.cookieParameter- Cookie parameter value.httpParameters-MockHttpParameters.httpObject-MockHttpObject.response-ObjectResponsefor the result.- Throws:
Exception- If fails.
-
testInvokeWeb
Ensure can invoke for web.- Throws:
Throwable- On test failure.
-
web
Invokes web via the procedure.- Parameters:
pass-OfficeFlowSourceNodeto pass into the procedure.context-CompileWebContext.
-
web
Builds the web procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectHttpException
Ensure can run direct forHttpException.- Throws:
Throwable- On test failure.
-
httpException
Invokes http exception directly.- Throws:
Throwable- On test failure.
-
testHttpExceptionType
public void testHttpExceptionType()Ensure correctProcedureType. -
testInvokeHttpException
Ensure can invoke to handleHttpException.- Throws:
Throwable- On test failure.
-
httpException
Invokes http exception via the procedure.- Parameters:
pass-OfficeFlowSourceNodeto pass into the procedure.context-CompileWebContext.
-
httpException
Builds the http exception procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testFlowType
public void testFlowType()Ensure correctProcedureType. -
testFlow
Ensure can invoke flow.- Throws:
Throwable- On test failure.
-
flow
protected String flow(CompileOfficeContext context, OfficeSectionInput next, OfficeSectionInput flow, OfficeSectionInput flowWithCallback, OfficeSectionInput flowWithParameterAndCallback, OfficeSectionInput flowWithParameter, OfficeSectionInput exception) Invokes flow via the procedure.- Parameters:
context-CompileOfficeContext.next-OfficeSectionInputfor next output.flow-OfficeSectionInputfor flow output.flowWithCallback-OfficeSectionInputfor flow with callback output.flowWithParameterAndCallback-OfficeSectionInputfor flow with parameter and callback output.flowWithParameter-OfficeSectionInputfor flow with parameter output.exception-OfficeSectionInputfor exception output.- Returns:
- Name of the managed function.
-
flow
Builds the flow procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-
testDirectAsynchronousFlow
Validate directAsynchronousFlow.- Throws:
Throwable- On test failure.
-
asynchronousFlow
protected abstract void asynchronousFlow(AsynchronousFlow flowOne, AsynchronousFlow flowTwo) throws Exception Invokes asynchronous flow directly.- Parameters:
flowOne- FirstAsynchronousFlow.flowTwo- SecondAsynchronousFlow.- Throws:
Exception- If fails.
-
testAsynchronousFlowType
public void testAsynchronousFlowType()Ensure correctProcedureType. -
testInvokeAsynchronousFlow
Ensure can invokeAsynchronousFlow.- Throws:
Throwable- On test failure.
-
asynchronousFlow
Invokes asynchronous flow via the procedure.- Parameters:
context-CompileOfficeContext.- Returns:
- Function name.
-
asynchronousFlow
Builds the asynchronous flow procedure.- Parameters:
builder-AbstractPolyglotProcedureTest.ProcedureBuilder.
-