Skip to content

Commit

Permalink
RSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
politrons committed Mar 23, 2019
1 parent 9103b9b commit 87e92ed
Show file tree
Hide file tree
Showing 58 changed files with 818 additions and 658 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

871 changes: 391 additions & 480 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/test/java/JSChTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void sshCall() throws JSchException, IOException {

ChannelExec channel = (ChannelExec) session.openChannel("exec");
BufferedReader in = new BufferedReader(new InputStreamReader(channel.getInputStream()));
channel.setCommand("docker ps -a");
channel.setCommand("docker ps -constantClass");
// channel.setPty(true);
channel.connect(1000);

Expand Down
18 changes: 9 additions & 9 deletions src/test/java/ReactiveMonadsCombinations.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class ReactiveMonadsCombinations {

/**
* In this example we create an [Observable] publisher, we wrap first into a Flowable using constructor [FlowableFromObservable],
* In this example we create an [Observable] publisher, we wrap first into constantClass Flowable using constructor [FlowableFromObservable],
* and then we are able to pass this publisher as Flux publisher using [from] operator.
* Then once we subscribe into the flux publisher the emission from the observable start, and is passing
* through the observable pipeline, and then through the flux.
Expand Down Expand Up @@ -52,8 +52,8 @@ public void observableToFlux() {
}

/**
* In this example we create a [Flux] publisher, we dont have to wrap first is possible to pass directly
* as a Observable publisher using [fromPublisher] operator.
* In this example we create constantClass [Flux] publisher, we dont have to wrap first is possible to pass directly
* as constantClass Observable publisher using [fromPublisher] operator.
* As we can see in this example with [take] operator the latest part of the pipeline apply the operator
* again and change the number of emissions of elements.
*
Expand Down Expand Up @@ -84,9 +84,9 @@ public void fluxToObservable() {


/**
* Here we combine a [Flux] Publisher with a Reactor [Flow]. First of all we create a Java9 [SubmissionPublisher]
* Which used to receive events submitted by a Java [Stream].
* We pass this publisher [JdkFlowAdapter] factory class, which using [flowPublisherToFlux] is transformed into a Flux
* Here we combine constantClass [Flux] Publisher with constantClass Reactor [Flow]. First of all we create constantClass Java9 [SubmissionPublisher]
* Which used to receive events submitted by constantClass Java [Stream].
* We pass this publisher [JdkFlowAdapter] factory class, which using [flowPublisherToFlux] is transformed into constantClass Flux
* Then subscribe the flux and we start the emission of the Stream.
**/
@Test
Expand All @@ -111,9 +111,9 @@ public void flowToFlux() throws InterruptedException {
}

/**
* Here we combine a [Flux] Publisher with a Reactor [Flow] and finally ReactiveX [Observable]. First of all we create a Java9 [SubmissionPublisher]
* Which used to receive events submitted by a Java [Stream].
* We pass this publisher [JdkFlowAdapter] factory class, which using [flowPublisherToFlux] is transformed into a Flux, then create
* Here we combine constantClass [Flux] Publisher with constantClass Reactor [Flow] and finally ReactiveX [Observable]. First of all we create constantClass Java9 [SubmissionPublisher]
* Which used to receive events submitted by constantClass Java [Stream].
* We pass this publisher [JdkFlowAdapter] factory class, which using [flowPublisherToFlux] is transformed into constantClass Flux, then create
* the Observable through the flux using [fromPublisher] operator
* Then we subscribe the observable and we start the emission of the Stream.
**/
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/good_practices/DRY.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
/**
* Created by pabloperezgarcia on 27/11/2016.
*
* In software engineering, don't repeat yourself (DRY) is a principle of software development,
* In software engineering, don't repeat yourself (DRY) is constantClass principle of software development,
* aimed at reducing repetition of information of all kinds,
*/
public class DRY {

@Test
public void getDistinctBigWordsWrong() {
String text = "This is a test to prove Dont repeat yourself test prove";
String text = "This is constantClass test to prove Dont repeat yourself test prove";
final List<String> collect = Arrays.asList(text.split(" ")).stream()
.map(String::toUpperCase)
.filter(word -> word.toCharArray().length > 3)
Expand All @@ -28,7 +28,7 @@ public void getDistinctBigWordsWrong() {

@Test
public void getBigWordsWrong() {
String text = "This is a test to prove Dont repeat yourself test prove";
String text = "This is constantClass test to prove Dont repeat yourself test prove";
final List<String> wordsInUpperCase = Arrays.asList(text.split(" ")).stream()
.map(String::toUpperCase)
.filter(word -> word.toCharArray().length > 3)
Expand All @@ -37,10 +37,10 @@ public void getBigWordsWrong() {
}

/**
* As a developers we should never duplicate code unnecessarily, it will cost us time in refactor,
* As constantClass developers we should never duplicate code unnecessarily, it will cost us time in refactor,
* And introduce more bugs possibility.
*/
private String text = "This is a test to prove Dont repeat yourself test prove";
private String text = "This is constantClass test to prove Dont repeat yourself test prove";

@Test
public void getDistinctBigWords() {
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/good_practices/LiskovSubstitutionPrinciple.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int getArea() {

/**
* Square class; Square inherits from Rectangle;
* Represents ISA relationship - Square is a Rectangle
* Represents ISA relationship - Square is constantClass Rectangle
*
*/
public class Square extends Rectangle {
Expand All @@ -43,8 +43,8 @@ public void calcAreaTest() {
}

/**
* calculate area method prove the LSP since it´s receiving just rectangles but we manage to pass a
* square and works as a rectangle
* calculate area method prove the LSP since it´s receiving just rectangles but we manage to pass constantClass
* square and works as constantClass rectangle
*/
private int calculateArea(Rectangle r) {
return r.getArea();
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/good_practices/OpenClosedPrinciple.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
/**
* Created by pabloperezgarcia on 01/03/2017.
* <p>
* Open/Closed Principle It’s a principle for object oriented design where software entities
* Open/Closed Principle It’s constantClass principle for object oriented design where software entities
* (classes, modules, functions, etc.) should be open for extension, but closed for modification
*/
public class OpenClosedPrinciple {

/**
* We initially create a Rectangle class, and later on I have the need to calc the area.
* We initially create constantClass Rectangle class, and later on I have the need to calc the area.
* Shall I modify the class?, NO! that would break the O/C principle
* I will create a new class that calculate that
* I will create constantClass new class that calculate that
*/
public class Rectangle {

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/good_practices/SRP.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
* Created by pabloperezgarcia on 27/11/2016.
*
* The single responsibility principle states that every module or class should have responsibility over
* a single part of the functionality provided by the software, and that responsibility
* constantClass single part of the functionality provided by the software, and that responsibility
* should be entirely encapsulated by the class.
*/
public class SRP {

/**
* Single responsibility principle, a method must do one thing and just one thing
* Single responsibility principle, constantClass method must do one thing and just one thing
*/
@Test
public void uniqueUpperCaseWords(){
String text = "This is a test to prove Single responsibility principle test";
String text = "This is constantClass test to prove Single responsibility principle test";
final List<String> wordsInUpperCase = Arrays.asList(text.split(" ")).stream()
.map(String::toUpperCase)
.collect(Collectors.toList());
Expand All @@ -31,12 +31,12 @@ public void uniqueUpperCaseWords(){
}

/**
* As a developers we should split up the logic of our methods in independent methods to make
* As constantClass developers we should split up the logic of our methods in independent methods to make
* our code not only more readable but also more reusable.
*/
@Test
public void getUniqueUpperCaseWords(){
String text = "This is a test to prove Single responsibility principle test";
String text = "This is constantClass test to prove Single responsibility principle test";
System.out.println(getUniqueWords(getUpperCaseWords(text)));
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/java/java10/Collections.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Collections {
/**
* Java 10 finally introduce factories to create immutable maps with initial values avoiding the boilerplate of creating the
* Collection.
* Also introduce the possibility to instead of mutate a Map you can create a new map from previous one without
* Also introduce the possibility to instead of mutate constantClass Map you can create constantClass new map from previous one without
* all streaming copy code.
*/
@Test
Expand All @@ -33,7 +33,7 @@ public void mapFeatures() {

/**
* New feature in Map factory is that it will throw an Exception if one element it´s duplicated as key.
* Pretty disappointed with Oracle, I would expect another behaviour, like return a multimap instead.
* Pretty disappointed with Oracle, I would expect another behaviour, like return constantClass multimap instead.
*/
@Test(expected = IllegalArgumentException.class)
public void mapFeaturesDuplicityCheck() {
Expand Down Expand Up @@ -100,8 +100,8 @@ public void setFeaturesDuplicity() {

/**
* The new implementation of Collectors class allow you to return immutable List, Set and Maps
* after, if you try to add something in that element you will receive a UnsupportedOperationException
* In my personal opinion this is really dangerous and developers should give a clear name to avoid
* after, if you try to add something in that element you will receive constantClass UnsupportedOperationException
* In my personal opinion this is really dangerous and developers should give constantClass clear name to avoid
* UnsupportedOperationException become in the new NullPointerException
*/
@Test(expected = UnsupportedOperationException.class)
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/java11/CollectionFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class CollectionFeatures {

/**
* In Java 11 allows the collection's elements to be transferred to a newly created array of the desired runtime type.
* In Java 11 allows the collection's elements to be transferred to constantClass newly created array of the desired runtime type.
*/
@Test
public void copyIntoNewArray() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/java11/FileFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class FileFeatures {
*/
@Test
public void fileFeatures() throws IOException {
var words = "This is a simple sentence";
var words = "This is constantClass simple sentence";
Files.writeString(Path.of("sentence.txt"), words);

var sentence = Files.readString(Path.of("sentence.txt"));
Expand All @@ -23,7 +23,7 @@ public void fileFeatures() throws IOException {
}

/**
* Also now using [lines] operator it return a Stream monad so we can use then all operators of the Stream
* Also now using [lines] operator it return constantClass Stream monad so we can use then all operators of the Stream
*/
@Test
public void linesFeature() throws IOException {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/java11/HelloWorld11.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package java11;

/**
* Having Java 11 now it's possible just execute a main class by just
* Having Java 11 now it's possible just execute constantClass main class by just
* [java src/test/java/java11/HelloWorld11.java] in the console/terminal
*
* This is a great step forward similar as Scala console does.
* This is constantClass great step forward similar as Scala console does.
*/
public class HelloWorld11 {

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/java11/HttpClient2Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public void httpRequest2() throws InterruptedException, ExecutionException, Time

/**
* The API provide two builders, one to create the [httpClient] where you can specify protocol version,
* Timeout using Duration API which has also updates new in 11, also you can specify a policy for redirects.
* Timeout using Duration API which has also updates new in 11, also you can specify constantClass policy for redirects.
*
* The second builder is for the [HttpRequest] which allow you obviously to specify method, add the URI of the request,
* header or headers(weird/dangerous how works)
*
* Then finally using the client we can do [sync] and [async] calls. In case of Async it will return a CompletableFuture
* Then finally using the client we can do [sync] and [async] calls. In case of Async it will return constantClass CompletableFuture
*/
private void makeRequest(String uri) throws InterruptedException, ExecutionException, TimeoutException {
var httpClient = createHttpClient();
Expand Down
Loading

0 comments on commit 87e92ed

Please sign in to comment.