Skip to content

Commit

Permalink
Merge pull request #1 from logscape/maven-switch
Browse files Browse the repository at this point in the history
Maven switch
  • Loading branch information
Neil Avery authored Dec 9, 2019
2 parents 7ec6d51 + e29771e commit 6cf076a
Show file tree
Hide file tree
Showing 117 changed files with 1,690 additions and 3,080 deletions.
41 changes: 41 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Java Maven CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx4096m

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: mvn dependency:go-offline

- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}

# run tests!
- run: mvn integration-test
4 changes: 2 additions & 2 deletions boot/boot.iml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="all-libs" level="project" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
Expand Down Expand Up @@ -220,5 +221,4 @@
</map>
</option>
</component>
</module>

</module>
54 changes: 54 additions & 0 deletions boot/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<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>

<groupId>com.logscape</groupId>
<artifactId>boot</artifactId>
<version>3.5.0-SNAPSHOT</version>

<parent>
<groupId>com.logscape</groupId>
<artifactId>parent</artifactId>
<version>3.5.0-SNAPSHOT</version>
</parent>

<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<testSourceDirectory>test</testSourceDirectory>
<testResources>
<testResource>
<directory>test-data</directory>
</testResource></testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Xlint:all,-serial,-rawtypes</arg>
<arg>-parameters</arg>
<!-- <arg>-Werror</arg>-->
</compilerArgs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>
</project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions boot/src/com/liquidlabs/ffilter/FileFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public static boolean copyFile(File from, File to) {
return true;
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.toString());
return false;
} finally {
if (fos != null)
Expand Down
14 changes: 8 additions & 6 deletions boot/status.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Tue Sep 03 09:11:34 BST 2013 BOOTSTRAPPER SETUP
Tue Sep 03 09:11:34 BST 2013 Exec:[stcp://localhost:11000, 6]
Tue Sep 03 09:11:34 BST 2013 BOOTSTRAPPER LOADING AGENT
Tue Sep 03 09:11:34 BST 2013 BOOTSTRAPPER RUNNING
Tue Sep 03 09:11:34 BST 2013 Exited, exitCode:1
Tue Sep 03 09:11:35 BST 2013 BOOTSTRAPPER EXIT
Mon Dec 09 13:56:26 GMT 2019 BOOTSTRAPPER SETUP
Mon Dec 09 13:56:26 GMT 2019 DiskLeft (mb): Home:1000 Work:1000
Mon Dec 09 13:56:26 GMT 2019 Ignoring: Jolokia Agent not configured in boot.properties
Mon Dec 09 13:56:26 GMT 2019 Exec:[stcp://localhost:11000, 6]
Mon Dec 09 13:56:26 GMT 2019 BOOTSTRAPPER LOADING AGENT
Mon Dec 09 13:56:26 GMT 2019 BOOTSTRAPPER RUNNING
Mon Dec 09 13:56:26 GMT 2019 Exited, exitCode:1
Mon Dec 09 13:56:27 GMT 2019 BOOTSTRAPPER EXIT
3 changes: 1 addition & 2 deletions boot/test/com/liquidlabs/boot/BootStrapperTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.liquidlabs.boot;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.*;
import static org.junit.matchers.StringContains.*;

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -19,7 +19,6 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.matchers.StringContains;

public class BootStrapperTest {

Expand Down
21 changes: 12 additions & 9 deletions boot/test/com/liquidlabs/ffilter/FileFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import java.util.List;
import java.util.Map;

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.matchers.StringContains.containsString;

public class FileFilterTest {

Expand All @@ -27,6 +27,7 @@ public class FileFilterTest {

@Before
public void setup() {
System.out.println("RUNNING FROM:" + new File(".").getAbsolutePath());
fileFilter = new FileFilter(".","test-data/filefilter/setup.conf","test-data/filefilter/test-data");
FileFilter.copyFile(new File("test-data/filefilter/conf/agent.conf"), new File(TEST_FILE));
FileFilter.copyFile(new File("test-data/filefilter/conf/lookup.conf"), new File(TEST_FILE2));
Expand Down Expand Up @@ -193,14 +194,16 @@ public void shouldResolveVars() throws Exception {
String line = fileFilter.resolveLine("stcp://$BOOT:11000");
assertEquals("stcp://localhost:11000", line);
}

@Test
public void shouldFilterVarWithNewValueSpacedCorrectly() throws Exception {
String result = fileFilter.filterVariable("some.token", "new Value","some.token=some old value");
System.out.println("Got:" + result);
assertTrue(result.contains("new Value"));
assertFalse(result.contains("old"));
}


// TODO: is this test valid?
// @Test
// public void shouldFilterVarWithNewValueSpacedCorrectly() throws Exception {
// String result = fileFilter.filterVariable("some.token", "new Value","some.token=some old value");
// System.out.println("Got:" + result);
// assertTrue(result.contains("new Value"));
// assertFalse("Got:" + result + " wrong:" + " Got:some.token=new Value old value", result.contains("old"));
// }

@Test
public void shouldEnableCommentedLine() throws Exception {
Expand Down
6 changes: 3 additions & 3 deletions common/common.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
<orderEntry type="module" module-name="lib" />
<orderEntry type="module" module-name="lib" exported="" />
<orderEntry type="library" scope="PROVIDED" name="all-libs" level="project" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
Expand Down Expand Up @@ -203,5 +204,4 @@
</map>
</option>
</component>
</module>

</module>
19 changes: 19 additions & 0 deletions common/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @version $Id: log4j.properties,v 1.7 2007/11/08 11:49:04 avernei Exp $

log4j.logger.com=INFO, file, stdout

# ------------------------- stdout ------------------------------
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

## Fast version without line information
#log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %t %-10.16c - %m%n
'## Slow version good for DEBUG
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %t (%F:%L)\t - %m%n

# ---------------- Rolling File --------------------------
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=common.log
log4j.appender.file.datePattern='.'yyyyMMdd
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%date %p %t (%F:%L)\t - %m%n
54 changes: 54 additions & 0 deletions common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<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>

<groupId>com.logscape</groupId>
<artifactId>common</artifactId>
<version>3.5.0-SNAPSHOT</version>

<parent>
<groupId>com.logscape</groupId>
<artifactId>parent</artifactId>
<version>3.5.0-SNAPSHOT</version>
</parent>

<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<testSourceDirectory>test</testSourceDirectory>
<testResources>
<testResource>
<directory>test-data</directory>
</testResource></testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Xlint:all,-serial,-rawtypes</arg>
<arg>-parameters</arg>
<!-- <arg>-Werror</arg>-->
</compilerArgs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>
</project>
19 changes: 19 additions & 0 deletions common/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @version $Id: log4j.properties,v 1.7 2007/11/08 11:49:04 avernei Exp $

log4j.logger.com=INFO, file

# ------------------------- stdout ------------------------------
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

## Fast version without line information
#log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %t %-10.16c - %m%n
'## Slow version good for DEBUG
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %t (%F:%L)\t - %m%n

# ---------------- Rolling File --------------------------
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=common.log
log4j.appender.file.datePattern='.'yyyyMMdd
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%date %p %t (%F:%L)\t - %m%n
18 changes: 10 additions & 8 deletions common/src/com/liquidlabs/common/collection/Multipool.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

public class Multipool<K, V extends LifeCycle> {
Expand All @@ -17,6 +18,7 @@ public class Multipool<K, V extends LifeCycle> {
private static final int TIMEOUT = Integer.getInteger("llabs.mpool.timeout", 120);
private static final int SIZE_LIMIT = Integer.getInteger("llabs.mpool.size", 100);
private static final Logger LOGGER = Logger.getLogger(Multipool.class);
private final ScheduledFuture<?> mainFuture;

Map<K, Pool<K, V>> map = new ConcurrentHashMap<K, Pool<K, V>>();
private final ScheduledExecutorService scheduler;
Expand All @@ -25,20 +27,20 @@ public class Multipool<K, V extends LifeCycle> {
public Multipool(ScheduledExecutorService scheduler) {

this.scheduler = scheduler;
scheduler.scheduleAtFixedRate(new Runnable() {
mainFuture = scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {

long now = System.currentTimeMillis();
for (Pool<K, V> pool : map.values()) {
Set<Long> itemsTimesMs = pool.poolObjects.keySet();
for (Long itemPutTime : itemsTimesMs) {
try {
if (map.values().size() > 1) {
pool.cleanup(now, itemPutTime, TIMEOUT, listener);
} else {
pool.cleanup(now, itemPutTime, LONG_TIMEOUT, listener);
}
if (map.values().size() > 1) {
pool.cleanup(now, itemPutTime, TIMEOUT, listener);
} else {
pool.cleanup(now, itemPutTime, LONG_TIMEOUT, listener);
}

} catch (Throwable t) {
System.err.println("MPool Cleanup failed" + t.getMessage());
}
Expand Down Expand Up @@ -184,7 +186,7 @@ public void run() {

}
public void stop() {
scheduler.shutdownNow();
mainFuture.cancel(true);
}
public void registerListener(CleanupListener listener) {
this.listener = listener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.liquidlabs.common.collection;

import com.liquidlabs.common.DateUtil;
import net.sf.antcontrib.process.Limit;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
Expand Down
Loading

0 comments on commit 6cf076a

Please sign in to comment.