Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion luminex/src/org/labkey/luminex/LuminexModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Set<Class> getUnitTests()
AssayQCFlagColumn.TestCase.class,
LuminexDataHandler.TestCase.class,
LuminexExcelParser.TestCase.class,
// LuminexRunAsyncContext.TestCase.class,
LuminexRunAsyncContext.TestCase.class,
LuminexSaveExclusionsForm.TestCase.class
);
}
Expand Down
114 changes: 58 additions & 56 deletions luminex/src/org/labkey/luminex/LuminexRunAsyncContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -264,57 +266,57 @@ public List<SinglePointControl> 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"));
}

}
}