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

Update dependencies and make build pass on JDK14 #163

Merged
merged 9 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
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
41 changes: 38 additions & 3 deletions blazingcache-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<version>4.2.1</version>
<inherited>true</inherited>
<extensions>true</extensions>
</plugin>
Expand Down Expand Up @@ -70,6 +70,10 @@
<artifactId>jms</artifactId>
<groupId>javax.jms</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>io.netty</groupId>
</exclusion>
<exclusion>
<artifactId>jmxtools</artifactId>
<groupId>com.sun.jdmk</groupId>
Expand All @@ -84,11 +88,25 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- needed for ZK server -->
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>${libs.metrics}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- needed for ZK server -->
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>${libs.snappy}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minikdc</artifactId>
<version>3.1.1</version>
<version>${libs.minikdc}</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -100,7 +118,24 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>${libs.commonsio}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${libs.curator}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${libs.slf4j}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>${libs.slf4j}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private Subject loginClient() throws SaslException, PrivilegedActionException, L
String clientSection = "BlazingCacheClient";
AppConfigurationEntry[] entries = Configuration.getConfiguration().getAppConfigurationEntry(clientSection);
if (entries == null) {
LOG.log(Level.SEVERE, "No JAAS Configuration found with section BlazingCacheClient");
LOG.log(Level.INFO, "No JAAS Configuration found with section BlazingCacheClient");
return null;
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class JVMServersRegistry {
private static String lastRegisteredServer = "";

public static void registerServer(String id, CacheServer broker) {
LOGGER.log(Level.SEVERE, "registerServer {0}", id);
LOGGER.log(Level.INFO, "registerServer {0}", id);
servers.put(id, broker);
lastRegisteredServer = id;
}
Expand Down

This file was deleted.

18 changes: 13 additions & 5 deletions blazingcache-core/src/test/java/blazingcache/ZKTestEnv.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package blazingcache;

import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import org.apache.curator.test.InstanceSpec;
import org.apache.curator.test.TestingServer;

public class ZKTestEnv implements AutoCloseable {

TestingZookeeperServerEmbedded zkServer;

Path path;
final TestingServer zkServer;

public ZKTestEnv(final Path path) throws Exception {
zkServer = new TestingZookeeperServerEmbedded(1281, path.toFile());
Map<String, Object> customProperties = new HashMap<>();
customProperties.put("authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
customProperties.put("kerberos.removeHostFromPrincipal", "true");
customProperties.put("kerberos.removeRealmFromPrincipal", "true");
customProperties.put("syncEnabled", "false");
InstanceSpec spec = new InstanceSpec(path.toFile(), 1111, 2222, 2223, false, 1, 1000, 100,
customProperties, "localhost");
zkServer = new TestingServer(spec, false);
zkServer.start();
this.path = path;
}

public String getAddress() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Licensed to Diennea S.r.l. under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Diennea S.r.l. 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 blazingcache.server;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.junit.Assert;


public class CountdownWatcher implements Watcher {

protected static final Logger LOG = Logger.getLogger("" + CountdownWatcher.class);
private final String name;
private CountDownLatch clientConnected;
private Event.KeeperState state;
private boolean connected;
private boolean expired;

public CountdownWatcher(String name) {
this.name = name;
reset();
}

private synchronized void reset() {
clientConnected = new CountDownLatch(1);
state = Event.KeeperState.Disconnected;
connected = false;
expired = false;
}

public void process(WatchedEvent event) {
LOG.info("Watcher " + name + " got event " + event);
setState(event.getState());
setConnected(true);
clientConnected.countDown();
if (event.getState() == Event.KeeperState.Expired) {
expired = true;
}
}

public synchronized boolean isConnected() {
return connected;
}

public synchronized boolean isExpired() {
return expired;
}

public synchronized Event.KeeperState state() {
return state;
}

public void setState(Event.KeeperState state) {
this.state = state;
}

public void setConnected(boolean connected) {
this.connected = connected;
}

public void setExpired(boolean expired) {
this.expired = expired;
}

public void waitForConnected(long timeout) throws InterruptedException, TimeoutException {
Assert.assertTrue(clientConnected.await(timeout, TimeUnit.MILLISECONDS));
}

public void waitForExpired(long timeout) throws InterruptedException, TimeoutException {
long expire = System.currentTimeMillis() + timeout;
long left = timeout;
while (!isExpired() && left > 0) {
Thread.sleep(left);
left = expire - System.currentTimeMillis();
}
if (!isConnected()) {
throw new TimeoutException("Did not disconnect");
}
}

}
Loading