public void Cleanup() { // Kill all exes associated with tests JS_Utilities JSUtils = new JS_Utilities(); JSUtils.JS_TestCleanup_Basic(); }
public static void Class_Initialize(TestContext tc) { // Build the JS app first from a JS file JS_Utilities JSUtils = new JS_Utilities(); //*#*#*# COMMENT OUT FOR NOW - EASIER WITH TEST WRITING ETC JSUtils.BuildJSTestApp(); //JSUtils.BuildJSTestApp(); }
public void JS_PTI_BasicEndToEnd_BiDi_Test() { Utilities MyUtils = new Utilities(); JS_Utilities JSUtils = new JS_Utilities(); int numRounds = 2; long totalBytes = 2147483648; long totalEchoBytes = 2147483648; int bytesPerRound = 0; int maxMessageSize = 0; int batchSizeCutoff = 0; int messagesSent = 49152; bool bidi = true; string logTriggerSize = "1024"; // just set a test to have 1024 which is the default of C# string originaltestName = "jsptibidiendtoendtest"; string testName = originaltestName + uniqueTestNameID; // this is the version to make it unqiue so other CI tests don't affect it string logOutputFileName_TestApp = testName + "_TestApp.log"; JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, testName); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_logTriggerSizeinMB, logTriggerSize); JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputFileName_TestApp); // Verify the data in the output file - too many changing rows in output to do a cmp file so verify some of the key lines bool pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "Bytes received: " + totalBytes.ToString(), 10, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "SUCCESS: The expected number of bytes (" + totalBytes.ToString() + ") have been received", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "SUCCESS: The expected number of echoed bytes (" + totalEchoBytes.ToString() + ") have been received", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "All rounds complete (" + messagesSent.ToString() + " messages sent)", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "[IC] Connected!", 1, false, testName, true); pass = MyUtils.WaitForProcessToFinish(logOutputFileName_TestApp, "round #" + numRounds.ToString(), 1, false, testName, true); // Verify integrity of Ambrosia logs by replaying JSUtils.JS_VerifyTimeTravelDebugging(testName, numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, true); }
public static void Class_Initialize(TestContext tc) { // Build the JS app first from a JS file JS_Utilities JSUtils = new JS_Utilities(); JSUtils.BuildJSTestApp(); }
public void JS_CG_CustomSerialParamNoRaw_Test() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_CustomSerialParamNoRawParam.ts"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName); }
public void JS_CG_LiteralObjArray_Test() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_LitObjArray.ts"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName); }
public void JS_CodeGen_EventHandler_Test() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_EventHandlers.ts"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName); }
public void JS_PTI_RestartTwoProcKillClient_Test() { Utilities MyUtils = new Utilities(); JS_Utilities JSUtils = new JS_Utilities(); int numRounds = 10; long totalBytes = 163840; long totalEchoBytes = 163840; int bytesPerRound = 16384; int maxMessageSize = 64; int batchSizeCutoff = 16384; int messagesSent = 2560; bool bidi = false; string testName = "jsptirestartkillclient"; string clientInstanceName = testName + "client"; string serverInstanceName = testName + "server"; string logOutputClientFileName_TestApp = testName + "Client_TestApp.log"; string logOutputServerFileName_TestApp = testName + "Server_TestApp.log"; string logOutputClientRestartedFileName_TestApp = testName + "Client_TestApp_Restarted.log"; JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, testName, JSUtils.JSPTI_CombinedInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, clientInstanceName, JSUtils.JSPTI_ClientInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, serverInstanceName, JSUtils.JSPTI_ServerInstanceRole); // Start it once - Launch the client and the server as separate procs //*** NOTE - The first call (Server in this case) starts 4 nodes and sometimes it doesn't give proper process id //*** However, the second call only starts one node, so make sure client is second so then know that PID is correct for killing it int serverProcessID = JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputServerFileName_TestApp, 0, false, JSUtils.JSPTI_ServerInstanceRole); int clientProcessID = JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputClientFileName_TestApp, 0, false, JSUtils.JSPTI_ClientInstanceRole, serverInstanceName); // Give it 5 seconds where it tries to connect but doesn't MyUtils.TestDelay(5000); // Kill client MyUtils.KillProcess(clientProcessID); // Restart the client and make sure it continues clientProcessID = JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputClientRestartedFileName_TestApp, 0, false, JSUtils.JSPTI_ClientInstanceRole, serverInstanceName); // Verify the data in the restarted output file bool pass = MyUtils.WaitForProcessToFinish(logOutputServerFileName_TestApp, "Bytes received: " + totalBytes.ToString(), 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputServerFileName_TestApp, "SUCCESS: The expected number of bytes (" + totalBytes.ToString() + ") have been received", 1, false, testName, true); // Verify that echo is NOT part of the output - won't pop assert on fail so check return value pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "SUCCESS: The expected number of echoed bytes (" + totalEchoBytes.ToString() + ") have been received", 0, true, testName, false, false); if (pass == true) { Assert.Fail("<JS_PTI_RestartTwoProcKillClient_Test> Echoed string should NOT have been found in the output but it was."); } pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "All rounds complete (" + messagesSent.ToString() + " messages sent)", 1, false, testName, true, false); pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "[IC] Connected!", 1, false, testName, true, false); // Verify integrity of Ambrosia logs by replaying JSUtils.JS_VerifyTimeTravelDebugging(testName, numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, true, "", JSUtils.JSPTI_ServerInstanceRole); }
public void JS_CG_GenTypeConcrete2_Test() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_GenType2.ts"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName); }
public void JS_PTI_BasicRestartTwoProc_PostMeth_Test() { Utilities MyUtils = new Utilities(); JS_Utilities JSUtils = new JS_Utilities(); int numRounds = 3; long totalBytes = 3221225472; long totalEchoBytes = 3221225472; int bytesPerRound = 0; int maxMessageSize = 0; int batchSizeCutoff = 0; bool bidi = false; string originaltestName = "jsptirestartpostmeth"; string testName = originaltestName + uniqueTestNameID; // this is the version to make it unqiue so other CI tests don't affect it string clientInstanceName = testName + "client"; string serverInstanceName = testName + "server"; string logOutputClientFileName_TestApp = testName + "Client_TestApp.log"; string logOutputServerFileName_TestApp = testName + "Server_TestApp.log"; string logOutputClientRestartedFileName_TestApp = testName + "Client_TestApp_Restarted.log"; JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, testName, JSUtils.JSPTI_CombinedInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, clientInstanceName, JSUtils.JSPTI_ClientInstanceRole); JSUtils.JS_UpdateJSConfigFile(JSUtils.JSConfig_instanceName, serverInstanceName, JSUtils.JSPTI_ServerInstanceRole); // Start it once - Launch the client and the server as separate procs //*** NOTE - The first call (Server in this case) starts 4 nodes and sometimes it doesn't give proper process id //*** However, the second call only starts one node, so make sure client is second so then know that PID is correct for killing it int serverProcessID = JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputServerFileName_TestApp, 0, false, JSUtils.JSPTI_ServerInstanceRole, "", true); int clientProcessID = JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputClientFileName_TestApp, 0, false, JSUtils.JSPTI_ClientInstanceRole, serverInstanceName, true); // Give it 20 seconds where it tries to connect but doesn't MyUtils.TestDelay(20000); // Kill client MyUtils.KillProcess(clientProcessID); // Restart the client and make sure it continues clientProcessID = JSUtils.StartJSPTI(numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, logOutputClientRestartedFileName_TestApp, 0, false, JSUtils.JSPTI_ClientInstanceRole, serverInstanceName); // Verify the data in the restarted output file bool pass = MyUtils.WaitForProcessToFinish(logOutputServerFileName_TestApp, "Bytes received: " + totalBytes.ToString(), 5, false, testName, true); // number of bytes processed pass = MyUtils.WaitForProcessToFinish(logOutputServerFileName_TestApp, "SUCCESS: The expected number of bytes (" + totalBytes.ToString() + ") have been received", 1, false, testName, true); // Verify that echo is NOT part of the output - won't pop assert on fail so check return value pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "All rounds complete", 1, false, testName, true, false); pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "[IC] Connected!", 1, false, testName, true, false); // Verify the Post Method messages pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "Restarted result timeouts for", 1, false, testName, true, false); pass = MyUtils.WaitForProcessToFinish(logOutputClientRestartedFileName_TestApp, "SUCCESS: The result handler for the 'incrementValue' post method was called the expected number of times (114688)", 1, false, testName, true, false); // Verify integrity of Ambrosia logs by replaying JSUtils.JS_VerifyTimeTravelDebugging(testName, numRounds, totalBytes, totalEchoBytes, bytesPerRound, maxMessageSize, batchSizeCutoff, bidi, true, "", JSUtils.JSPTI_ServerInstanceRole); }
public void JS_CG_Misc_AST_Test() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "ASTTest.ts"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName); }
public void JS_CG_Neg_MethodIDInt() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_MethodIDInt.ts"; string ConsumerErrorMsg = "Error: The value ('Hello') supplied for @ambrosia attribute 'methodID' is not an integer"; string PublisherErrorMsg = "Error: The value ('Hello') supplied for @ambrosia attribute 'methodID' is not an integer"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_CommaAttrib() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_CommasBetweenAttrib.ts"; string ConsumerErrorMsg = "Error: Malformed @ambrosia attribute 'publish=true version=1 doRuntimeTypeChecking=true'"; string PublisherErrorMsg = "expected format is: attrName=attrValue, ..."; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_AsyncFcthn() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_AsyncFctn.ts"; string ConsumerErrorMsg = "as a post method (reason: async functions are not supported)"; string PublisherErrorMsg = "Error: Unable to publish type alias 'Digits'"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_AmbrosiaTagNewLine() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_AmbrosiaTagNewline.ts"; string ConsumerErrorMsg = "Error: A newline is not allowed in the attributes of an @ambrosia tag"; string PublisherErrorMsg = "Error: A newline is not allowed in the attributes of an @ambrosia tag"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_OverloadFctn() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_OverloadedFunction.ts"; string ConsumerErrorMsg = "Error: Unable to publish function 'fnOverload'"; string PublisherErrorMsg = "as a post method (reason: The @ambrosia tag must appear on the implementation of an overloaded function"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_NestedFctn() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_NestedFunction.ts"; string ConsumerErrorMsg = "Error: The @ambrosia tag is not valid on a local function ('localFn'"; string PublisherErrorMsg = "Error: The @ambrosia tag is not valid on a local function ('localFn'"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_UnionType() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_UnionType.ts"; string ConsumerErrorMsg = "Error: Unable to publish type alias 'MyUnionType'"; string PublisherErrorMsg = "as a type (reason: The published type 'MyUnionType' has an invalid type ('string|number'); union types are not supported)"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_TagMethod() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_TagMethod.ts"; string ConsumerErrorMsg = "Error: The input source file (TS_TagMethod.ts) does not publish any entities (exported functions, type aliases and enums annotated with an @ambrosia JSDoc tag)"; string PublisherErrorMsg = "Error: The input source file (TS_TagMethod.ts) does not publish any entities (exported functions, type aliases and enums annotated with an @ambrosia JSDoc tag)"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_RunTimeBool() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_RunTimeBool.ts"; string ConsumerErrorMsg = "Error: The value ('Hello') supplied for @ambrosia attribute 'doRuntimeTypeChecking' is not a boolean "; string PublisherErrorMsg = "Error: The value ('Hello') supplied for @ambrosia attribute 'doRuntimeTypeChecking' is not a boolean "; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_QuoteAttribVal() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_QuoteAttributeValue.ts"; string ConsumerErrorMsg = "Error: The value ('\"true\"') supplied for @ambrosia attribute 'publish' is not a boolean"; string PublisherErrorMsg = "Error: The value ('\"true\"') supplied for @ambrosia attribute 'publish' is not a boolean"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_PublishMethodRef() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_PublishMethodBeforeRef.ts"; string ConsumerErrorMsg = "Error: Unable to publish function 'fn'"; string PublisherErrorMsg = "as a post method (reason: The following types must be published before any method can be published: 'Name' found in published type 'MyType')"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_PublishClass() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_PublishClass.ts"; string ConsumerErrorMsg = "Error: The @ambrosia tag is not valid on a class; valid targets are: function, type alias, enum"; string PublisherErrorMsg = "Error: The @ambrosia tag is not valid on a class; valid targets are: function, type alias, enum"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_NoFunctionComplexTypes() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_NoFunctionComplexType.ts"; string ConsumerErrorMsg = "Error: Unable to publish type alias 'myComplexType'"; string PublisherErrorMsg = "as a type (reason: The published type 'myComplexType' [property 'fn'] has an invalid type ('()=>void'); function types are not supported)"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_UnionTypeCommented() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_UnionTypeCommented.ts"; string ConsumerErrorMsg = "Error: Unable to publish function 'myComplexReturnFunction'"; string PublisherErrorMsg = "as a post method (reason: The return type of method 'myComplexReturnFunction' [property 'r2'] has an invalid type ('number|string'); union types are not supported)"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_UnknownAttribute() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_UnknownAttribute.ts"; string ConsumerErrorMsg = "Error: The @ambrosia attribute 'published' is invalid for a function"; string PublisherErrorMsg = "valid attributes are: publish, version, methodID, doRuntimeTypeChecking"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_MethodIDNeg() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_MethodIDNeg.ts"; string ConsumerErrorMsg = "Error: Unable to publish function 'MyFn'"; string PublisherErrorMsg = "as a method (reason: Method ID -2 is invalid"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_SingleUInt8Array() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_SingleUInt8Array.ts"; string ConsumerErrorMsg = "Unable to publish function 'takesCustomSerializedParams'"; string PublisherErrorMsg = "Uint8Array parameter; Post methods do NOT support custom (raw byte) parameter serialization - all parameters are always serialized to JSON)"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_TwoAmbrTag() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_TwoAmbrTags.ts"; string ConsumerErrorMsg = "Error: The @ambrosia tag is defined more than once at"; string PublisherErrorMsg = "Error: The @ambrosia tag is defined more than once at"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }
public void JS_CG_Neg_OptionalProp() { JS_Utilities JSUtils = new JS_Utilities(); string testfileName = "TS_OptionalProperties.ts"; string ConsumerErrorMsg = "Error: Unable to publish type alias 'MyTypeWithOptionalMembers'"; string PublisherErrorMsg = "as a type (reason: Property 'bar' is optional, but types with optional properties are not supported)"; // Generate the consumer and publisher files and verify output and the generated files to cmp files JSUtils.Test_CodeGen_TSFile(testfileName, true, ConsumerErrorMsg, PublisherErrorMsg); }