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
public abstract class AbstractPolyglotProcedureTest extends OfficeFrameTestCase
Abstract tests for a polyglotProcedurevia aSectionSource.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractPolyglotProcedureTest.CollectionReturnstatic classAbstractPolyglotProcedureTest.FlowHandlersstatic classAbstractPolyglotProcedureTest.ObjectReturnstatic classAbstractPolyglotProcedureTest.ParameterPassstatic classAbstractPolyglotProcedureTest.ParameterReturnstatic classAbstractPolyglotProcedureTest.PrimitiveReturnprotected static interfaceAbstractPolyglotProcedureTest.ProcedureBuilderBuilds theProcedure.static classAbstractPolyglotProcedureTest.VariablePassstatic classAbstractPolyglotProcedureTest.VariableReturn-
Nested classes/interfaces inherited from class net.officefloor.frame.test.OfficeFrameTestCase
OfficeFrameTestCase.FailOperation, OfficeFrameTestCase.GuiTest, OfficeFrameTestCase.MultithreadedTestLogic<T extends java.lang.Throwable>, OfficeFrameTestCase.StressTest, OfficeFrameTestCase.TestCapture<T extends java.lang.Throwable>, OfficeFrameTestCase.TestLogic<R,T extends java.lang.Throwable>, OfficeFrameTestCase.UsesDockerTest, OfficeFrameTestCase.UsesGCloudTest, OfficeFrameTestCase.WaitForTruePredicate<T extends java.lang.Throwable>
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.databind.ObjectMappermapperObjectMapper.protected OfficeFloorofficeFloor-
Fields 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 Constructor Description AbstractPolyglotProcedureTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected OfficeSectionaddProcedure(java.lang.String resourceName, java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory, java.lang.String procedureName, boolean isNext, PropertyList properties, CompileOfficeContext context)Convenience method to add aProcedure.protected java.lang.StringasynchronousFlow(CompileOfficeContext context)protected abstract voidasynchronousFlow(AsynchronousFlow flowOne, AsynchronousFlow flowTwo)protected abstract voidasynchronousFlow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected abstract CollectionTypescollections(java.util.List<java.lang.Integer> list, java.util.Set<java.lang.Character> set, java.util.Map<java.lang.String,JavaObject> map)protected java.lang.Stringcollections(CompileOfficeContext context, OfficeSectionInput handleResult)protected abstract voidcollections(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected java.lang.Stringflow(CompileOfficeContext context, OfficeSectionInput next, OfficeSectionInput flow, OfficeSectionInput flowWithCallback, OfficeSectionInput flowWithParameterAndCallback, OfficeSectionInput flowWithParameter, OfficeSectionInput exception)protected abstract voidflow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected abstract java.lang.Class<? extends ProcedureSourceServiceFactory>getProcedureSourceServiceFactoryClass()Obtains theProcedureSourceServiceFactoryClass.protected java.lang.StringgetSourceName(java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory)Obtains the source name for theProcedureSourceServiceFactory.protected abstract voidhttpException()protected voidhttpException(OfficeFlowSourceNode pass, CompileWebContext context)protected abstract voidhttpException(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected booleanisSupportExceptions()Some languages do not provide exceptions.protected abstract ObjectTypesobjects(java.lang.String string, JavaObject object, int[] primitiveArray, JavaObject[] objectArray)protected java.lang.Stringobjects(CompileOfficeContext context, OfficeSectionInput handleResult)protected abstract voidobjects(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected abstract ParameterTypesparameter(java.lang.String parameter)protected voidparameter(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)protected abstract voidparameter(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected abstract PrimitiveTypesprimitives(boolean _boolean, byte _byte, short _short, char _char, int _int, long _long, float _float, double _double)protected java.lang.Stringprimitives(CompileOfficeContext context, OfficeSectionInput handleResult)protected abstract voidprimitives(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected voidtearDown()voidtestAsynchronousFlowType()Ensure correctProcedureType.voidtestCollectionsType()Ensure correctProcedureType.voidtestDirectAsynchronousFlow()Validate directAsynchronousFlow.voidtestDirectCollections()Ensure can pass collections.voidtestDirectHttpException()Ensure can run direct forHttpException.voidtestDirectMultiThreaded()Ensure safe to run directly multi-threaded.voidtestDirectObject()Ensure can pass in a Java object.voidtestDirectParameter()Ensure can provideParameter.voidtestDirectPrimitives()Ensure can use primitive types.voidtestDirectVariables()Ensure can handle variables.voidtestDirectWeb()Ensure can run direct for web.voidtestFlow()Ensure can invoke flow.voidtestFlowType()Ensure correctProcedureType.voidtestHttpExceptionType()Ensure correctProcedureType.voidtestInvokeAsynchronousFlow()Ensure can invokeAsynchronousFlow.voidtestInvokeCollections()Ensure can invoke collections.voidtestInvokeHttpException()Ensure can invoke to handleHttpException.voidtestInvokeMultiThreaded()Ensure safe to run invoked multi-threaded.voidtestInvokeObject()Ensure can invoke object types.voidtestInvokeParameter()Ensure can use parameter.voidtestInvokePrimitives()Ensure can invoke primitive types.voidtestInvokeVariables()Ensure can using variables.voidtestInvokeWeb()Ensure can invoke for web.voidtestObjectType()Ensure correctProcedureType.voidtestParameterType()Ensure correctProcedureType.voidtestPrimitivesType()Ensure correctProcedureType.voidtestVariablesType()Ensure correctProcedureType.protected abstract VariableTypesvariables(char val, In<java.lang.String> in, Out<JavaObject> out, Var<java.lang.Integer> var)protected voidvariables(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)protected abstract voidvariables(AbstractPolyglotProcedureTest.ProcedureBuilder builder)protected abstract voidweb(java.lang.String pathParameter, java.lang.String queryParameter, java.lang.String headerParameter, java.lang.String cookieParameter, MockHttpParameters httpParameters, MockHttpObject httpObject, ObjectResponse<WebTypes> response)protected voidweb(OfficeFlowSourceNode pass, CompileWebContext context)protected abstract voidweb(AbstractPolyglotProcedureTest.ProcedureBuilder builder)-
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, waitForTrue
-
Methods 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 Detail
-
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
ObjectMapper.
-
officeFloor
protected OfficeFloor officeFloor
-
-
Method Detail
-
tearDown
protected void tearDown() throws java.lang.Exception- Overrides:
tearDownin classjunit.framework.TestCase- Throws:
java.lang.Exception
-
addProcedure
protected OfficeSection addProcedure(java.lang.String resourceName, java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory, java.lang.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 java.lang.Class<? extends ProcedureSourceServiceFactory> getProcedureSourceServiceFactoryClass()
Obtains theProcedureSourceServiceFactoryClass.- Returns:
ProcedureSourceServiceFactoryClass.
-
getSourceName
protected java.lang.String getSourceName(java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory)
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
public void testDirectPrimitives() throws java.lang.ExceptionEnsure can use primitive types.- Throws:
java.lang.Exception
-
primitives
protected abstract PrimitiveTypes primitives(boolean _boolean, byte _byte, short _short, char _char, int _int, long _long, float _float, double _double) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPrimitivesType
public void testPrimitivesType()
Ensure correctProcedureType.
-
testInvokePrimitives
public void testInvokePrimitives() throws java.lang.ThrowableEnsure can invoke primitive types.- Throws:
java.lang.Throwable
-
primitives
protected java.lang.String primitives(CompileOfficeContext context, OfficeSectionInput handleResult)
-
primitives
protected abstract void primitives(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectObject
public void testDirectObject() throws java.lang.ExceptionEnsure can pass in a Java object.- Throws:
java.lang.Exception
-
objects
protected abstract ObjectTypes objects(java.lang.String string, JavaObject object, int[] primitiveArray, JavaObject[] objectArray) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testObjectType
public void testObjectType()
Ensure correctProcedureType.
-
testInvokeObject
public void testInvokeObject() throws java.lang.ThrowableEnsure can invoke object types.- Throws:
java.lang.Throwable
-
objects
protected java.lang.String objects(CompileOfficeContext context, OfficeSectionInput handleResult)
-
objects
protected abstract void objects(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectCollections
public void testDirectCollections() throws java.lang.ExceptionEnsure can pass collections.- Throws:
java.lang.Exception
-
collections
protected abstract CollectionTypes collections(java.util.List<java.lang.Integer> list, java.util.Set<java.lang.Character> set, java.util.Map<java.lang.String,JavaObject> map) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testCollectionsType
public void testCollectionsType()
Ensure correctProcedureType.
-
testInvokeCollections
public void testInvokeCollections() throws java.lang.ThrowableEnsure can invoke collections.- Throws:
java.lang.Throwable
-
collections
protected java.lang.String collections(CompileOfficeContext context, OfficeSectionInput handleResult)
-
collections
protected abstract void collections(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectVariables
public void testDirectVariables() throws java.lang.ExceptionEnsure can handle variables.- Throws:
java.lang.Exception
-
variables
protected abstract VariableTypes variables(char val, In<java.lang.String> in, Out<JavaObject> out, Var<java.lang.Integer> var) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testVariablesType
public void testVariablesType()
Ensure correctProcedureType.
-
testInvokeVariables
public void testInvokeVariables() throws java.lang.ThrowableEnsure can using variables.- Throws:
java.lang.Throwable
-
variables
protected void variables(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)
-
variables
protected abstract void variables(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectParameter
public void testDirectParameter() throws java.lang.ExceptionEnsure can provideParameter.- Throws:
java.lang.Exception
-
parameter
protected abstract ParameterTypes parameter(java.lang.String parameter) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testParameterType
public void testParameterType()
Ensure correctProcedureType.
-
testInvokeParameter
public void testInvokeParameter() throws java.lang.ThrowableEnsure can use parameter.- Throws:
java.lang.Throwable
-
parameter
protected void parameter(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)
-
parameter
protected abstract void parameter(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectMultiThreaded
public void testDirectMultiThreaded() throws java.lang.ExceptionEnsure safe to run directly multi-threaded.- Throws:
java.lang.Exception
-
testInvokeMultiThreaded
public void testInvokeMultiThreaded() throws java.lang.ThrowableEnsure safe to run invoked multi-threaded.- Throws:
java.lang.Throwable
-
testDirectWeb
public void testDirectWeb() throws java.lang.ExceptionEnsure can run direct for web.- Throws:
java.lang.Exception
-
web
protected abstract void web(java.lang.String pathParameter, java.lang.String queryParameter, java.lang.String headerParameter, java.lang.String cookieParameter, MockHttpParameters httpParameters, MockHttpObject httpObject, ObjectResponse<WebTypes> response) throws java.lang.Exception- Throws:
java.lang.Exception
-
testInvokeWeb
public void testInvokeWeb() throws java.lang.ThrowableEnsure can invoke for web.- Throws:
java.lang.Throwable
-
web
protected void web(OfficeFlowSourceNode pass, CompileWebContext context)
-
web
protected abstract void web(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectHttpException
public void testDirectHttpException() throws java.lang.ThrowableEnsure can run direct forHttpException.- Throws:
java.lang.Throwable
-
httpException
protected abstract void httpException() throws java.lang.Throwable- Throws:
java.lang.Throwable
-
testHttpExceptionType
public void testHttpExceptionType()
Ensure correctProcedureType.
-
testInvokeHttpException
public void testInvokeHttpException() throws java.lang.ThrowableEnsure can invoke to handleHttpException.- Throws:
java.lang.Throwable
-
httpException
protected void httpException(OfficeFlowSourceNode pass, CompileWebContext context)
-
httpException
protected abstract void httpException(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testFlowType
public void testFlowType()
Ensure correctProcedureType.
-
testFlow
public void testFlow() throws java.lang.ThrowableEnsure can invoke flow.- Throws:
java.lang.Throwable
-
flow
protected java.lang.String flow(CompileOfficeContext context, OfficeSectionInput next, OfficeSectionInput flow, OfficeSectionInput flowWithCallback, OfficeSectionInput flowWithParameterAndCallback, OfficeSectionInput flowWithParameter, OfficeSectionInput exception)
-
flow
protected abstract void flow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectAsynchronousFlow
public void testDirectAsynchronousFlow() throws java.lang.ThrowableValidate directAsynchronousFlow.- Throws:
java.lang.Throwable
-
asynchronousFlow
protected abstract void asynchronousFlow(AsynchronousFlow flowOne, AsynchronousFlow flowTwo) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testAsynchronousFlowType
public void testAsynchronousFlowType()
Ensure correctProcedureType.
-
testInvokeAsynchronousFlow
public void testInvokeAsynchronousFlow() throws java.lang.ThrowableEnsure can invokeAsynchronousFlow.- Throws:
java.lang.Throwable
-
asynchronousFlow
protected java.lang.String asynchronousFlow(CompileOfficeContext context)
-
asynchronousFlow
protected abstract void asynchronousFlow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
-