Skip to content

Commit

Permalink
Added test case supporting issue FasterXML#35
Browse files Browse the repository at this point in the history
  • Loading branch information
anandshah123 committed Feb 18, 2016
1 parent 66ae8b1 commit 7240246
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 78 deletions.
198 changes: 120 additions & 78 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,87 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-parent</artifactId>
<version>2.7</version>
</parent>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-avro</artifactId>
<name>Jackson-dataformat-Avro</name>
<version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>Support for reading and writing AVRO-encoded data via Jackson
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-parent</artifactId>
<version>2.7</version>
</parent>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-avro</artifactId>
<name>Jackson-dataformat-Avro</name>
<version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>Support for reading and writing AVRO-encoded data via Jackson
abstractions.
</description>
<url>http://wiki.fasterxml.com/JacksonExtensionAVRO</url>
<scm>
<connection>scm:git:[email protected]:FasterXML/jackson-dataformat-avro.git</connection>
<developerConnection>scm:git:[email protected]:FasterXML/jackson-dataformat-avro.git</developerConnection>
<url>http://github.com/FasterXML/jackson-dataformat-avro</url>
<tag>HEAD</tag>
</scm>
<url>http://wiki.fasterxml.com/JacksonExtensionAVRO</url>
<scm>
<connection>scm:git:[email protected]:FasterXML/jackson-dataformat-avro.git</connection>
<developerConnection>scm:git:[email protected]:FasterXML/jackson-dataformat-avro.git</developerConnection>
<url>http://github.com/FasterXML/jackson-dataformat-avro</url>
<tag>HEAD</tag>
</scm>

<properties>
<version.jackson.core>2.7.1</version.jackson.core>
<properties>
<version.jackson.core>2.7.1</version.jackson.core>

<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/dataformat/avro</packageVersion.dir>
<packageVersion.package>${project.groupId}.avro</packageVersion.package>
</properties>
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/dataformat/avro</packageVersion.dir>
<packageVersion.package>${project.groupId}.avro</packageVersion.package>
</properties>

<dependencies>
<!-- Extends Jackson core; uses avro libs for parsing, generation -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${version.jackson.core}</version>
</dependency>
<!-- Hmmh. Need databind for Avro Schema generation... -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${version.jackson.core}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.7.7</version>
</dependency>
<dependencies>
<!-- Extends Jackson core; uses avro libs for parsing, generation -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${version.jackson.core}</version>
</dependency>
<!-- Hmmh. Need databind for Avro Schema generation... -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${version.jackson.core}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.7.7</version>
</dependency>

<!-- and for testing we need annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- and for testing we need annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin> <!-- prevent build fail due to known failing tests (if any) -->
<groupId>org.apache.maven.plugins</groupId>
<!--
<version>${version.plugin.surefire}</version>
-->
<version>${version.plugin.surefire}</version>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/fasterxml/jackson/dataformat/avro/failing/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin><!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.7.4</version>
<executions>
<execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
<configuration>
<excludes>
<exclude>**/mapred/tether/**</exclude>
</excludes>
<testSourceDirectory>src/test/resources/com/fasterxml/jackson/dataformat/avro</testSourceDirectory>
<testOutputDirectory>target/generated-sources</testOutputDirectory>
<fieldVisibility>private</fieldVisibility>
<stringType>String</stringType>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <!-- prevent build fail due to known failing tests (if any) -->
<groupId>org.apache.maven.plugins</groupId>
<!-- <version>${version.plugin.surefire}</version> -->
<version>${version.plugin.surefire}</version>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/fasterxml/jackson/dataformat/avro/failing/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin><!-- Inherited from oss-base. Generate PackageVersion.java. -->
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.fasterxml.jackson.dataformat.avro;

import com.demonstration.Event;
import com.demonstration.EventID;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Issue35Test extends AvroTestBase {

public void testWriteBidResponse() throws JsonProcessingException {
Event event = new Event();
event.setPlayerCount(100);
EventID id = new EventID();
id.setFirst(10);
ObjectMapper mapper = new ObjectMapper(new AvroFactory());
byte[] bytes = mapper.writer(new AvroSchema(Event.SCHEMA$)).writeValueAsBytes(event);
assertNotNull(bytes);
}
}

0 comments on commit 7240246

Please sign in to comment.