Skip to content

Commit

Permalink
#1127 lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 11, 2022
1 parent eb270c2 commit 2f4ef1d
Show file tree
Hide file tree
Showing 78 changed files with 745 additions and 1,335 deletions.
20 changes: 2 additions & 18 deletions .rultor.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
docker:
image: yegor256/rultor-image:1.9.1
assets:
settings.xml: yegor256/home#assets/takes/settings.xml
pubring.gpg: yegor256/home#assets/pubring.gpg
secring.gpg: yegor256/home#assets/secring.gpg
env:
MAVEN_OPTS: -XX:MaxPermSize=256m -Xmx1g
JAVA_OPTS: -XX:MaxPermSize=256m -Xmx1g
decrypt:
curl-appveyor.cfg: repo/curl-appveyor.cfg.asc
architect:
- paulodamaso
- yegor256
Expand All @@ -19,19 +16,6 @@ merge:
pdd --source=$(pwd) --verbose --file=/dev/null
mvn clean install -Pqulice --errors --settings ../settings.xml
mvn clean site -Psite --errors --settings ../settings.xml
deploy:
script: |
version=$(curl -K ../curl-appveyor.cfg --data "{accountName: 'yegor256', projectSlug: 'takes', branch: 'master'}" https://ci.appveyor.com/api/builds | jq -r '.version')
while true
do status=$(curl -K ../curl-appveyor.cfg https://ci.appveyor.com/api/projects/yegor256/takes/build/${version} | jq -r '.build.status')
if [ "${status}" == "null" ]; then exit 1; fi
if [ "${status}" == "success" ]; then break; fi
if [ "${status}" == "failed" ]; then echo "see https://ci.appveyor.com/project/yegor256/takes/build/${version}"; exit 1; fi
echo "waiting for AppVeyor build ${version}: ${status}"
sleep 5s
done
mvn clean deploy -Pqulice --errors --settings ../settings.xml
mvn clean
release:
script: |-
[[ "${tag}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
Expand Down
59 changes: 35 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ SOFTWARE.
<role>Architect</role>
<role>Developer</role>
</roles>
<timezone>-7</timezone>
<timezone>+3</timezone>
</developer>
<developer>
<id>1</id>
<id>2</id>
<name>Olivier B. OURA</name>
<email>baudoliver7@gmail.com</email>
<organization>Baudoliver7.com</organization>
Expand Down Expand Up @@ -100,40 +100,44 @@ SOFTWARE.
</properties>
<dependencies>
<!--
Pay attention that we are NOT allowed to use ANY third-party
dependencies here, unless they are in PROVIDED, TEST of RUNTIME
scope. The project must be self-sufficient and work in a single
JAR dependency.
-->
Pay attention that we are NOT allowed to use ANY third-party
dependencies here, unless they are in PROVIDED, TEST of RUNTIME
scope. The project must be self-sufficient and work in a single
JAR dependency.
-->
<dependency>
<groupId>org.cactoos</groupId>
<artifactId>cactoos</artifactId>
<!--
@todo #880:30min Once Cactoos is updated to qulice >=0.18.5
remove all references to Files.newXXX static methods and
replace them with OO objects such as InputOf or OutputOf
depending on the need. See
https://github.com/yegor256/takes/pull/886#issuecomment-446030223
for details.
-->
<version>0.50</version>
@todo #880:30min Once Cactoos is updated to qulice >=0.18.5
remove all references to Files.newXXX static methods and
replace them with OO objects such as InputOf or OutputOf
depending on the need. See
https://github.com/yegor256/takes/pull/886#issuecomment-446030223
for details.
-->
<version>0.50.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
Expand All @@ -144,6 +148,7 @@ SOFTWARE.
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-xml</artifactId>
<version>0.23.1</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -174,9 +179,8 @@ SOFTWARE.
<dependency>
<groupId>com.jcabi.incubator</groupId>
<artifactId>xembly</artifactId>
<version>0.25.0</version>
<version>0.26.2</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.restfb</groupId>
Expand All @@ -199,11 +203,13 @@ SOFTWARE.
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -215,16 +221,19 @@ SOFTWARE.
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-matchers</artifactId>
<version>1.5.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-log</artifactId>
<version>0.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -242,17 +251,25 @@ SOFTWARE.
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.1-b06</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<version>1.8.0-alpha2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.8.0-alpha2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down Expand Up @@ -317,12 +334,6 @@ SOFTWARE.
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--
@todo #1110:1h There are 18 tests that fail now, mostly due to versions
upgrade (or an old Mockito version).
We must fix them ASAP and then remove the next line
-->
<testFailureIgnore>true</testFailureIgnore>
<argLine>-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US ${argLine}</argLine>
<excludedGroups>org.takes.misc.PerformanceTests</excludedGroups>
<systemPropertyVariables>
Expand Down
23 changes: 10 additions & 13 deletions src/main/java/org/takes/facets/auth/XeIdentity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,18 @@ public final class XeIdentity extends XeWrap {
*/
public XeIdentity(final Request req) {
super(
new XeSource() {
@Override
public Iterable<Directive> toXembly() throws IOException {
final Identity identity = new RqAuth(req).identity();
final Directives dirs = new Directives();
if (!identity.equals(Identity.ANONYMOUS)) {
dirs.add("identity")
.add("urn").set(identity.urn()).up();
for (final Map.Entry<String, String> prop
: identity.properties().entrySet()) {
dirs.add(prop.getKey()).set(prop.getValue()).up();
}
() -> {
final Identity identity = new RqAuth(req).identity();
final Directives dirs = new Directives();
if (!identity.equals(Identity.ANONYMOUS)) {
dirs.add("identity")
.add("urn").set(identity.urn()).up();
for (final Map.Entry<String, String> prop
: identity.properties().entrySet()) {
dirs.add(prop.getKey()).set(prop.getValue()).up();
}
return dirs;
}
return dirs;
}
);
}
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/takes/facets/cookies/TkJoinedCookies.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ public final class TkJoinedCookies extends TkWrap {
*/
public TkJoinedCookies(final Take take) {
super(
new Take() {
@Override
public Response act(final Request req) throws Exception {
return TkJoinedCookies.join(take.act(req));
}
}
req -> TkJoinedCookies.join(take.act(req))
);
}

Expand Down
20 changes: 8 additions & 12 deletions src/main/java/org/takes/facets/fallback/FbChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,16 @@ public FbChain(final Fallback... fallbacks) {
)
public FbChain(final Iterable<Fallback> fallbacks) {
super(
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req)
throws Exception {
Opt<Response> rsp = new Opt.Empty<>();
for (final Fallback fbk : fallbacks) {
final Opt<Response> opt = fbk.route(req);
if (opt.has()) {
rsp = opt;
break;
}
req -> {
Opt<Response> rsp = new Opt.Empty<>();
for (final Fallback fbk : fallbacks) {
final Opt<Response> opt = fbk.route(req);
if (opt.has()) {
rsp = opt;
break;
}
return rsp;
}
return rsp;
}
);
}
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/takes/facets/fallback/FbEmpty.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ public final class FbEmpty extends FbWrap {
*/
public FbEmpty() {
super(
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req) {
return new Opt.Empty<>();
}
}
req -> new Opt.Empty<>()
);
}

Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/takes/facets/fallback/FbFixed.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,7 @@ public FbFixed(final Response response) {
*/
public FbFixed(final Take take) {
super(
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req)
throws Exception {
return new Opt.Single<>(take.act(req));
}
}
req -> new Opt.Single<>(take.act(req))
);
}

Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/takes/facets/fallback/FbLog4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,9 @@ public final class FbLog4j extends FbWrap {
*/
public FbLog4j() {
super(
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req)
throws IOException {
FbLog4j.log(req);
return new Opt.Empty<>();
}
req -> {
FbLog4j.log(req);
return new Opt.Empty<>();
}
);
}
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/takes/facets/fallback/FbSlf4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ public final class FbSlf4j extends FbWrap {
*/
public FbSlf4j() {
super(
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req)
throws IOException {
FbSlf4j.log(req);
return new Opt.Empty<>();
}
req -> {
FbSlf4j.log(req);
return new Opt.Empty<>();
}
);
}
Expand Down
Loading

4 comments on commit 2f4ef1d

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 2f4ef1d Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 880-047513c4 discovered in pom.xml) and submitted as #1128. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 2f4ef1d Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 958-0a721823 discovered in pom.xml) and submitted as #1129. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 2f4ef1d Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 1088-edea3e4b discovered in pom.xml) and submitted as #1130. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 2f4ef1d Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 950-e017cfba discovered in src/main/java/org/takes/rq/multipart/RqMtBase.java) and submitted as #1131. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.