From 3edf89a566a644c8a970963099c0dca1f65a5c3b Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Thu, 10 Jan 2013 14:45:59 -0800 Subject: [PATCH 1/6] Add more arities --- rxjava-core/src/main/java/org/rx/functions/Func5.java | 5 +++++ rxjava-core/src/main/java/org/rx/functions/Func6.java | 5 +++++ rxjava-core/src/main/java/org/rx/functions/Func7.java | 5 +++++ rxjava-core/src/main/java/org/rx/functions/Func8.java | 5 +++++ rxjava-core/src/main/java/org/rx/functions/Func9.java | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 rxjava-core/src/main/java/org/rx/functions/Func5.java create mode 100644 rxjava-core/src/main/java/org/rx/functions/Func6.java create mode 100644 rxjava-core/src/main/java/org/rx/functions/Func7.java create mode 100644 rxjava-core/src/main/java/org/rx/functions/Func8.java create mode 100644 rxjava-core/src/main/java/org/rx/functions/Func9.java diff --git a/rxjava-core/src/main/java/org/rx/functions/Func5.java b/rxjava-core/src/main/java/org/rx/functions/Func5.java new file mode 100644 index 00000000000..d383d21cb64 --- /dev/null +++ b/rxjava-core/src/main/java/org/rx/functions/Func5.java @@ -0,0 +1,5 @@ +package org.rx.functions; + +public interface Func5 { + public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5); +} \ No newline at end of file diff --git a/rxjava-core/src/main/java/org/rx/functions/Func6.java b/rxjava-core/src/main/java/org/rx/functions/Func6.java new file mode 100644 index 00000000000..77a284b2215 --- /dev/null +++ b/rxjava-core/src/main/java/org/rx/functions/Func6.java @@ -0,0 +1,5 @@ +package org.rx.functions; + +public interface Func6 { + public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6); +} \ No newline at end of file diff --git a/rxjava-core/src/main/java/org/rx/functions/Func7.java b/rxjava-core/src/main/java/org/rx/functions/Func7.java new file mode 100644 index 00000000000..cd093f6dae6 --- /dev/null +++ b/rxjava-core/src/main/java/org/rx/functions/Func7.java @@ -0,0 +1,5 @@ +package org.rx.functions; + +public interface Func7 { + public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7); +} \ No newline at end of file diff --git a/rxjava-core/src/main/java/org/rx/functions/Func8.java b/rxjava-core/src/main/java/org/rx/functions/Func8.java new file mode 100644 index 00000000000..8b26ad4bf6e --- /dev/null +++ b/rxjava-core/src/main/java/org/rx/functions/Func8.java @@ -0,0 +1,5 @@ +package org.rx.functions; + +public interface Func8 { + public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8); +} \ No newline at end of file diff --git a/rxjava-core/src/main/java/org/rx/functions/Func9.java b/rxjava-core/src/main/java/org/rx/functions/Func9.java new file mode 100644 index 00000000000..3f7afba8a31 --- /dev/null +++ b/rxjava-core/src/main/java/org/rx/functions/Func9.java @@ -0,0 +1,5 @@ +package org.rx.functions; + +public interface Func9 { + public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9); +} \ No newline at end of file From 421488b1ec096979917d5de56949502854e91a62 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Thu, 10 Jan 2013 16:07:57 -0800 Subject: [PATCH 2/6] LanguageAdaptor for Function execution Removed dependencies on Groovy and JRuby from rxjava-core --- rxjava-core/build.gradle | 2 - .../rx/functions/FunctionLanguageAdaptor.java | 22 ++ .../main/java/org/rx/functions/Functions.java | 120 +++++++---- .../main/java/org/rx/reactive/Observable.java | 202 ------------------ settings.gradle | 4 +- 5 files changed, 109 insertions(+), 241 deletions(-) create mode 100644 rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java diff --git a/rxjava-core/build.gradle b/rxjava-core/build.gradle index 03d0e79e941..c18189d0dea 100644 --- a/rxjava-core/build.gradle +++ b/rxjava-core/build.gradle @@ -10,8 +10,6 @@ dependencies { compile 'com.google.code.findbugs:jsr305:2.0.0' provided 'junit:junit:4.10' provided 'org.mockito:mockito-core:1.9.5' - compile 'org.codehaus.groovy:groovy:1.8.8' - compile 'org.jruby:jruby:1.7.2' } eclipse { diff --git a/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java b/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java new file mode 100644 index 00000000000..088c4e4021e --- /dev/null +++ b/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java @@ -0,0 +1,22 @@ +package org.rx.functions; + +public interface FunctionLanguageAdaptor { + + /** + * Invoke the function and return the results. + * + * @param function + * @param args + * @return Object results from function execution + */ + Object call(Object function, Object[] args); + + /** + * The Class of the Function that this adaptor serves. + *

+ * Example: groovy.lang.Closure + * + * @return Class + */ + public Class getFunctionClass(); +} diff --git a/rxjava-core/src/main/java/org/rx/functions/Functions.java b/rxjava-core/src/main/java/org/rx/functions/Functions.java index 8300981db92..5a2a1e7fadf 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Functions.java +++ b/rxjava-core/src/main/java/org/rx/functions/Functions.java @@ -1,94 +1,141 @@ package org.rx.functions; -import groovy.lang.Closure; +import java.util.Collection; +import java.util.concurrent.ConcurrentHashMap; -import org.jruby.Ruby; -import org.jruby.RubyProc; -import org.jruby.javasupport.JavaEmbedUtils; -import org.jruby.runtime.builtin.IRubyObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Allows execution of functions from multiple different languages. + *

+ * Language support is provided via implementations of {@link FunctionLanguageAdaptor}. + *

+ * This class will dynamically look for known language adaptors on the classpath at startup or new ones can be registered using {@link #registerLanguageAdaptor(Class, FunctionLanguageAdaptor)}. + */ public class Functions { private static final Logger logger = LoggerFactory.getLogger(Functions.class); + private final static ConcurrentHashMap, FunctionLanguageAdaptor> languageAdaptors = new ConcurrentHashMap, FunctionLanguageAdaptor>(); + + static { + /* optimistically look for supported languages if they are in the classpath */ + loadLanguageAdaptor("Groovy"); + loadLanguageAdaptor("JRuby"); + loadLanguageAdaptor("Clojure"); + loadLanguageAdaptor("Scala"); + // as new languages arise we can add them here but this does not prevent someone from using 'registerLanguageAdaptor' directly + } + + private static void loadLanguageAdaptor(String name) { + String className = "org.rx.lang." + name.toLowerCase() + "." + name + "Adaptor"; + try { + Class c = Class.forName(className); + FunctionLanguageAdaptor a = (FunctionLanguageAdaptor) c.newInstance(); + registerLanguageAdaptor(a.getFunctionClass(), a); + } catch (ClassNotFoundException e) { + logger.info("Could not found function language adaptor: " + name + " with path: " + className); + } catch (Exception e) { + logger.error("Failed trying to initialize function language adaptor: " + className, e); + } + } + + public static void registerLanguageAdaptor(Class functionClass, FunctionLanguageAdaptor adaptor) { + languageAdaptors.put(functionClass, adaptor); + } + + public static void removeLanguageAdaptor(Class functionClass) { + languageAdaptors.remove(functionClass); + } + + public static Collection getRegisteredLanguageAdaptors() { + return languageAdaptors.values(); + } + /** * Utility method for determining the type of closure/function and executing it. * - * @param closure + * @param function * @param args */ @SuppressWarnings("unchecked") - public static R execute(Object closure, Object... args) { + public static R execute(Object function, Object... args) { // if we have a tracer then log the start long startTime = -1; if (tracer != null && tracer.isTraceEnabled()) { try { startTime = System.nanoTime(); - tracer.traceStart(closure, args); + tracer.traceStart(function, args); } catch (Exception e) { logger.warn("Failed to trace log.", e); } } // perform controller logic to determine what type of function we received and execute it try { - if (closure == null) { - throw new RuntimeException("closure is null. Can't send arguments to null closure."); + if (function == null) { + throw new RuntimeException("function is null. Can't send arguments to null function."); } - if (closure instanceof Closure) { - /* handle Groovy */ - return (R) ((Closure) closure).call(args); - } else if (closure instanceof RubyProc) { - // handle JRuby - RubyProc rubyProc = ((RubyProc) closure); - Ruby ruby = rubyProc.getRuntime(); - IRubyObject rubyArgs[] = new IRubyObject[args.length]; - for (int i = 0; i < args.length; i++) { - rubyArgs[i] = JavaEmbedUtils.javaToRuby(ruby, args[i]); + + /* + * TODO the following code needs to be evaluated for performance + * + * The c.isInstance and keySet() functions may be areas of concern with as often as this will be executed + */ + + // check for language adaptor + for (@SuppressWarnings("rawtypes") + Class c : languageAdaptors.keySet()) { + if (c.isInstance(function)) { + // found the language adaptor so execute + return (R) languageAdaptors.get(c).call(function, args); } - return (R) rubyProc.getBlock().call(ruby.getCurrentContext(), rubyArgs); - } else if (closure instanceof Func0) { - Func0 f = (Func0) closure; + } + // no language adaptor found + + // check Func* classes + if (function instanceof Func0) { + Func0 f = (Func0) function; if (args.length != 0) { throw new RuntimeException("The closure was Func0 and expected no arguments, but we received: " + args.length); } return (R) f.call(); - } else if (closure instanceof Func1) { - Func1 f = (Func1) closure; + } else if (function instanceof Func1) { + Func1 f = (Func1) function; if (args.length != 1) { throw new RuntimeException("The closure was Func1 and expected 1 argument, but we received: " + args.length); } return f.call(args[0]); - } else if (closure instanceof Func2) { - Func2 f = (Func2) closure; + } else if (function instanceof Func2) { + Func2 f = (Func2) function; if (args.length != 2) { throw new RuntimeException("The closure was Func2 and expected 2 arguments, but we received: " + args.length); } return f.call(args[0], args[1]); - } else if (closure instanceof Func3) { - Func3 f = (Func3) closure; + } else if (function instanceof Func3) { + Func3 f = (Func3) function; if (args.length != 3) { throw new RuntimeException("The closure was Func3 and expected 3 arguments, but we received: " + args.length); } return (R) f.call(args[0], args[1], args[2]); - } else if (closure instanceof Func4) { - Func4 f = (Func4) closure; + } else if (function instanceof Func4) { + Func4 f = (Func4) function; if (args.length != 1) { throw new RuntimeException("The closure was Func4 and expected 4 arguments, but we received: " + args.length); } return f.call(args[0], args[1], args[2], args[3]); - } else if (closure instanceof FuncN) { - FuncN f = (FuncN) closure; + } else if (function instanceof FuncN) { + FuncN f = (FuncN) function; return f.call(args); - } else { - throw new RuntimeException("Unsupported closure type: " + closure.getClass().getSimpleName()); } + + // no support found + throw new RuntimeException("Unsupported closure type: " + function.getClass().getSimpleName()); } finally { // if we have a tracer then log the end if (tracer != null && tracer.isTraceEnabled()) { try { - tracer.traceEnd(startTime, System.nanoTime(), closure, args); + tracer.traceEnd(startTime, System.nanoTime(), function, args); } catch (Exception e) { logger.warn("Failed to trace log.", e); } @@ -199,4 +246,5 @@ public static interface FunctionTraceLogger { public static void registerTraceLogger(FunctionTraceLogger tracer) { Functions.tracer = tracer; } + } diff --git a/rxjava-core/src/main/java/org/rx/reactive/Observable.java b/rxjava-core/src/main/java/org/rx/reactive/Observable.java index dc36981e290..3c062b5fbc1 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/Observable.java +++ b/rxjava-core/src/main/java/org/rx/reactive/Observable.java @@ -2,15 +2,12 @@ import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; -import groovy.lang.Binding; -import groovy.lang.GroovyClassLoader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import org.codehaus.groovy.runtime.InvokerHelper; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -2087,50 +2084,6 @@ public Observable> toSortedList(final Object sortFunction) { } public static class UnitTest { - private static interface ScriptAssertion { - public void error(Exception o); - - public void received(Object o); - } - - private static class TestFactory { - int counter = 1; - - @SuppressWarnings("unused") - public Observable getNumbers() { - return toObservable(1, 3, 2, 5, 4); - } - - @SuppressWarnings("unused") - public TestObservable getObservable() { - return new TestObservable(counter++); - } - } - - private static class TestObservable extends Observable { - private final int count; - - public TestObservable(int count) { - this.count = count; - } - - public Subscription subscribe(Observer observer) { - - observer.onNext("hello_" + count); - observer.onCompleted(); - - return new Subscription() { - - public void unsubscribe() { - // unregister ... will never be called here since we are executing synchronously - } - - }; - } - } - - @Mock - ScriptAssertion assertion; @Mock Observer w; @@ -2140,91 +2093,6 @@ public void before() { MockitoAnnotations.initMocks(this); } - private void runGroovyScript(String script) { - ClassLoader parent = getClass().getClassLoader(); - @SuppressWarnings("resource") - GroovyClassLoader loader = new GroovyClassLoader(parent); - - Binding binding = new Binding(); - binding.setVariable("mockApiCall", new TestFactory()); - binding.setVariable("a", assertion); - binding.setVariable("o", org.rx.reactive.Observable.class); - - /* parse the script and execute it */ - InvokerHelper.createScript(loader.parseClass(script), binding).run(); - } - - @Test - public void testCreateViaGroovy() { - runGroovyScript("o.create({it.onNext('hello');it.onCompleted();}).subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received("hello"); - } - - @Test - public void testFilterViaGroovy() { - runGroovyScript("o.filter(o.toObservable(1, 2, 3), {it >= 2}).subscribe({ result -> a.received(result)});"); - verify(assertion, times(0)).received(1); - verify(assertion, times(1)).received(2); - verify(assertion, times(1)).received(3); - } - - @Test - public void testLast() { - String script = "mockApiCall.getObservable().last().subscribe({ result -> a.received(result)});"; - runGroovyScript(script); - verify(assertion, times(1)).received("hello_1"); - } - - @Test - public void testMap() { - String script = "mockApiCall.getObservable().map({v -> 'say' + v}).subscribe({ result -> a.received(result)});"; - runGroovyScript(script); - verify(assertion, times(1)).received("sayhello_1"); - } - - @Test - public void testMapViaGroovy() { - runGroovyScript("o.map(o.toObservable(1, 2, 3), {'hello_' + it}).subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received("hello_" + 1); - verify(assertion, times(1)).received("hello_" + 2); - verify(assertion, times(1)).received("hello_" + 3); - } - - @Test - public void testMaterializeViaGroovy() { - runGroovyScript("o.materialize(o.toObservable(1, 2, 3)).subscribe({ result -> a.received(result)});"); - // we expect 4 onNext calls: 3 for 1, 2, 3 ObservableNotification.OnNext and 1 for ObservableNotification.OnCompleted - verify(assertion, times(4)).received(any(Notification.class)); - verify(assertion, times(0)).error(any(Exception.class)); - } - - @Test - public void testMergeDelayErrorViaGroovy() { - runGroovyScript("o.mergeDelayError(o.toObservable(1, 2, 3), o.merge(o.toObservable(6), o.error(new NullPointerException()), o.toObservable(7)), o.toObservable(4, 5)).subscribe({ result -> a.received(result)}, { exception -> a.error(exception)});"); - verify(assertion, times(1)).received(1); - verify(assertion, times(1)).received(2); - verify(assertion, times(1)).received(3); - verify(assertion, times(1)).received(4); - verify(assertion, times(1)).received(5); - verify(assertion, times(1)).received(6); - verify(assertion, times(0)).received(7); - verify(assertion, times(1)).error(any(NullPointerException.class)); - } - - @Test - public void testMergeViaGroovy() { - runGroovyScript("o.merge(o.toObservable(1, 2, 3), o.merge(o.toObservable(6), o.error(new NullPointerException()), o.toObservable(7)), o.toObservable(4, 5)).subscribe({ result -> a.received(result)}, { exception -> a.error(exception)});"); - // executing synchronously so we can deterministically know what order things will come - verify(assertion, times(1)).received(1); - verify(assertion, times(1)).received(2); - verify(assertion, times(1)).received(3); - verify(assertion, times(0)).received(4); // the NPE will cause this sequence to be skipped - verify(assertion, times(0)).received(5); // the NPE will cause this sequence to be skipped - verify(assertion, times(1)).received(6); // this comes before the NPE so should exist - verify(assertion, times(0)).received(7);// this comes in the sequence after the NPE - verify(assertion, times(1)).error(any(NullPointerException.class)); - } - @Test public void testReduce() { Observable Observable = toObservable(1, 2, 3, 4); @@ -2257,75 +2125,5 @@ public Integer call(Integer t1, Integer t2) { verify(w).onNext(60); } - @Test - public void testScriptWithMaterialize() { - String script = "mockApiCall.getObservable().materialize().subscribe({ result -> a.received(result)});"; - runGroovyScript(script); - // 2 times: once for hello_1 and once for onCompleted - verify(assertion, times(2)).received(any(Notification.class)); - } - - @Test - public void testScriptWithMerge() { - String script = "o.merge(mockApiCall.getObservable(), mockApiCall.getObservable()).subscribe({ result -> a.received(result)});"; - runGroovyScript(script); - verify(assertion, times(1)).received("hello_1"); - verify(assertion, times(1)).received("hello_2"); - } - - @Test - public void testScriptWithOnNext() { - String script = "mockApiCall.getObservable().subscribe({ result -> a.received(result)})"; - runGroovyScript(script); - verify(assertion).received("hello_1"); - } - - @Test - public void testSkipTakeViaGroovy() { - runGroovyScript("o.skip(o.toObservable(1, 2, 3), 1).take(1).subscribe({ result -> a.received(result)});"); - verify(assertion, times(0)).received(1); - verify(assertion, times(1)).received(2); - verify(assertion, times(0)).received(3); - } - - @Test - public void testSkipViaGroovy() { - runGroovyScript("o.skip(o.toObservable(1, 2, 3), 2).subscribe({ result -> a.received(result)});"); - verify(assertion, times(0)).received(1); - verify(assertion, times(0)).received(2); - verify(assertion, times(1)).received(3); - } - - @Test - public void testTakeViaGroovy() { - runGroovyScript("o.take(o.toObservable(1, 2, 3), 2).subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received(1); - verify(assertion, times(1)).received(2); - verify(assertion, times(0)).received(3); - } - - @Test - public void testToSortedList() { - runGroovyScript("mockApiCall.getNumbers().toSortedList().subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); - } - - @Test - public void testToSortedListStatic() { - runGroovyScript("o.toSortedList(o.toObservable(1, 3, 2, 5, 4)).subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); - } - - @Test - public void testToSortedListWithFunction() { - runGroovyScript("mockApiCall.getNumbers().toSortedList({a, b -> a - b}).subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); - } - - @Test - public void testToSortedListWithFunctionStatic() { - runGroovyScript("o.toSortedList(o.toObservable(1, 3, 2, 5, 4), {a, b -> a - b}).subscribe({ result -> a.received(result)});"); - verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); - } } } diff --git a/settings.gradle b/settings.gradle index 106c9c9d1d3..1690640a76e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,4 @@ rootProject.name='rxjava' -include 'rxjava-core' +include 'rxjava-core', \ +'language-adaptors:rxjava-groovy', \ +'language-adaptors:rxjava-jruby' From 50ce85e47cf232501ce3779d0c4be4fa7706f73a Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Thu, 10 Jan 2013 16:08:17 -0800 Subject: [PATCH 3/6] GroovyAdaptor --- language-adaptors/rxjava-groovy/build.gradle | 7 + .../org/rx/lang/groovy/GroovyAdaptor.java | 245 ++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 language-adaptors/rxjava-groovy/build.gradle create mode 100644 language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java diff --git a/language-adaptors/rxjava-groovy/build.gradle b/language-adaptors/rxjava-groovy/build.gradle new file mode 100644 index 00000000000..8d2b2690478 --- /dev/null +++ b/language-adaptors/rxjava-groovy/build.gradle @@ -0,0 +1,7 @@ +apply plugin: 'java' +dependencies { + compile project(':rxjava-core') + compile 'org.codehaus.groovy:groovy:1.8.8' + provided 'junit:junit:4.10' + provided 'org.mockito:mockito-core:1.9.5' +} diff --git a/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java b/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java new file mode 100644 index 00000000000..9280bc033ee --- /dev/null +++ b/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java @@ -0,0 +1,245 @@ +package org.rx.lang.groovy; + +import static org.mockito.Matchers.*; +import static org.mockito.Mockito.*; +import groovy.lang.Binding; +import groovy.lang.Closure; +import groovy.lang.GroovyClassLoader; + +import java.util.Arrays; + +import org.codehaus.groovy.runtime.InvokerHelper; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.rx.functions.FunctionLanguageAdaptor; +import org.rx.reactive.Notification; +import org.rx.reactive.Observable; +import org.rx.reactive.Observer; +import org.rx.reactive.Subscription; + +public class GroovyAdaptor implements FunctionLanguageAdaptor { + + @Override + public Object call(Object function, Object[] args) { + return ((Closure) function).call(args); + } + + public Class getFunctionClass() { + return Closure.class; + } + + public static class UnitTest { + + @Mock + ScriptAssertion assertion; + + @Mock + Observer w; + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCreateViaGroovy() { + runGroovyScript("o.create({it.onNext('hello');it.onCompleted();}).subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received("hello"); + } + + @Test + public void testFilterViaGroovy() { + runGroovyScript("o.filter(o.toObservable(1, 2, 3), {it >= 2}).subscribe({ result -> a.received(result)});"); + verify(assertion, times(0)).received(1); + verify(assertion, times(1)).received(2); + verify(assertion, times(1)).received(3); + } + + @Test + public void testLast() { + String script = "mockApiCall.getObservable().last().subscribe({ result -> a.received(result)});"; + runGroovyScript(script); + verify(assertion, times(1)).received("hello_1"); + } + + @Test + public void testMap() { + String script = "mockApiCall.getObservable().map({v -> 'say' + v}).subscribe({ result -> a.received(result)});"; + runGroovyScript(script); + verify(assertion, times(1)).received("sayhello_1"); + } + + @Test + public void testMapViaGroovy() { + runGroovyScript("o.map(o.toObservable(1, 2, 3), {'hello_' + it}).subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received("hello_" + 1); + verify(assertion, times(1)).received("hello_" + 2); + verify(assertion, times(1)).received("hello_" + 3); + } + + @Test + public void testMaterializeViaGroovy() { + runGroovyScript("o.materialize(o.toObservable(1, 2, 3)).subscribe({ result -> a.received(result)});"); + // we expect 4 onNext calls: 3 for 1, 2, 3 ObservableNotification.OnNext and 1 for ObservableNotification.OnCompleted + verify(assertion, times(4)).received(any(Notification.class)); + verify(assertion, times(0)).error(any(Exception.class)); + } + + @Test + public void testMergeDelayErrorViaGroovy() { + runGroovyScript("o.mergeDelayError(o.toObservable(1, 2, 3), o.merge(o.toObservable(6), o.error(new NullPointerException()), o.toObservable(7)), o.toObservable(4, 5)).subscribe({ result -> a.received(result)}, { exception -> a.error(exception)});"); + verify(assertion, times(1)).received(1); + verify(assertion, times(1)).received(2); + verify(assertion, times(1)).received(3); + verify(assertion, times(1)).received(4); + verify(assertion, times(1)).received(5); + verify(assertion, times(1)).received(6); + verify(assertion, times(0)).received(7); + verify(assertion, times(1)).error(any(NullPointerException.class)); + } + + @Test + public void testMergeViaGroovy() { + runGroovyScript("o.merge(o.toObservable(1, 2, 3), o.merge(o.toObservable(6), o.error(new NullPointerException()), o.toObservable(7)), o.toObservable(4, 5)).subscribe({ result -> a.received(result)}, { exception -> a.error(exception)});"); + // executing synchronously so we can deterministically know what order things will come + verify(assertion, times(1)).received(1); + verify(assertion, times(1)).received(2); + verify(assertion, times(1)).received(3); + verify(assertion, times(0)).received(4); // the NPE will cause this sequence to be skipped + verify(assertion, times(0)).received(5); // the NPE will cause this sequence to be skipped + verify(assertion, times(1)).received(6); // this comes before the NPE so should exist + verify(assertion, times(0)).received(7);// this comes in the sequence after the NPE + verify(assertion, times(1)).error(any(NullPointerException.class)); + } + + @Test + public void testScriptWithMaterialize() { + String script = "mockApiCall.getObservable().materialize().subscribe({ result -> a.received(result)});"; + runGroovyScript(script); + // 2 times: once for hello_1 and once for onCompleted + verify(assertion, times(2)).received(any(Notification.class)); + } + + @Test + public void testScriptWithMerge() { + String script = "o.merge(mockApiCall.getObservable(), mockApiCall.getObservable()).subscribe({ result -> a.received(result)});"; + runGroovyScript(script); + verify(assertion, times(1)).received("hello_1"); + verify(assertion, times(1)).received("hello_2"); + } + + @Test + public void testScriptWithOnNext() { + String script = "mockApiCall.getObservable().subscribe({ result -> a.received(result)})"; + runGroovyScript(script); + verify(assertion).received("hello_1"); + } + + @Test + public void testSkipTakeViaGroovy() { + runGroovyScript("o.skip(o.toObservable(1, 2, 3), 1).take(1).subscribe({ result -> a.received(result)});"); + verify(assertion, times(0)).received(1); + verify(assertion, times(1)).received(2); + verify(assertion, times(0)).received(3); + } + + @Test + public void testSkipViaGroovy() { + runGroovyScript("o.skip(o.toObservable(1, 2, 3), 2).subscribe({ result -> a.received(result)});"); + verify(assertion, times(0)).received(1); + verify(assertion, times(0)).received(2); + verify(assertion, times(1)).received(3); + } + + @Test + public void testTakeViaGroovy() { + runGroovyScript("o.take(o.toObservable(1, 2, 3), 2).subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received(1); + verify(assertion, times(1)).received(2); + verify(assertion, times(0)).received(3); + } + + @Test + public void testToSortedList() { + runGroovyScript("mockApiCall.getNumbers().toSortedList().subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); + } + + @Test + public void testToSortedListStatic() { + runGroovyScript("o.toSortedList(o.toObservable(1, 3, 2, 5, 4)).subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); + } + + @Test + public void testToSortedListWithFunction() { + runGroovyScript("mockApiCall.getNumbers().toSortedList({a, b -> a - b}).subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); + } + + @Test + public void testToSortedListWithFunctionStatic() { + runGroovyScript("o.toSortedList(o.toObservable(1, 3, 2, 5, 4), {a, b -> a - b}).subscribe({ result -> a.received(result)});"); + verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); + } + + private void runGroovyScript(String script) { + ClassLoader parent = getClass().getClassLoader(); + @SuppressWarnings("resource") + GroovyClassLoader loader = new GroovyClassLoader(parent); + + Binding binding = new Binding(); + binding.setVariable("mockApiCall", new TestFactory()); + binding.setVariable("a", assertion); + binding.setVariable("o", org.rx.reactive.Observable.class); + + /* parse the script and execute it */ + InvokerHelper.createScript(loader.parseClass(script), binding).run(); + } + + private static interface ScriptAssertion { + public void error(Exception o); + + public void received(Object o); + } + + private static class TestFactory { + int counter = 1; + + @SuppressWarnings("unused") + public Observable getNumbers() { + return Observable.toObservable(1, 3, 2, 5, 4); + } + + @SuppressWarnings("unused") + public TestObservable getObservable() { + return new TestObservable(counter++); + } + } + + private static class TestObservable extends Observable { + private final int count; + + public TestObservable(int count) { + this.count = count; + } + + public Subscription subscribe(Observer observer) { + + observer.onNext("hello_" + count); + observer.onCompleted(); + + return new Subscription() { + + public void unsubscribe() { + // unregister ... will never be called here since we are executing synchronously + } + + }; + } + } + } + +} From 765ccf208e168dc22b6cdda623ac6ae4f1f1860c Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Thu, 10 Jan 2013 16:08:30 -0800 Subject: [PATCH 4/6] JRuby adaptor --- language-adaptors/rxjava-jruby/build.gradle | 7 + .../java/org/rx/lang/jruby/JRubyAdaptor.java | 200 ++++++++++++++++++ 2 files changed, 207 insertions(+) create mode 100644 language-adaptors/rxjava-jruby/build.gradle create mode 100644 language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java diff --git a/language-adaptors/rxjava-jruby/build.gradle b/language-adaptors/rxjava-jruby/build.gradle new file mode 100644 index 00000000000..b170a5769a4 --- /dev/null +++ b/language-adaptors/rxjava-jruby/build.gradle @@ -0,0 +1,7 @@ +apply plugin: 'java' +dependencies { + compile project(':rxjava-core') + compile 'org.jruby:jruby:1.7.2' + provided 'junit:junit:4.10' + provided 'org.mockito:mockito-core:1.9.5' +} diff --git a/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java b/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java new file mode 100644 index 00000000000..e5860b1ab75 --- /dev/null +++ b/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java @@ -0,0 +1,200 @@ +package org.rx.lang.jruby; + +import static org.mockito.Matchers.*; +import static org.mockito.Mockito.*; + +import java.util.Arrays; + +import org.jruby.Ruby; +import org.jruby.RubyProc; +import org.jruby.embed.ScriptingContainer; +import org.jruby.javasupport.JavaEmbedUtils; +import org.jruby.runtime.builtin.IRubyObject; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.rx.functions.FunctionLanguageAdaptor; +import org.rx.reactive.Notification; +import org.rx.reactive.Observable; +import org.rx.reactive.Observer; +import org.rx.reactive.Subscription; + +public class JRubyAdaptor implements FunctionLanguageAdaptor { + + @Override + public Object call(Object function, Object[] args) { + RubyProc rubyProc = ((RubyProc) function); + Ruby ruby = rubyProc.getRuntime(); + IRubyObject rubyArgs[] = new IRubyObject[args.length]; + for (int i = 0; i < args.length; i++) { + rubyArgs[i] = JavaEmbedUtils.javaToRuby(ruby, args[i]); + } + return rubyProc.getBlock().call(ruby.getCurrentContext(), rubyArgs); + } + + @Override + public Class getFunctionClass() { + return RubyProc.class; + } + + public static class UnitTest { + + @Mock + ScriptAssertion assertion; + + @Mock + Observer w; + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testCreateViaGroovy() { + runGroovyScript("Observable.create(lambda{|it| it.onNext('hello');it.onCompleted();}).subscribe(lambda{|result| a.received(result)});"); + verify(assertion, times(1)).received("hello"); + } + + @Test + public void testFilterViaGroovy() { + runGroovyScript("Observable.filter(Observable.toObservable(1, 2, 3), lambda{|it| it >= 2}).subscribe(lambda{|result| a.received(result)});"); + verify(assertion, times(0)).received(1L); + verify(assertion, times(1)).received(2L); + verify(assertion, times(1)).received(3L); + } + + @Test + public void testLast() { + String script = "mockApiCall.getObservable().last().subscribe(lambda{|result| a.received(result)})"; + runGroovyScript(script); + verify(assertion, times(1)).received("hello_1"); + } + + @Test + public void testMap() { + String script = "mockApiCall.getObservable().map(lambda{|v| 'say' + v}).subscribe(lambda{|result| a.received(result)});"; + runGroovyScript(script); + verify(assertion, times(1)).received("sayhello_1"); + } + + @Test + public void testMaterializeViaGroovy() { + runGroovyScript("Observable.materialize(Observable.toObservable(1, 2, 3)).subscribe(lambda{|result| a.received(result)});"); + // we expect 4 onNext calls: 3 for 1, 2, 3 ObservableNotification.OnNext and 1 for ObservableNotification.OnCompleted + verify(assertion, times(4)).received(any(Notification.class)); + verify(assertion, times(0)).error(any(Exception.class)); + } + + @Test + public void testScriptWithMaterialize() { + String script = "mockApiCall.getObservable().materialize().subscribe(lambda{|result| a.received(result)});"; + runGroovyScript(script); + // 2 times: once for hello_1 and once for onCompleted + verify(assertion, times(2)).received(any(Notification.class)); + } + + @Test + public void testScriptWithMerge() { + String script = "Observable.merge(mockApiCall.getObservable(), mockApiCall.getObservable()).subscribe(lambda{|result| a.received(result)});"; + runGroovyScript(script); + verify(assertion, times(1)).received("hello_1"); + verify(assertion, times(1)).received("hello_2"); + } + + @Test + public void testScriptWithOnNext() { + String script = "mockApiCall.getObservable().subscribe(lambda{|result| a.received(result)})"; + runGroovyScript(script); + verify(assertion).received("hello_1"); + } + + @Test + public void testSkipTakeViaGroovy() { + runGroovyScript("Observable.skip(Observable.toObservable(1, 2, 3), 1).take(1).subscribe(lambda{|result| a.received(result)});"); + verify(assertion, times(0)).received(1); + verify(assertion, times(1)).received(2L); + verify(assertion, times(0)).received(3); + } + + @Test + public void testSkipViaGroovy() { + runGroovyScript("Observable.skip(Observable.toObservable(1, 2, 3), 2).subscribe(lambda{|result| a.received(result)});"); + verify(assertion, times(0)).received(1); + verify(assertion, times(0)).received(2); + verify(assertion, times(1)).received(3L); + } + + @Test + public void testTakeViaGroovy() { + runGroovyScript("Observable.take(Observable.toObservable(1, 2, 3), 2).subscribe(lambda{|result| a.received(result)});"); + verify(assertion, times(1)).received(1L); + verify(assertion, times(1)).received(2L); + verify(assertion, times(0)).received(3); + } + + @Test + public void testToSortedList() { + runGroovyScript("mockApiCall.getNumbers().toSortedList().subscribe(lambda{|result| a.received(result)});"); + verify(assertion, times(1)).received(Arrays.asList(1, 2, 3, 4, 5)); + } + + private void runGroovyScript(String script) { + ScriptingContainer container = new ScriptingContainer(); + container.put("mockApiCall", new TestFactory()); + container.put("a", assertion); + + StringBuilder b = new StringBuilder(); + // force JRuby to always use subscribe(Object) + b.append("import org.rx.reactive.Observable").append("\n"); + b.append("class Observable").append("\n"); + b.append(" java_alias :subscribe, :subscribe, [java.lang.Object]").append("\n"); + b.append("end").append("\n"); + b.append(script); + + container.runScriptlet(b.toString()); + } + + private static interface ScriptAssertion { + public void error(Exception o); + + public void received(Object o); + } + + public static class TestFactory { + int counter = 1; + + public Observable getNumbers() { + return Observable.toObservable(1, 3, 2, 5, 4); + } + + public TestObservable getObservable() { + return new TestObservable(counter++); + } + } + + private static class TestObservable extends Observable { + private final int count; + + public TestObservable(int count) { + this.count = count; + } + + public Subscription subscribe(Observer observer) { + + observer.onNext("hello_" + count); + observer.onCompleted(); + + return new Subscription() { + + public void unsubscribe() { + // unregister ... will never be called here since we are executing synchronously + } + + }; + } + } + } + +} From 416aa481b283810d2246cf316f11dce01e6d8082 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Thu, 10 Jan 2013 16:10:27 -0800 Subject: [PATCH 5/6] License headers --- .../java/org/rx/lang/groovy/GroovyAdaptor.java | 15 +++++++++++++++ .../java/org/rx/lang/jruby/JRubyAdaptor.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func0.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func1.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func2.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func3.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func4.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func5.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func6.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func7.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func8.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/Func9.java | 15 +++++++++++++++ .../src/main/java/org/rx/functions/FuncN.java | 15 +++++++++++++++ .../rx/functions/FunctionLanguageAdaptor.java | 15 +++++++++++++++ .../main/java/org/rx/functions/Functions.java | 15 +++++++++++++++ .../AtomicObservableSubscription.java | 15 +++++++++++++++ .../java/org/rx/operations/AtomicObserver.java | 15 +++++++++++++++ .../operations/AtomicObserverMultiThreaded.java | 15 +++++++++++++++ .../AtomicObserverSingleThreaded.java | 15 +++++++++++++++ .../rx/operations/OperationCombineLatest.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationFilter.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationLast.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationMap.java | 15 +++++++++++++++ .../org/rx/operations/OperationMaterialize.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationMerge.java | 15 +++++++++++++++ .../rx/operations/OperationMergeDelayError.java | 15 +++++++++++++++ .../OperationOnErrorResumeNextViaFunction.java | 15 +++++++++++++++ ...OperationOnErrorResumeNextViaObservable.java | 15 +++++++++++++++ .../rx/operations/OperationOnErrorReturn.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationScan.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationSkip.java | 15 +++++++++++++++ .../org/rx/operations/OperationSynchronize.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationTake.java | 15 +++++++++++++++ .../OperationToObservableFunction.java | 15 +++++++++++++++ .../OperationToObservableIterable.java | 15 +++++++++++++++ .../operations/OperationToObservableList.java | 15 +++++++++++++++ .../OperationToObservableSortedList.java | 15 +++++++++++++++ .../java/org/rx/operations/OperationZip.java | 15 +++++++++++++++ .../main/java/org/rx/operations/package.html | 17 +++++++++++++++++ .../org/rx/reactive/CompositeException.java | 15 +++++++++++++++ .../main/java/org/rx/reactive/Notification.java | 15 +++++++++++++++ .../main/java/org/rx/reactive/Observable.java | 15 +++++++++++++++ .../src/main/java/org/rx/reactive/Observer.java | 15 +++++++++++++++ .../main/java/org/rx/reactive/Subscription.java | 15 +++++++++++++++ .../src/main/java/org/rx/reactive/package.html | 17 +++++++++++++++++ 45 files changed, 679 insertions(+) diff --git a/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java b/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java index 9280bc033ee..d8a0b5f8710 100644 --- a/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java +++ b/language-adaptors/rxjava-groovy/src/main/java/org/rx/lang/groovy/GroovyAdaptor.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.lang.groovy; import static org.mockito.Matchers.*; diff --git a/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java b/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java index e5860b1ab75..8a9d53e6999 100644 --- a/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java +++ b/language-adaptors/rxjava-jruby/src/main/java/org/rx/lang/jruby/JRubyAdaptor.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.lang.jruby; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/functions/Func0.java b/rxjava-core/src/main/java/org/rx/functions/Func0.java index 224ccb1800c..c02326a138b 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func0.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func0.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func0 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func1.java b/rxjava-core/src/main/java/org/rx/functions/Func1.java index 8bb6b158d19..76203e83c5d 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func1.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func1.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func1 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func2.java b/rxjava-core/src/main/java/org/rx/functions/Func2.java index afb36490643..312dc983b8c 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func2.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func2.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func2 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func3.java b/rxjava-core/src/main/java/org/rx/functions/Func3.java index a38a374eb79..9beeb07e75f 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func3.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func3.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func3 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func4.java b/rxjava-core/src/main/java/org/rx/functions/Func4.java index 6ab1b11d1c9..c23848003dd 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func4.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func4.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func4 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func5.java b/rxjava-core/src/main/java/org/rx/functions/Func5.java index d383d21cb64..1bc9857e761 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func5.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func5.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func5 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func6.java b/rxjava-core/src/main/java/org/rx/functions/Func6.java index 77a284b2215..7286728aac2 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func6.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func6.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func6 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func7.java b/rxjava-core/src/main/java/org/rx/functions/Func7.java index cd093f6dae6..68a5a630106 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func7.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func7.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func7 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func8.java b/rxjava-core/src/main/java/org/rx/functions/Func8.java index 8b26ad4bf6e..fc5fd5ed932 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func8.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func8.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func8 { diff --git a/rxjava-core/src/main/java/org/rx/functions/Func9.java b/rxjava-core/src/main/java/org/rx/functions/Func9.java index 3f7afba8a31..933fbc53760 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Func9.java +++ b/rxjava-core/src/main/java/org/rx/functions/Func9.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface Func9 { diff --git a/rxjava-core/src/main/java/org/rx/functions/FuncN.java b/rxjava-core/src/main/java/org/rx/functions/FuncN.java index cdc0d16203a..cbbb3dd920c 100644 --- a/rxjava-core/src/main/java/org/rx/functions/FuncN.java +++ b/rxjava-core/src/main/java/org/rx/functions/FuncN.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface FuncN { diff --git a/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java b/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java index 088c4e4021e..8ec16b390e4 100644 --- a/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java +++ b/rxjava-core/src/main/java/org/rx/functions/FunctionLanguageAdaptor.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; public interface FunctionLanguageAdaptor { diff --git a/rxjava-core/src/main/java/org/rx/functions/Functions.java b/rxjava-core/src/main/java/org/rx/functions/Functions.java index 5a2a1e7fadf..8ad19497458 100644 --- a/rxjava-core/src/main/java/org/rx/functions/Functions.java +++ b/rxjava-core/src/main/java/org/rx/functions/Functions.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.functions; import java.util.Collection; diff --git a/rxjava-core/src/main/java/org/rx/operations/AtomicObservableSubscription.java b/rxjava-core/src/main/java/org/rx/operations/AtomicObservableSubscription.java index 055d0025dd6..2e73d754daf 100644 --- a/rxjava-core/src/main/java/org/rx/operations/AtomicObservableSubscription.java +++ b/rxjava-core/src/main/java/org/rx/operations/AtomicObservableSubscription.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/rxjava-core/src/main/java/org/rx/operations/AtomicObserver.java b/rxjava-core/src/main/java/org/rx/operations/AtomicObserver.java index aafe260ae08..e8a8b9f3ea6 100644 --- a/rxjava-core/src/main/java/org/rx/operations/AtomicObserver.java +++ b/rxjava-core/src/main/java/org/rx/operations/AtomicObserver.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import javax.annotation.concurrent.ThreadSafe; diff --git a/rxjava-core/src/main/java/org/rx/operations/AtomicObserverMultiThreaded.java b/rxjava-core/src/main/java/org/rx/operations/AtomicObserverMultiThreaded.java index e267950b512..7d20ba14717 100644 --- a/rxjava-core/src/main/java/org/rx/operations/AtomicObserverMultiThreaded.java +++ b/rxjava-core/src/main/java/org/rx/operations/AtomicObserverMultiThreaded.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/AtomicObserverSingleThreaded.java b/rxjava-core/src/main/java/org/rx/operations/AtomicObserverSingleThreaded.java index 74bed86347d..ca139e658d7 100644 --- a/rxjava-core/src/main/java/org/rx/operations/AtomicObserverSingleThreaded.java +++ b/rxjava-core/src/main/java/org/rx/operations/AtomicObserverSingleThreaded.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationCombineLatest.java b/rxjava-core/src/main/java/org/rx/operations/OperationCombineLatest.java index dc601e95689..ccba74236dd 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationCombineLatest.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationCombineLatest.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationFilter.java b/rxjava-core/src/main/java/org/rx/operations/OperationFilter.java index 5421a0a0d43..a55624aadb9 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationFilter.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationFilter.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationLast.java b/rxjava-core/src/main/java/org/rx/operations/OperationLast.java index b412c1d76ed..fee302c88e3 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationLast.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationLast.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationMap.java b/rxjava-core/src/main/java/org/rx/operations/OperationMap.java index 18b17ac762e..896e87c3c9c 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationMap.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationMap.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationMaterialize.java b/rxjava-core/src/main/java/org/rx/operations/OperationMaterialize.java index 0964829bf70..0254a0a29a2 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationMaterialize.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationMaterialize.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationMerge.java b/rxjava-core/src/main/java/org/rx/operations/OperationMerge.java index acd3106df64..291f5a4a36b 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationMerge.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationMerge.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationMergeDelayError.java b/rxjava-core/src/main/java/org/rx/operations/OperationMergeDelayError.java index da9c145aea5..8ddd3bff465 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationMergeDelayError.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationMergeDelayError.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaFunction.java b/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaFunction.java index 82fff9ca2dc..deeae454353 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaFunction.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaFunction.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaObservable.java b/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaObservable.java index 9311d5381d5..df7f8de7f21 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaObservable.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorResumeNextViaObservable.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorReturn.java b/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorReturn.java index 6ab27e6aa18..06be1f61eb7 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorReturn.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationOnErrorReturn.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationScan.java b/rxjava-core/src/main/java/org/rx/operations/OperationScan.java index 2fc34b6dc3c..8bf76140b28 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationScan.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationScan.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationSkip.java b/rxjava-core/src/main/java/org/rx/operations/OperationSkip.java index 45394989fae..c7738efb0cd 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationSkip.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationSkip.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationSynchronize.java b/rxjava-core/src/main/java/org/rx/operations/OperationSynchronize.java index a96d02ddbc6..a2d73db4699 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationSynchronize.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationSynchronize.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationTake.java b/rxjava-core/src/main/java/org/rx/operations/OperationTake.java index 13aed147ad2..1bd404115d4 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationTake.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationTake.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.junit.Assert.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableFunction.java b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableFunction.java index cfa2501caaf..33f4048e4f5 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableFunction.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableFunction.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableIterable.java b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableIterable.java index a462b5ee954..1338b59a4fb 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableIterable.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableIterable.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableList.java b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableList.java index e8ac558d92e..14977f04a86 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableList.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableList.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableSortedList.java b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableSortedList.java index 29e5f4ed67b..f6afd9bf7e6 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationToObservableSortedList.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationToObservableSortedList.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/OperationZip.java b/rxjava-core/src/main/java/org/rx/operations/OperationZip.java index f453ba9abd7..f7b4efdee70 100644 --- a/rxjava-core/src/main/java/org/rx/operations/OperationZip.java +++ b/rxjava-core/src/main/java/org/rx/operations/OperationZip.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.operations; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/operations/package.html b/rxjava-core/src/main/java/org/rx/operations/package.html index fbb0cfa3bec..80ba7542bf3 100644 --- a/rxjava-core/src/main/java/org/rx/operations/package.html +++ b/rxjava-core/src/main/java/org/rx/operations/package.html @@ -1,3 +1,20 @@ +

Operators that allow composing Observables to transform and manipulate data in an asynchronous, functional and thread-safe manner.

diff --git a/rxjava-core/src/main/java/org/rx/reactive/CompositeException.java b/rxjava-core/src/main/java/org/rx/reactive/CompositeException.java index 23113e26b6a..ab07c7df79d 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/CompositeException.java +++ b/rxjava-core/src/main/java/org/rx/reactive/CompositeException.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.reactive; import java.util.ArrayList; diff --git a/rxjava-core/src/main/java/org/rx/reactive/Notification.java b/rxjava-core/src/main/java/org/rx/reactive/Notification.java index 9840f230eb9..397fe0ce11a 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/Notification.java +++ b/rxjava-core/src/main/java/org/rx/reactive/Notification.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.reactive; /** diff --git a/rxjava-core/src/main/java/org/rx/reactive/Observable.java b/rxjava-core/src/main/java/org/rx/reactive/Observable.java index 3c062b5fbc1..ba40e517516 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/Observable.java +++ b/rxjava-core/src/main/java/org/rx/reactive/Observable.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.reactive; import static org.mockito.Matchers.*; diff --git a/rxjava-core/src/main/java/org/rx/reactive/Observer.java b/rxjava-core/src/main/java/org/rx/reactive/Observer.java index eca51c7e715..3d14d88a1f8 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/Observer.java +++ b/rxjava-core/src/main/java/org/rx/reactive/Observer.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.reactive; /** diff --git a/rxjava-core/src/main/java/org/rx/reactive/Subscription.java b/rxjava-core/src/main/java/org/rx/reactive/Subscription.java index 659e34396c7..315d6e1f940 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/Subscription.java +++ b/rxjava-core/src/main/java/org/rx/reactive/Subscription.java @@ -1,3 +1,18 @@ +/** + * Copyright 2013 Netflix, Inc. + * + * Licensed 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 org.rx.reactive; public interface Subscription { diff --git a/rxjava-core/src/main/java/org/rx/reactive/package.html b/rxjava-core/src/main/java/org/rx/reactive/package.html index dd99e9f8ddb..f94b00cba8d 100644 --- a/rxjava-core/src/main/java/org/rx/reactive/package.html +++ b/rxjava-core/src/main/java/org/rx/reactive/package.html @@ -1,3 +1,20 @@ +

A library that enables subscribing to and composing asynchronous events and callbacks.

From 4af9e6c0e12e1019f5902723515c4123b1cbf12e Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Thu, 10 Jan 2013 16:25:52 -0800 Subject: [PATCH 6/6] Javadoc generation --- gradle/doclet-exclude.jar | Bin 0 -> 3309 bytes gradle/javadocStyleSheet.css | 59 +++++++++++++++++++++++++++++++++++ rxjava-core/build.gradle | 13 ++++++++ 3 files changed, 72 insertions(+) create mode 100644 gradle/doclet-exclude.jar create mode 100644 gradle/javadocStyleSheet.css diff --git a/gradle/doclet-exclude.jar b/gradle/doclet-exclude.jar new file mode 100644 index 0000000000000000000000000000000000000000..4e4fd963804a0d99411f00635f35478f3640187b GIT binary patch literal 3309 zcmbuBcTf{f7RO@{0s=}C5fPvxgzPo?ydml|G(M37{=`S}ja+3x8W^{my z05t_2S@0uuMFBNg^+$>d+B*Ddil?0bz_wb~S5+vOzn>Bc=IQC`t<(}65}C%&;(-87 zD2TMe54e8gSE}p3hUPy7bp9eB^=sGB*;>Hd(%~80#@W`z)zZPm(m}w&5pHMcD)8{{ zLBSJl=VoEa{*R~(bFi?pbmoWK!CYK2b&d3H=rT-lk*Nx+%gFQCf2w-PKr?X1G=}6| zB8HywV!D5IK6aiegi~a>>*7+xk@!k!Q&ocdVfJ1d$PX3GpZwK_)1Xf@0Ecg#_g=*G zp6+>Iv(8Spc>R&y?^syNre8$Ksokp|Mp+*RxOy+st(4#rWM>p5CLm>LnROZKQPpbs zQwivhl&0RNY+;95U)8qMwP|p%}K2`^9NHg;vGf zIQjX$31KOtZm)>)ryYC5^w2YHP#f;8hsP`3>n&BHciPh^+$UZT(pgZH@p6lS6~!O6 z#f+&^BqX&b2@^i}P*n0}ct|pFPu3nfK#!2-uh>1(O+WTlL_=DS3^Hy@H&??KQ#SEr ze8&QZ6ABg=RoxG+^BQWRn9AMWGVQQC%D=d>Dq%JIg=Szf9&J66cdLWRXY0P$d)p&l zq>*)33B#Rf@JqK0pI$riE()R>###=&HzYzm7@Ar1&}!zvTj+rO^4l@F5D$w!LdMF; zU4^tIT3dz33x^7HV#Zg$KoA2A`YoYAr@@Nc4UIuuaHUJ$@qlK<$a9lcC17o3XAvX) zh|>bY0RwLlphT*QO>k^+)=5QZTk#v(>vZn)%KCTOPQ&G>1fSegdI2-$uw-0yWUKis9JY01=Gx<%ky3`;w3@_QOxD#k z%rgbnw_3g|__iNJXDDm}{W?793)n*Jr)+MwjYUijrpPdof`e6F8wfmej6(?Z^n@uC_- zC-oF(Q+@Pi^J}1F%a)_J6&Xj75Hg2lhHn|5Mq|_OtlV$u_lzyj>nCE%^F?(2{^NGp zr7mH`tF>_JyH0GbiU#8Hwh6mr4zy-mEj-d3?y1$%bM->z7v{oF1Cf;4er)BhV^toy zWuoiMg6oKuC*Va7n)KJH@A`&jKM1XD6{P37=Lh9zWGmjt>XY70X3Ld@31pvv&a1#ssH}K85daVY`cGAW|9_|ge|-BWy%P^Qz3aZ~zG|bYa&a_E z^n7xI6=QVtee_@Cz{ITS4m6Ad55r!@kHJJ>?wpyKc^4iO%2hoxLg0o+wTjJliNuQ0 zqUDRvmo(6GlBe=$W1Z29>e|Ji7x@8R6TI_fDAJMySe}DHfHX*h z;y=v+V`)vN!r3C#?!5^kv+Efv5i{mjH#kiZ!s`P~Bzr|OoLZ~#Ub}Gi6buyjZX$n| zOFs1ttR83-A73lh*hA8=Mlbwn&dGIFn$pA-X1^N*Pf)ps$u^SV)o(6)oJ#;>rxYoj z?BwNIPk>iaOodE%>X)0gGqeoXbCs4^3`Yn6jCP`!bt>M!@F+eijj>VGMdGVJMWYPW zI-;UWLGSPz&d$El8+?NpF|h^3C}}dAEAu*(N@TqMo-h^^x>**&9FVy`S~y4jgWBdg zMB4Y~Y(PXb*^jz>_X{WCGoy#GWB#QStIEz5kDgM#NWp72Y#inc7cGL4vX-R;sH}&J z!&xb#X;||*_6EjcafuRpu*Q%NP3WT_-6d_6WMFIe4PW$IUfP?Fc7(mA!Xu2*kY8#} z3I%}m8*8O+0%r@FPOw(T*R^;r=a{uphYVN*qCowVFLOjs_}(MBc!-@K0bF9 zF{-L!FqaJrd1bgFOAaiiNWam!eg9I!V+dYf;VY%O3Y)>aD+NqHyK+Ua3N6(2bsp6e zsOD*8lF(E&OF<$E(bi6gsvnKm+8Udr^9s1T@ckpiqU(uQv? z!9*1BCoS7guw}9%d*E^0JGQd7%U@epK;!QZmSJ!1$>k*u6(B;cYJ+Qv4s<7!6pq=i zM%**@3%Y;@5|(JkOrw}XyA|Jsn~)XayI165HC2}`lN!Tu!;RcuXRWw%!8OnY5CJdrl@paivn z74=X)_%vIzSi#s)(zB&=cB&!*24Ui**N@wA8Q}45=)vpHbC$x~sfjb>9}DM%AXDKZ zn{^?#MA8v2wG=xvHnr)qVtX9{vqlX_hEz|m^>uWW3syL(g39Kr zovD|x->imNd)~ryn8GAJM@nLGIm(jFI%HFzHwlE=$~Hkuv!$`#7xz~aeFhoJaB799 z{^ML`_sXJG!v<&BBo!~I-tq_}h5V`AY^0v3v{*x)8cQ-Go%*|X4S}$B1|4kY?W}-4a9DdP#TBK8*y!T_~ zQ1vS>cir8+I}tMTL_bXR7qz1YXtdCq42ygm9?r!Y*uCut|R zeHfnYNqVDKov_=5S4y3u6C{!h+gZ%f2A|83580}i5T-Q^B8R{p