Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC4J-587 Test #696

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.nio.file.Paths;
import java.nio.file.Path;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

import java.math.BigDecimal;
Expand Down Expand Up @@ -55,6 +56,9 @@
import org.junit.Test;
import org.junit.Before;
import org.junit.runners.MethodSorters;

import com.nimbusds.jose.util.StandardCharset;

import org.junit.experimental.categories.Category;

import static org.junit.Assert.*;
Expand Down Expand Up @@ -92,6 +96,7 @@ public void readWithForcedTimeoutTest() throws Exception
public void nullCharTests() throws Exception
{
// Unicode
boolean unicodePassed = true;
{
FieldDef recordDef = null;
{
Expand All @@ -105,12 +110,20 @@ public void nullCharTests() throws Exception
List<HPCCRecord> records = new ArrayList<HPCCRecord>();
int maxUTF16BMPChar = Character.MAX_CODE_POINT;
for (int i = 0; i < maxUTF16BMPChar; i++) {


String strMidEOS = "";
for (int j = 0; j < 98; j++, i++) {
if (j == 50) {
strMidEOS += "\0";
}
strMidEOS += Character.toString((char) i);

if (Character.isValidCodePoint(i) == false)
{
continue;
}

strMidEOS += new String(Character.toChars(i)); //Character.toString((char) i);
}

Object[] fields = {strMidEOS, strMidEOS};
Expand All @@ -129,11 +142,13 @@ public void nullCharTests() throws Exception
if (readRecord.equals(record) == false)
{
System.out.println("Record: " + i + " did not match\n" + record + "\n" + readRecord);
unicodePassed = false;
}
}
}

// SBC / ASCII
boolean sbcPassed = true;
{
FieldDef recordDef = null;
{
Expand Down Expand Up @@ -170,9 +185,13 @@ public void nullCharTests() throws Exception
if (readRecord.equals(record) == false)
{
System.out.println("Record: " + i + " did not match\n" + record + "\n" + readRecord);
sbcPassed = false;
}
}
}

assertTrue("Unicode EOS character test failed. See mismatches above.", unicodePassed);
assertTrue("Single byte EOS character test failed. See mismatches above.", sbcPassed);
}

@Test
Expand Down Expand Up @@ -1406,6 +1425,11 @@ public List<HPCCRecord> readFile(HPCCFile file, Integer connectTimeoutMillis, bo
HpccRemoteFileReader<HPCCRecord> fileReader = fileReaders.get(i);
while (fileReader.hasNext())
{
if (records.size() == 558)
{
System.out.println("Record count: " + records.size());
}

HPCCRecord record = fileReader.next();
if (record == null)
{
Expand Down Expand Up @@ -1510,6 +1534,11 @@ private void writeFileAndReportAnyExceptions(List<HPCCRecord> records, String fi

for (int j = 0; j < numRecordsInPartition; j++, currentRecord++)
{
if (currentRecord == 558)
{
System.out.println("Record count: " + currentRecord);
}

fileWriter.writeRecord(records.get(currentRecord));
}
fileWriter.close();
Expand Down
Loading