Skip to content

Commit

Permalink
#148 aspects up
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 28, 2023
1 parent f7c0543 commit e68989b
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 47 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<img alt="logo" src="http://www.jare.io/images/logo.svg" width="64" height="64"/>

[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
[![Managed by Zerocracy](https://www.0crat.com/badge/C9V3GAG9H.svg)](https://www.0crat.com/p/C9V3GAG9H)
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/jare)](http://www.rultor.com/p/yegor256/jare)
[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ software.
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.24.1</version>
<version>0.25.1</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
Expand Down
Empty file added src/main/aspect/.gitkeep
Empty file.
29 changes: 0 additions & 29 deletions src/main/aspect/README.txt

This file was deleted.

3 changes: 1 addition & 2 deletions src/main/java/io/jare/Logs.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package io.jare;

import com.jcabi.aspects.ScheduleWithFixedDelay;
import com.jcabi.aspects.Tv;
import com.jcabi.log.Logger;
import com.jcabi.s3.Bucket;
import com.jcabi.s3.Ocket;
Expand Down Expand Up @@ -167,7 +166,7 @@ private static void parse(final Map<String, Map<Date, Long>> map,
final CharSequence line) {
final Matcher matcher = Logs.PTN.matcher(line);
if (matcher.find()) {
final String domain = URI.create(matcher.group(Tv.THREE)).getHost();
final String domain = URI.create(matcher.group(3)).getHost();
if (!map.containsKey(domain)) {
map.put(domain, new HashMap<>(0));
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/jare/dynamo/DyBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package io.jare.dynamo;

import com.amazonaws.services.dynamodbv2.model.Select;
import com.jcabi.aspects.Tv;
import com.jcabi.dynamo.Conditions;
import com.jcabi.dynamo.QueryValve;
import com.jcabi.dynamo.Region;
Expand Down Expand Up @@ -100,7 +99,7 @@ public Iterable<Domain> all() {
.through(
new ScanValve()
.withAttributeToGet("user", "domain", "total", "usage")
.withLimit(Tv.THOUSAND)
.withLimit(1000)
)
.stream()
.map(DyDomain::new)
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/jare/dynamo/DyUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.amazonaws.services.dynamodbv2.model.AttributeAction;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.AttributeValueUpdate;
import com.jcabi.aspects.Tv;
import com.jcabi.dynamo.Item;
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
Expand Down Expand Up @@ -93,7 +92,7 @@ public void add(final Date date, final long bytes) throws IOException {
new Directives().xpath(
String.format(
"/usage/day[number(@id) < %d]",
DyUsage.asNumber(DateUtils.addDays(new Date(), -Tv.THIRTY))
DyUsage.asNumber(DateUtils.addDays(new Date(), -30))
)
).remove()
).applyQuietly(node);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/jare/dynamo/DyUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package io.jare.dynamo;

import com.amazonaws.services.dynamodbv2.model.Select;
import com.jcabi.aspects.Tv;
import com.jcabi.dynamo.Attributes;
import com.jcabi.dynamo.Conditions;
import com.jcabi.dynamo.QueryValve;
Expand Down Expand Up @@ -76,7 +75,7 @@ public Iterable<Domain> mine() {
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(Tv.HUNDRED)
.withLimit(100)
.withConsistentRead(false)
.withIndexName("mine")
)
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/jare/tk/Destination.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package io.jare.tk;

import com.jcabi.aspects.Tv;
import java.net.HttpURLConnection;
import java.net.URI;
import org.takes.HttpException;
Expand Down Expand Up @@ -75,7 +74,7 @@ public String path() throws HttpException {
String.format("URI \"%s\" doesn't have a host", this.uri)
);
}
final StringBuilder path = new StringBuilder(Tv.HUNDRED);
final StringBuilder path = new StringBuilder(100);
if (this.uri.getRawPath().isEmpty()) {
path.append('/');
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/io/jare/dynamo/DyUsageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package io.jare.dynamo;

import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.jcabi.aspects.Tv;
import com.jcabi.dynamo.Attributes;
import com.jcabi.dynamo.Item;
import com.jcabi.dynamo.Region;
Expand Down Expand Up @@ -66,7 +65,7 @@ public void recordsUsage() throws Exception {
public void ignoresOldData() throws Exception {
final Usage usage = new DyUsage(DyUsageTest.item());
usage.add(new Date(), 1L);
usage.add(DateUtils.addDays(new Date(), -Tv.FIFTY), 1L);
usage.add(DateUtils.addDays(new Date(), -50), 1L);
MatcherAssert.assertThat(usage.total(), Matchers.equalTo(1L));
}

Expand Down
7 changes: 3 additions & 4 deletions src/test/java/io/jare/dynamo/DyUserITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package io.jare.dynamo;

import com.jcabi.aspects.Tv;
import io.jare.model.Base;
import io.jare.model.Domain;
import io.jare.model.User;
Expand Down Expand Up @@ -68,17 +67,17 @@ public void addsAndRemoveDomains() throws Exception {
public void listsMineDomains() throws Exception {
final Base base = new DyBase(new Dynamo());
final User user = base.user("willy");
for (int idx = 0; idx < Tv.TEN; ++idx) {
for (int idx = 0; idx < 10; ++idx) {
user.add(String.format("facebook-%d.com", idx));
}
final Iterable<Domain> list = user.mine();
MatcherAssert.assertThat(
list,
Matchers.iterableWithSize(Tv.TEN)
Matchers.iterableWithSize(10)
);
MatcherAssert.assertThat(
list,
Matchers.iterableWithSize(Tv.TEN)
Matchers.iterableWithSize(10)
);
}

Expand Down

0 comments on commit e68989b

Please sign in to comment.