diff --git a/luminex/src/org/labkey/luminex/LuminexModule.java b/luminex/src/org/labkey/luminex/LuminexModule.java index b13ab23c41..8321914473 100644 --- a/luminex/src/org/labkey/luminex/LuminexModule.java +++ b/luminex/src/org/labkey/luminex/LuminexModule.java @@ -101,7 +101,7 @@ public Set getUnitTests() AssayQCFlagColumn.TestCase.class, LuminexDataHandler.TestCase.class, LuminexExcelParser.TestCase.class, -// LuminexRunAsyncContext.TestCase.class, + LuminexRunAsyncContext.TestCase.class, LuminexSaveExclusionsForm.TestCase.class ); } diff --git a/luminex/src/org/labkey/luminex/LuminexRunAsyncContext.java b/luminex/src/org/labkey/luminex/LuminexRunAsyncContext.java index 43ddf7e720..f6a6bd7aa8 100644 --- a/luminex/src/org/labkey/luminex/LuminexRunAsyncContext.java +++ b/luminex/src/org/labkey/luminex/LuminexRunAsyncContext.java @@ -15,14 +15,16 @@ */ package org.labkey.luminex; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.simple.SimpleLogger; +import org.apache.logging.log4j.util.PropertiesUtil; import org.junit.Assert; import org.junit.Test; +import org.labkey.api.assay.pipeline.AssayRunAsyncContext; import org.labkey.api.data.ColumnInfo; import org.labkey.api.exp.ExperimentException; import org.labkey.api.exp.property.DomainProperty; -import org.labkey.api.assay.pipeline.AssayRunAsyncContext; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; import org.labkey.luminex.model.SinglePointControl; import org.labkey.luminex.model.Titration; import org.labkey.luminex.query.LuminexProtocolSchema; @@ -264,57 +266,57 @@ public List getSinglePointControls() } -// public static class TestCase extends Assert -// { -// -// LuminexUnitTestContext testContext = new LuminexUnitTestContext(); -// LuminexRunAsyncContext asyncContext; -// -// private static class StringLogger extends Logger -// { -// StringBuilder sb = new StringBuilder(); -// private StringLogger() -// { -// super(""); -// } -// -// @Override -// public void info(Object append) -// { -// sb.append(append); -// sb.append("\n"); -// } -// -// public String toString() -// { -// return sb.toString(); -// } -// } -// -// @Test -// public void checkLogging() throws Exception -// { -// asyncContext = new LuminexRunAsyncContext(testContext); -// StringLogger sl = new StringLogger(); -// asyncContext.logProperties(sl); -// String output = sl.toString(); -// -// assert(output.contains("Analyte 1")); -// assert(output.contains("Analyte 2")); -// assert(output.contains("Batch Name: Name of the Batch")); -// assert(output.contains("* New")); -// assert(output.contains("Assay ID: Log Test")); -// assert(output.contains("Run Comments: Test Comments")); -// assert(output.contains("Run Name: Name of the Run")); -// assert(output.contains("Name: Name of the Project")); -// assert(output.contains("*PositivityThreshold: 50.0")); -// assert(output.contains("*NegativeBead: Blank (3)")); -// assert(output.contains("Standard: true")); -// assert(output.contains("QC Control: false")); -// assert(output.contains("Other Control: true")); -// assert(output.contains("Unknown: false")); -// assert(output.contains("Single Point Control: true")); -// } -// -// } + public static class TestCase extends Assert + { + + LuminexUnitTestContext testContext = new LuminexUnitTestContext(); + LuminexRunAsyncContext asyncContext; + + private static class StringLogger extends SimpleLogger + { + StringBuilder sb = new StringBuilder(); + private StringLogger() + { + super("", Level.INFO, false, false, false, false, "", null, new PropertiesUtil(PropertiesUtil.getSystemProperties()), null); + } + + @Override + public void info(Object append) + { + sb.append(append); + sb.append("\n"); + } + + public String toString() + { + return sb.toString(); + } + } + + @Test + public void checkLogging() throws Exception + { + asyncContext = new LuminexRunAsyncContext(testContext); + StringLogger sl = new StringLogger(); + asyncContext.logProperties(sl); + String output = sl.toString(); + + assert(output.contains("Analyte 1")); + assert(output.contains("Analyte 2")); + assert(output.contains("Batch Name: Name of the Batch")); + assert(output.contains("* New")); + assert(output.contains("Assay ID: Log Test")); + assert(output.contains("Run Comments: Test Comments")); + assert(output.contains("Run Name: Name of the Run")); + assert(output.contains("Name: Name of the Project")); + assert(output.contains("*PositivityThreshold: 50.0")); + assert(output.contains("*NegativeBead: Blank (3)")); + assert(output.contains("Standard: true")); + assert(output.contains("QC Control: false")); + assert(output.contains("Other Control: true")); + assert(output.contains("Unknown: false")); + assert(output.contains("Single Point Control: true")); + } + + } }