Skip to content

Commit

Permalink
KYLO-1288: change services to be guava 23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
harschware committed Jan 4, 2018
1 parent 064e693 commit 6967cc8
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 5 deletions.
30 changes: 30 additions & 0 deletions commons/commons-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,36 @@
<target>${java.version}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<roots>
<root>src/main/java</root>
<root>src/test</root>
</roots>
<excludes>
<exclude>**/PredicateImpl.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<roots>
<root>src/main/java</root>
<root>src/test/java</root>
</roots>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thinkbiganalytics.guava;

import com.google.common.base.Predicate;

/**
* Abstract implementation of {@link com.google.common.base.Predicate}.
*
* <p>Derived class needs to implement the {@link #test} method.
*
* <p>Helps with the transition to {@code java.util.function.Predicate},
* which was introduced in JDK 1.8, and is required in Guava 21.0 and higer,
* but still works on JDK 1.7.
*
* @param <T> the type of the input to the predicate
* @implNote Copied from Apache licensed org/apache/calcite/runtime/PredicateImpl.java
*/
public abstract class PredicateImpl<T> implements Predicate<T> {
public final boolean apply(T input) {
return test(input);
}

/** Overrides {@code java.util.function.Predicate#test} in JDK8 and higher. */
public abstract boolean test( T t);
}
12 changes: 12 additions & 0 deletions license.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
<@antlrLicense/>
<#elseif project.groupId == "org.bouncycastle">
<@bouncyCastleLicense/>
<#elseif project.groupId == "org.codehaus.mojo" && project.artifactId == "animal-sniffer-annotations">
<@animalSnifferLicense/>
<#elseif project.groupId == "org.codehaus.jettison">
<@apache2License/>
<#elseif project.groupId == "org.codehaus.woodstox">
Expand Down Expand Up @@ -228,6 +230,16 @@ Copyright (c) 2000 - 2016 The Legion of the Bouncy Castle Inc. (https://www.boun
<@mitLicense/>
</#macro>

<#-- Bouncy Castle License -->
<#macro animalSnifferLicense>
<@projectInfo project/>

Copyright (c) 2009 codehaus.org.

<@mitLicense/>
</#macro>


<#-- BSD 3-Clause License -->
<#macro bsd3License>
Redistribution and use in source and binary forms, with or without
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* #L%
*/

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.thinkbiganalytics.guava.PredicateImpl;
import com.thinkbiganalytics.policy.AvailablePolicies;
import com.thinkbiganalytics.policy.PolicyTransformException;
import com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule;
Expand Down Expand Up @@ -115,9 +115,9 @@ public void testSimpleRegexReplacer() throws IOException {
@Test
public void testUiCreation() {
List<FieldStandardizationRule> standardizationRules = AvailablePolicies.discoverStandardizationRules();
FieldStandardizationRule defaultValue = Iterables.tryFind(standardizationRules, new Predicate<FieldStandardizationRule>() {
FieldStandardizationRule defaultValue = Iterables.tryFind(standardizationRules, new PredicateImpl<FieldStandardizationRule>() {
@Override
public boolean apply(FieldStandardizationRule fieldStandardizationRule) {
public boolean test(FieldStandardizationRule fieldStandardizationRule) {
return fieldStandardizationRule.getName().equalsIgnoreCase("Default Value");
}
}).orNull();
Expand Down
8 changes: 6 additions & 2 deletions services/service-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<plugin.license.parentRelative>../../</plugin.license.parentRelative>
<guava.version>23.0</guava.version>
</properties>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -496,7 +501,6 @@

</dependencies>


<build>

<resources>
Expand Down

0 comments on commit 6967cc8

Please sign in to comment.