DBZ-4 Changed copyright statement in source code headers and adjusted checkstyle rules.

This commit is contained in:
Randall Hauch 2016-01-26 12:40:31 -06:00
parent ddf61cec46
commit 4c538d4e54
96 changed files with 172 additions and 159 deletions

View File

@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.org/debezium/debezium.svg?branch=master)](https://travis-ci.org/debezium/debezium)
[![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
Copyright 2008-2016 Debezium Authors. Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
Copyright Debezium Authors. Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
# Debezium

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -12,18 +12,20 @@
/**
* An immutable representation of a data type
*
* @author Randall Hauch
*/
@Immutable
public final class DataType {
/**
* Obtain the data type for a user-defined or fully-qualified type name.
*
* @param qualifiedName the fully-qualified name; may not be null
* @return the data type; never null
*/
public static DataType userDefinedType( String qualifiedName ) {
return new DataType(qualifiedName,qualifiedName,Types.OTHER,-1,-1,null,0);
public static DataType userDefinedType(String qualifiedName) {
return new DataType(qualifiedName, qualifiedName, Types.OTHER, -1, -1, null, 0);
}
private final String expression;
@ -32,44 +34,44 @@ public static DataType userDefinedType( String qualifiedName ) {
private final long length;
private final int scale;
private final int[] arrayDimensions;
protected DataType( String expr, String name, int jdbcType, long length, int scale, int[] arrayDimensions, int arrayDimLength ) {
protected DataType(String expr, String name, int jdbcType, long length, int scale, int[] arrayDimensions, int arrayDimLength) {
this.expression = expr;
this.name= name;
this.name = name;
this.jdbcType = jdbcType;
this.length = length;
this.scale = scale;
if ( arrayDimensions == null || arrayDimLength == 0 ) {
if (arrayDimensions == null || arrayDimLength == 0) {
this.arrayDimensions = null;
} else {
this.arrayDimensions = Arrays.copyOf(arrayDimensions, arrayDimLength);
}
}
public String expression() {
return expression;
}
public String name() {
return name;
}
public int jdbcType() {
return jdbcType;
}
public long length() {
return length;
}
public int scale() {
return scale;
}
public int[] arrayDimensions() {
return arrayDimensions;
}
@Override
public String toString() {
return expression;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -19,10 +19,14 @@
import io.debezium.text.TokenStream.Marker;
/**
* A parser of SQL data types. Callers set up a parser and register patterns that describe the possible lists of tokens, and then
* can repeatedly {@link #parse(TokenStream, Consumer) parse} {@link TokenStream streams of tokens} looking for matches.
* A parser of SQL data types. Callers set up a parser and register patterns that describe the possible lists of data type tokens,
* and then repeatedly {@link #parse(TokenStream, Consumer) parse} {@link TokenStream streams of tokens} looking for matches.
* <p>
* This is typically used within a {@link DdlParser} implementation to parse and identify data types appearing within a stream
* of DDL content.
*
* @author Randall Hauch
* @see DdlParser
*/
@ThreadSafe
public class DataTypeParser {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -33,6 +33,8 @@
* A parser for DDL statements.
*
* @author Randall Hauch
* @author Horia Chiorean
* @author Barry LaFond
*/
@NotThreadSafe
public class DdlParser {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -13,8 +13,12 @@
import io.debezium.text.TokenStream.Tokens;
/**
* A {@link Tokenizer} that is specialized for tokenizing DDL streams.
*
* @author Randall Hauch
*
* @author Horia Chiorean
* @author Barry LaFond
* @author Jure Kajzer
*/
public class DdlTokenizer implements Tokenizer {
@ -56,7 +60,6 @@ public class DdlTokenizer implements Tokenizer {
* <p>
* Examples would be: "CREATE", "TABLE", "ALTER", "SCHEMA", "DROP", etc...
* </p>
* see {@link DdlConstants} for the default SQL 92 representations.
*/
public static final int KEYWORD = 64;
@ -66,7 +69,6 @@ public class DdlTokenizer implements Tokenizer {
* <p>
* Examples would be: {"CREATE", "TABLE"} {"CREATE", "OR", "REPLACE", "VIEW"}
* </p>
* see {@link DdlConstants} for the default SQL 92 representations.
*/
public static final int STATEMENT_KEY = 128;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -7,6 +7,8 @@
/**
* An exception representing a problem during parsing of text.
*
* @author Randall Hauch
*/
public class ParsingException extends RuntimeException {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -9,6 +9,8 @@
/**
* A class that represents the position of a particular character in terms of the lines and columns of a character sequence.
*
* @author Randall Hauch
*/
@Immutable
public final class Position {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -337,6 +337,9 @@
* {@link Tokenizer}s with exactly this behavior can actually be created using the {@link #basicTokenizer(boolean)} method. So
* while this very basic implementation is not meant to be used in all situations, it may be useful in some situations.
* </p>
* @author Randall Hauch
* @author Horia Chiorean
* @author Daniel Kelleher
*/
@NotThreadSafe
public class TokenStream {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -13,6 +13,8 @@
/**
* A utility class for determining the validity of various XML names, per the <a href="http://www.w3.org/TR/REC-xml/">XML 1.0
* Specification</a>.
*
* @author Randall Hauch
*/
@Immutable
public class XmlCharacters {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -15,10 +15,10 @@
*/
@Immutable
public class HashCode {
// Prime number used in improving distribution
private static final int PRIME = 103;
/**
* Compute a combined hash code from the supplied objects. This method always returns 0 if no objects are supplied.
*
@ -26,9 +26,9 @@ public class HashCode {
* @return the hash code
*/
public static int compute(Object... objects) {
return _compute(0, objects);
return computeHashCode(0, objects);
}
/**
* Compute a combined hash code from the supplied objects using the supplied seed.
*
@ -36,8 +36,8 @@ public static int compute(Object... objects) {
* @param objects the objects that should be used to compute the hash code
* @return the hash code
*/
private static int _compute(int seed,
Object... objects) {
private static int computeHashCode(int seed,
Object... objects) {
if (objects == null || objects.length == 0) {
return seed * HashCode.PRIME;
}
@ -69,8 +69,8 @@ private static int _compute(int seed,
}
return hc;
}
private HashCode() {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -164,7 +164,7 @@ public static String read(InputStream stream) throws IOException {
* reading.
*
* @param stream the streamed contents; may be null
* @param charset charset of the stream data; may not be null
* @param charset character set of the stream data; may not be null
* @return the contents, or an empty string if the supplied stream is null
* @throws IOException if there is an error reading the content
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -18,6 +18,7 @@
* String-related utility methods.
*
* @author Randall Hauch
* @author Horia Chiorean
*/
@ThreadSafe
public final class Strings {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -9,6 +9,9 @@
import static org.fest.assertions.Assertions.assertThat;
/**
* @author Randall Hauch
*/
public class PositionTest {
private int combinedIndex(int firstIndex,

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -15,6 +15,10 @@
import io.debezium.text.TokenStream.BasicTokenizer;
import io.debezium.text.TokenStream.Tokenizer;
/**
* @author Randall Hauch
* @author Daniel Kelleher
*/
public class TokenStreamTest {
public static final int WORD = TokenStream.BasicTokenizer.WORD;
public static final int SYMBOL = TokenStream.BasicTokenizer.SYMBOL;
@ -44,25 +48,25 @@ public void makeCaseInsensitive() {
tokens.start();
}
@Test( expected = IllegalStateException.class )
@Test(expected = IllegalStateException.class)
public void shouldNotAllowConsumeBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.consume("Select");
}
@Test( expected = IllegalStateException.class )
@Test(expected = IllegalStateException.class)
public void shouldNotAllowHasNextBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.hasNext();
}
@Test( expected = IllegalStateException.class )
@Test(expected = IllegalStateException.class)
public void shouldNotAllowMatchesBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.matches("Select");
}
@Test( expected = IllegalStateException.class )
@Test(expected = IllegalStateException.class)
public void shouldNotAllowCanConsumeBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.canConsume("Select");
@ -88,7 +92,7 @@ public void shouldConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingExac
assertThat(tokens.hasNext()).isFalse();
}
@Test( expected = ParsingException.class )
@Test(expected = ParsingException.class)
public void shouldFailToConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingIncorrectCase() {
makeCaseSensitive();
tokens.consume("Select");
@ -108,7 +112,7 @@ public void shouldConsumeInCaseInsensitiveMannerWithExpectedValuesWhenMatchingNo
assertThat(tokens.hasNext()).isFalse();
}
@Test( expected = ParsingException.class )
@Test(expected = ParsingException.class)
public void shouldFailToConsumeInCaseInsensitiveMannerWithExpectedValuesWhenMatchingStringIsInLowerCase() {
makeCaseInsensitive();
tokens.consume("SELECT");
@ -311,7 +315,7 @@ public void shouldConsumeMultipleTokensIfTheyMatch() {
assertThat(tokens.hasNext()).isFalse();
}
@Test( expected = ParsingException.class )
@Test(expected = ParsingException.class)
public void shouldFailToConsumeMultipleTokensIfTheyDoNotMatch() {
makeCaseInsensitive();
tokens.consume("SELECT", "ALL", "COLUMNS", "FROM", "TABLE");
@ -327,8 +331,8 @@ public void shouldReturnTrueFromCanConsumeMultipleTokensIfTheyAllMatch() {
@Test
public void shouldReturnTrueFromCanConsumeArrayOfTokensIfTheyAllMatch() {
makeCaseInsensitive();
assertThat(tokens.matches(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})).isTrue();
assertThat(tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})).isTrue();
assertThat(tokens.matches(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })).isTrue();
assertThat(tokens.canConsume(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })).isTrue();
assertThat(tokens.hasNext()).isFalse();
}
@ -417,7 +421,7 @@ public void shouldCanConsumeSingleAfterTokensCompleteFromCanConsumeStringList()
public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() {
makeCaseInsensitive();
// consume ALL the tokens using canConsume()
tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"});
tokens.canConsume(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" });
// try to canConsume() single word
assertThat(tokens.canConsume("SELECT")).isFalse();
assertThat(tokens.canConsume(TokenStream.ANY_VALUE)).isFalse();
@ -428,7 +432,7 @@ public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray()
public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringIterator() {
makeCaseInsensitive();
// consume ALL the tokens using canConsume()
tokens.canConsume(Arrays.asList(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"}));
tokens.canConsume(Arrays.asList(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" }));
// try to canConsume() single word
assertThat(tokens.canConsume("SELECT")).isFalse();
assertThat(tokens.canConsume(TokenStream.ANY_VALUE)).isFalse();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -9,6 +9,9 @@
import static org.fest.assertions.Assertions.assertThat;
/**
* @author Randall Hauch
*/
public class XmlCharactersTest {
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -11,6 +11,9 @@
import org.junit.Test;
/**
* @author Randall Hauch
*/
public class HashCodeTest {
@Test

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -14,6 +14,10 @@
import org.junit.Test;
/**
* @author Randall Hauch
* @author Horia Chiorean
*/
public class StringsTest {
public void compareSeparatedLines( Object... lines ) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@ -13,19 +13,15 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.regex.Pattern;
public class Header extends com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck {
private static final String YEAR_MATCHING_PATTERN = "${YYYY}";
private Set<String> excludedFileSet;
private String excludedFilesRegex;
private Pattern excludedFilesPattern;
private final String workingDirPath = new File(".").getAbsoluteFile().getParentFile().getAbsolutePath();
private final int workingDirPathLength = workingDirPath.length();
private Predicate<String> yearLineMatcher;
public Header() {
}
@ -63,11 +59,6 @@ public void setHeaderFile( String aFileName ) {
if (l == null) {
break;
}
if (l.contains(YEAR_MATCHING_PATTERN)) {
String prefix = l.substring(0, l.indexOf(YEAR_MATCHING_PATTERN));
String suffix = l.substring(l.indexOf(YEAR_MATCHING_PATTERN)+YEAR_MATCHING_PATTERN.length());
yearLineMatcher = (line)->line.startsWith(prefix) && line.endsWith(suffix);
}
sb.append(l).append("\\n");
}
super.setHeader(sb.toString());
@ -100,19 +91,4 @@ protected void processFiltered( File aFile,
if (isExcluded(aFile)) return;
super.processFiltered(aFile, aLines);
}
/**
* Checks if a code line matches the required header line.
* @param lineNumber the line number to check against the header
* @param line the line contents
* @return true if and only if the line matches the required header line
*/
@Override
protected boolean isMatch(int lineNumber, String line) {
if ( super.isMatch(lineNumber, line)) return true;
// Otherwise it does not match, so see if the line contain our "${year}" string
if ( yearLineMatcher != null && yearLineMatcher.test(line) ) return true;
return false;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright ${YYYY} Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@ -7,7 +7,7 @@
id="org.eclipse.jdt.ui.text.codetemplates.filecomment"
name="filecomment">
/*
* Copyright 2016 Debezium Authors.
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/