Skip to content

Commit

Permalink
#113 license fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 13, 2022
1 parent c033a6d commit 4d178c6
Show file tree
Hide file tree
Showing 59 changed files with 137 additions and 132 deletions.
20 changes: 8 additions & 12 deletions .rultor.yml
@@ -1,26 +1,22 @@
install:
- sudo gem install pdd -v 0.20.5
- sudo gem install xcop -v 0.6
docker:
image: yegor256/rultor-image:1.9.1
install: |
pdd --file=/dev/null
assets:
secring.gpg: yegor256/home#assets/secring.gpg
settings.xml: yegor256/home#assets/jcabi/settings.xml
pubring.gpg: yegor256/home#assets/pubring.gpg
env:
MAVEN_OPTS: -XX:MaxPermSize=256m -Xmx1g
merge:
script: |-
pdd -f /dev/null
mvn clean install -Pqulice --errors --settings ../settings.xml
deploy:
script: |-
pdd -f /dev/null
mvn clean deploy -Pqulice --errors --settings ../settings.xml
release:
pre: false
sensitive:
- settings.xml
script: |-
pdd -f /dev/null
mvn versions:set "-DnewVersion=${tag}"
git commit -am "${tag}"
mvn clean deploy -Pqulice -Psonatype -Pjcabi --errors --settings ../settings.xml
# mvn clean site-deploy -Pjcabi -Psite --errors --settings ../settings.xml
commanders:
- yegor256
mvn clean site-deploy -Pjcabi -Psite --errors --settings ../settings.xml
5 changes: 1 addition & 4 deletions README.md
@@ -1,14 +1,11 @@
<img src="http://img.jcabi.com/logo-square.png" width="64px" height="64px" />
<img alt="logo" src="http://img.jcabi.com/logo-square.png" width="64px" height="64px" />

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

