Skip to content

Commit

Permalink
AVRO-3403: Fix bug on Travis
Browse files Browse the repository at this point in the history
The build on Travis compiles files in a different order, causing the
tested new log lines to appear in the 'wrong' order. This removes these
new log lines.
  • Loading branch information
opwvhk committed Mar 22, 2022
1 parent edeee10 commit 5d85cd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.avro.Protocol;
import org.apache.avro.Schema;
import org.apache.avro.compiler.specific.SpecificCompiler;
import org.apache.avro.generic.GenericData;

Expand Down Expand Up @@ -91,12 +89,8 @@ protected void doCompile(String filename, File sourceDirectory, File outputDirec
for (String warning : idlFile.getWarnings()) {
getLog().warn(warning);
}
final SpecificCompiler compiler;
final Protocol protocol = idlFile.getProtocol();
getLog().info("Compiling protocol: " + protocol.getNamespace() + "." + protocol.getName());
getLog().info(
"Schema names: " + protocol.getTypes().stream().map(Schema::getFullName).collect(Collectors.joining(", ")));
compiler = new SpecificCompiler(protocol);
final SpecificCompiler compiler = new SpecificCompiler(protocol);
compiler.setStringType(GenericData.StringType.valueOf(stringType));
compiler.setTemplateDir(templateDirectory);
compiler.setFieldVisibility(getFieldVisibility());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.junit.Test;

import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -52,11 +53,8 @@ public void testIdlProtocolMojo() throws Exception {
final String idlUserContent = FileUtils.fileRead(new File(outputDir, "IdlUser.java"));
assertTrue(idlUserContent.contains("java.time.Instant"));

assertEquals(asList("[INFO] Compiling protocol: test.IdlTest", "[INFO] Schema names: test.IdlPrivacy, test.IdlUser",
"[WARN] Line 22, char 5: Ignoring out-of-place documentation comment.\n"
+ "Did you mean to use a multiline comment ( /* ... */ ) instead?",
"[INFO] Compiling protocol: test.IdlClasspathImportTest",
"[INFO] Schema names: test.IdlPrivacy, test.IdlUser, test.IdlUserWrapper"), log.getLogEntries());
assertEquals(Collections.singletonList("[WARN] Line 22, char 5: Ignoring out-of-place documentation comment.\n"
+ "Did you mean to use a multiline comment ( /* ... */ ) instead?"), log.getLogEntries());
}

@Test
Expand Down

0 comments on commit 5d85cd1

Please sign in to comment.