Skip to content

Commit

Permalink
fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcclean committed Nov 11, 2018
1 parent b80d6b5 commit 4b77cf9
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public RegistryHealthChecker(final List<HealthStatusChecker> status) {

public boolean isOk() {
return status.map(HealthStatusChecker::isOk)
.reduce(Monoid.of(true, Semigroups.booleanConjunction));
.foldLeft(Monoid.of(true, Semigroups.booleanConjunction));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public class ConfigureSchedulingAsyncDataLoader {
private ListX<DataLoader> dataLoaders() {
SetX<ManifestComparator> comparatorSet = SetX.fromIterable(dataLoaders)
.map(dl -> dl.comparator);
return ReactiveSeq.fromIterable(defaultComparators)
.filter(i -> !comparatorSet.contains(i))
.map(mc -> new DataLoader(mc, defaultCron))
.appendS(dataLoaders.stream())
.toListX();
return ListX.fromIterable(defaultComparators)
.filter(i -> !comparatorSet.contains(i))
.map(mc -> new DataLoader(mc, defaultCron))
.appendAll(dataLoaders)
.toListX();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ public class MultiDataWriter<T> implements DataWriter<T> {
@Override
public Future<T> loadAndGet() {
return comparators.map(c -> c.loadAndGet())
.reduce((acc, next) -> acc.combine(next, (v1, v2) -> v1))
.foldLeft((acc, next) -> acc.zip(next, (v1, v2) -> v1))
.orElse(Future.ofResult(null));
}

@Override
public Future<Void> saveAndIncrement(T data) {
return comparators.map(c -> c.saveAndIncrement(data))
.reduce((acc, next) -> acc.combine(next, (v1, v2) -> v1))
.foldLeft((acc, next) -> acc.zip(next, (v1, v2) -> v1))
.orElse(Future.ofResult(null));
}

@Override
public Future<Boolean> isOutOfDate() {
return comparators.map(c -> c.isOutOfDate())
.reduce((acc, next) -> acc.combine(next, (v1, v2) -> v1 || v2))
.foldLeft((acc, next) -> acc.zip(next, (v1, v2) -> v1 || v2))
.orElse(Future.ofResult(false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public String bucket() {
public String get() {

return comparator.loadAndGet()
.visit(s->s,e->"Error loading " + e.getMessage());
.fold(s->s,e->"Error loading " + e.getMessage());

}

Expand Down
1 change: 1 addition & 0 deletions micro-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {
testCompile project(':micro-grizzly')
testCompile project(':micro-jersey')
testCompile project(':micro-events')
testCompile "com.oath.cyclops:cyclops-futurestream:$cyclopsVersion"
}

modifyPom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;

import cyclops.async.LazyReact;
import cyclops.futurestream.LazyReact;
import org.springframework.stereotype.Component;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public T getData() {

@Override
public T getCurrentData() {
return data.visit(present -> present, () -> null);
return data.fold(present -> present, () -> null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private Maybe<ErrorEvent> selectLatestError(Queue<ErrorEvent> errors, Queue<Erro
}

private HealthStatus.State state(Maybe<ErrorEvent> errors) {
return errors.visit(this::handleError, () -> HealthStatus.State.Ok);
return errors.fold(this::handleError, () -> HealthStatus.State.Ok);
}

private HealthStatus.State handleError(ErrorEvent event) {
Expand Down
29 changes: 0 additions & 29 deletions micro-events/src/test/java/app/groovy/StatusGroovy.groovy

This file was deleted.

38 changes: 38 additions & 0 deletions micro-events/src/test/java/app/groovy/StatusGroovy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package app.groovy;

import com.oath.micro.server.MicroserverApp;
import com.oath.micro.server.auto.discovery.Rest;
import com.oath.micro.server.config.Microserver;
import com.oath.micro.server.module.Module;
//import groovy.lang.Closure;
//import org.codehaus.groovy.runtime.DefaultGroovyMethods;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.List;

@Rest
@Path("/status")
@Microserver
public class StatusGroovy {
public static void main(String[] args) {
/**
List<Thread> app = new MicroserverApp(StatusGroovy.class, DefaultGroovyMethods.asType(new Closure<String>(null, null) {
public String doCall() {
return "status-app";
}
}, Module.class)).start();
**/

}

@GET
@Produces("text/plain")
@Path("/ping")
public String respondToPing() {
return "pong!";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void jdkSteam(){
public void lazy(){
ListX<Integer> list = ReactiveSeq.of(1,2,3)
.peek(System.out::println)
.toListX();
.to(ListX::fromIterable);


list.size();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.oath.micro.server.machine.stats.sigar;

import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

public class StatsServletContextListenerTest {
@Before
public void setUp() {
sce = Mockito.mock(ServletContextEvent.class);
servletContext = Mockito.mock(ServletContext.class);
contextListener = new StatsServletContextListener();
}

@Test
public void testGrizzly() {
contextListener.contextInitialized(sce);
Assert.assertThat(System.getProperty("java.library.path"), Matchers.is(System.getProperty("user.dir") + "/sigar-lib"));
contextListener.contextDestroyed(sce);
}

private StatsServletContextListener contextListener;
private ServletContextEvent sce;
private ServletContext servletContext;
}

This file was deleted.

2 changes: 1 addition & 1 deletion micro-reactive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bus.push("bus-2", myData2);
ListX<Tuple<Integer,Integer>> list = For.Publishers.each(Flux.range(1,10),
i-> ReactiveSeq.iterate(i,a->a+1),
Tuple::tuple)
.toListX();
.to(ListX::fromIterable);

```

Expand Down
1 change: 1 addition & 0 deletions micro-reactive/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies {
testCompile project(':micro-grizzly')
testCompile project(':micro-jersey')
testCompile project(':micro-jackson-configuration')
testCompile "com.oath.cyclops:cyclops-futurestream:$cyclopsVersion"
}

modifyPom {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.oath.micro.server.reactive;
import java.util.concurrent.ScheduledExecutorService;

import com.oath.cyclops.types.stream.HotStream;
import com.oath.cyclops.types.stream.Connectable;
import cyclops.reactive.ReactiveSeq;
import lombok.AllArgsConstructor;

Expand All @@ -14,21 +14,21 @@ public class JobSchedular {

private final ScheduledExecutorService ex;

public <T,K,V> HotStream<SystemData<K,V>> schedule(String expression, ScheduledJob<T> job){
public <T,K,V> Connectable<SystemData<K,V>> schedule(String expression, ScheduledJob<T> job){
return ReactiveSeq.generate(()->"new job")
.<SystemData<K,V>>map(drop->job.scheduleAndLog())
.schedule(expression,ex);
}
public <T,K,V> HotStream<SystemData<K,V>> scheduleFixedDelay(long fixedDelay, ScheduledJob<T> job){
public <T,K,V> Connectable<SystemData<K,V>> scheduleFixedDelay(long fixedDelay, ScheduledJob<T> job){
return ReactiveSeq.generate(()->"new job")
.<SystemData<K,V>>map(drop->job.scheduleAndLog())
.scheduleFixedDelay(fixedDelay,ex);
}

public <T,K,V> HotStream<SystemData<K,V>> scheduleFixedRate(long fixedRate, ScheduledJob<T> job){
public <T,K,V> Connectable<SystemData<K,V>> scheduleFixedRate(long fixedRate, ScheduledJob<T> job){
return ReactiveSeq.generate(()->"new job")
.<SystemData<K,V>>map(drop->job.scheduleAndLog())
.scheduleFixedRate(fixedRate,ex);
}

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package app.bus.com.aol.micro.server;

import cyclops.async.QueueFactories;
import cyclops.async.adapters.QueueFactory;
import com.oath.cyclops.async.QueueFactories;
import com.oath.cyclops.async.adapters.QueueFactory;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package app.streaming.com.aol.micro.server;

import cyclops.async.QueueFactories;
import cyclops.async.adapters.QueueFactory;
import com.oath.cyclops.async.QueueFactories;
import com.oath.cyclops.async.adapters.QueueFactory;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand Down
1 change: 1 addition & 0 deletions micro-spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
testCompile project(':micro-client')
testCompile project(':micro-events')
testCompile project(':micro-metrics')
testCompile "com.oath.cyclops:cyclops-futurestream:$cyclopsVersion"
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void errorHandlingGeneral() {
.map(this::load)
.map(this::error)
.execute(10)
.toFailedOptional()
.get();
.toFailedOption()
.orElse(null);


assertThat(result,instanceOf(RuntimeException.class));
Expand All @@ -68,8 +68,8 @@ public void errorHandlingSpecific() {
.map(this::load)
.map(this::error2)
.execute(10,IllegalArgumentException.class)
.toFailedOptional()
.get();
.toFailedOption()
.orElse(null);


fail("exception expected!");
Expand All @@ -83,8 +83,8 @@ public void errorHandlingSpecificCaught() {
.map(this::load)
.map(this::error2)
.execute(10,NullPointerException.class)
.toFailedOptional()
.get();
.toFailedOption()
.orElse(null);


assertThat(result,instanceOf(NullPointerException.class));
Expand Down
1 change: 1 addition & 0 deletions micro-tutorial/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ dependencies {
compile project(':micro-ip-tracker')
compile project(':micro-grizzly')
compile project(':micro-jersey')
compile "com.oath.cyclops:cyclops-futurestream:$cyclopsVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;

import cyclops.async.LazyReact;
import cyclops.futurestream.LazyReact;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
Expand Down

0 comments on commit 4b77cf9

Please sign in to comment.