[![Build Status](https://travis-ci.org/jcabi/jcabi-dynamo.svg?branch=master)](https://travis-ci.org/jcabi/jcabi-dynamo)
[![PDD status](http://www.0pdd.com/svg?name=jcabi/jcabi-dynamo)](http://www.0pdd.com/p?name=jcabi/jcabi-dynamo)
[![Build status](https://ci.appveyor.com/api/projects/status/6hiv73p1f55qttdy/branch/master?svg=true)](https://ci.appveyor.com/project/yegor256/jcabi-dynamo/branch/master)
[![Coverage Status](https://coveralls.io/repos/jcabi/jcabi-dynamo/badge.svg?branch=__rultor&service=github)](https://coveralls.io/github/jcabi/jcabi-dynamo?branch=__rultor)
[![Javadoc](https://javadoc.io/badge/com.jcabi/jcabi-dynamo.svg)](http://www.javadoc.io/doc/com.jcabi/jcabi-dynamo)

[![jpeek report](https://i.jpeek.org/com.jcabi/jcabi-dynamo/badge.svg)](https://i.jpeek.org/com.jcabi/jcabi-dynamo/)
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -223,6 +223,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<excludes combine.children="append">
<exclude>findbugs:.*</exclude>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/AttributeUpdates.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Attributes.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/AwsFrame.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/AwsItem.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/AwsIterator.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/AwsTable.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Conditions.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
35 changes: 26 additions & 9 deletions src/main/java/com/jcabi/dynamo/Credentials.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down Expand Up @@ -29,8 +29,10 @@
*/
package com.jcabi.dynamo;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.regions.RegionUtils;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
Expand All @@ -52,7 +54,7 @@ public interface Credentials {
/**
* Test credentials, for unit testing mostly.
*/
Credentials TEST = new Credentials.Simple(
Credentials.Simple TEST = new Credentials.Simple(
"AAAAAAAAAAAAAAAAAAAA",
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
);
Expand All @@ -69,6 +71,8 @@ public interface Credentials {

/**
* Simple implementation.
*
* @since 0.1
*/
@Immutable
@Loggable(Loggable.DEBUG)
Expand Down Expand Up @@ -132,6 +136,7 @@ public AmazonDynamoDB aws() {
/**
* Assumed AWS IAM role.
*
* @since 0.1
* @see <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/role-usecase-ec2app.html">Granting Applications that Run on Amazon EC2 Instances Access to AWS Resources</a>
*/
@Immutable
Expand Down Expand Up @@ -176,6 +181,8 @@ public AmazonDynamoDB aws() {

/**
* With explicitly specified endpoint.
*
* @since 0.1
*/
@Immutable
@Loggable(Loggable.DEBUG)
Expand All @@ -184,7 +191,7 @@ final class Direct implements Credentials {
/**
* Original credentials.
*/
private final transient Credentials origin;
private final transient Credentials.Simple origin;
/**
* Endpoint.
*/
Expand All @@ -194,7 +201,7 @@ final class Direct implements Credentials {
* @param creds Original credentials
* @param pnt Endpoint
*/
public Direct(final Credentials creds, final String pnt) {
public Direct(final Credentials.Simple creds, final String pnt) {
this.origin = creds;
this.endpoint = pnt;
}
Expand All @@ -203,19 +210,29 @@ public Direct(final Credentials creds, final String pnt) {
* @param creds Original credentials
* @param port Port number for localhost
*/
public Direct(final Credentials creds, final int port) {
public Direct(final Credentials.Simple creds, final int port) {
this(creds, String.format("http://localhost:%d", port));
}
@Override
public String toString() {
return String.format("%s at %s", this.origin, this.endpoint);
}
@Override
@SuppressWarnings("deprecation")
public AmazonDynamoDB aws() {
final AmazonDynamoDB aws = this.origin.aws();
aws.setEndpoint(this.endpoint);
return aws;
return AmazonDynamoDBClientBuilder.standard()
.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration(
this.endpoint, this.endpoint
)
)
.withCredentials(
new AWSStaticCredentialsProvider(
new BasicAWSCredentials(
this.origin.key, this.origin.secret
)
)
)
.build();
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Dosage.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Frame.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Item.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/QueryValve.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Region.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/ScanValve.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Table.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Throughput.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/Valve.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down
100 changes: 47 additions & 53 deletions src/main/java/com/jcabi/dynamo/mock/H2Data.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down Expand Up @@ -56,8 +56,6 @@
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.sql.DataSource;
import lombok.EqualsAndHashCode;
import lombok.ToString;
Expand All @@ -77,6 +75,28 @@
@SuppressWarnings({ "PMD.TooManyMethods", "PMD.ExcessiveImports" })
public final class H2Data implements MkData {

/**
* Create primary key.
*/
private static final Function<String, String> CREATE_KEY =
key -> String.format("%s VARCHAR PRIMARY KEY", key);

/**
* Create attr.
*/
private static final Function<String, String> CREATE_ATTR =
key -> String.format("%s CLOB", key);

/**
* WHERE clauses are joined with this.
*/
private static final String AND = " AND ";

/**
* JDBC URL.
*/
private final transient String jdbc;

/**
* Fetcher of rows.
*/
Expand Down Expand Up @@ -127,56 +147,30 @@ private Attributes fetch(final ResultSet rset) throws SQLException {
* @checkstyle AnonInnerLengthCheck (100 lines)
* @checkstyle LineLength (3 lines)
*/
private static final Function<Map.Entry<String, Condition>, String> SELECT_WHERE =
new Function<Map.Entry<String, Condition>, String>() {
@Override
public String apply(final Map.Entry<String, Condition> cnd) {
final String opr;
if (cnd.getValue().getComparisonOperator()
.equals(ComparisonOperator.GT.toString())) {
opr = ">";
} else if (cnd.getValue().getComparisonOperator()
.equals(ComparisonOperator.LT.toString())) {
opr = "<";
} else if (cnd.getValue().getComparisonOperator()
.equals(ComparisonOperator.EQ.toString())) {
opr = "=";
} else {
throw new UnsupportedOperationException(
String.format(
// @checkstyle LineLength (1 line)
"At the moment only EQ/GT/LT operators are supported: %s",
cnd.getValue().getComparisonOperator()
)
);
}
return String.format(
"%s %s ?", cnd.getKey(), opr
);
}
};

/**
* Create primary key.
*/
private static final Function<String, String> CREATE_KEY =
key -> String.format("%s VARCHAR PRIMARY KEY", key);

/**
* Create attr.
*/
private static final Function<String, String> CREATE_ATTR =
key -> String.format("%s CLOB", key);

/**
* WHERE clauses are joined with this.
*/
private static final String AND = " AND ";

/**
* JDBC URL.
*/
private final transient String jdbc;
private static final Function<Map.Entry<String, Condition>, String> SELECT_WHERE = cnd -> {
final String opr;
if (cnd.getValue().getComparisonOperator()
.equals(ComparisonOperator.GT.toString())) {
opr = ">";
} else if (cnd.getValue().getComparisonOperator()
.equals(ComparisonOperator.LT.toString())) {
opr = "<";
} else if (cnd.getValue().getComparisonOperator()
.equals(ComparisonOperator.EQ.toString())) {
opr = "=";
} else {
throw new UnsupportedOperationException(
String.format(
// @checkstyle LineLength (1 line)
"At the moment only EQ/GT/LT operators are supported: %s",
cnd.getValue().getComparisonOperator()
)
);
}
return String.format(
"%s %s ?", cnd.getKey(), opr
);
};

/**
* Public ctor.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jcabi/dynamo/mock/MadeTable.java
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2012-2022, jcabi.com
* All rights reserved.
*
Expand Down

0 comments on commit 4d178c6

Please sign in to comment.