Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced property literals with Properties constants #1912

Open
wants to merge 9 commits into
base: issues/1649
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<relativePath/>
</parent>

<artifactId>strongbox-masterbuild</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Strongbox: Masterbuild</name>
Expand Down
11 changes: 3 additions & 8 deletions strongbox-aql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<relativePath/>
</parent>

<artifactId>strongbox-aql</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Strongbox: AQL</name>
Expand Down Expand Up @@ -84,6 +84,7 @@
<artifactId>groovy-all</artifactId>
<version>${version.groovy}</version>
<scope>runtime</scope>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -138,12 +139,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${version.groovy}</version>
</dependency>

<dependency>
<groupId>org.jtwig</groupId>
<artifactId>jtwig-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package org.carlspring.strongbox.aql.grammar;

import static org.carlspring.strongbox.db.schema.Properties.STORAGE_ID;
import static org.carlspring.strongbox.db.schema.Properties.REPOSITORY_ID;
import static org.carlspring.strongbox.db.schema.Properties.LAST_UPDATED;

public enum AqlMapping
{

STORAGE("storageId"),
REPOSITORY("repositoryId"),
STORAGE(STORAGE_ID),
REPOSITORY(REPOSITORY_ID),
LAYOUT("artifactCoordinates.@class"),
VERSION("artifactCoordinates.version"),
TAG("tagSet.name"),
FROM("lastUpdated"),
TO("lastUpdated"),
AGE("lastUpdated");
FROM(LAST_UPDATED),
TO(LAST_UPDATED),
AGE(LAST_UPDATED);

private String property;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Paginator visitPageExp(PageExpContext ctx)
{
return paginator;
}
paginator.setSkip(Integer.valueOf(ctx.NUMBER().getText()));
paginator.setSkip(Long.valueOf(ctx.NUMBER().getText()));

return paginator;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import org.antlr.v4.runtime.Parser;
import org.carlspring.strongbox.aql.grammar.AQLParser.QueryContext;
import org.carlspring.strongbox.data.criteria.QueryParser;
import org.carlspring.strongbox.domain.ArtifactEntry;
import org.carlspring.strongbox.domain.ArtifactEntity;

/**
* @author sbespalov
*
*/
public class AqlQueryParser extends QueryParser<QueryContext, ArtifactEntry, AqlStatementVisitor>
public class AqlQueryParser extends QueryParser<QueryContext, ArtifactEntity, AqlStatementVisitor>
{

public AqlQueryParser(String query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
import org.carlspring.strongbox.data.criteria.Paginator;
import org.carlspring.strongbox.data.criteria.Predicate;
import org.carlspring.strongbox.data.criteria.Selector;
import org.carlspring.strongbox.domain.ArtifactEntry;
import org.carlspring.strongbox.domain.ArtifactEntity;

/**
* @author sbespalov
*
*/
public class AqlStatementVisitor extends AQLBaseVisitor<Selector<ArtifactEntry>>
public class AqlStatementVisitor extends AQLBaseVisitor<Selector<ArtifactEntity>>
{

private Selector<ArtifactEntry> selector = new Selector<>(ArtifactEntry.class);
private Selector<ArtifactEntity> selector = new Selector<>(ArtifactEntity.class);

public AqlStatementVisitor()
{
}

@Override
public Selector<ArtifactEntry> visitQuery(QueryContext ctx)
public Selector<ArtifactEntity> visitQuery(QueryContext ctx)
{
Predicate artifactPredicate = Predicate.of(ExpOperator.IS_NOT_NULL.of("artifactCoordinates"));
AqlQueryVisitor queryVisitor = new AqlQueryVisitor(artifactPredicate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import java.io.IOException;

import org.carlspring.strongbox.data.criteria.Selector;
import org.carlspring.strongbox.domain.ArtifactEntry;
import org.carlspring.strongbox.domain.ArtifactEntity;
import org.carlspring.strongbox.storage.search.SearchResults;

public interface AqlSearchService
{

public SearchResults search(Selector<ArtifactEntry> selector)
public SearchResults search(Selector<ArtifactEntity> selector)
throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;

import org.carlspring.strongbox.data.criteria.DetachQueryTemplate;
import org.carlspring.strongbox.data.criteria.OQueryTemplate;
import org.carlspring.strongbox.data.criteria.QueryTemplate;
import org.carlspring.strongbox.data.criteria.Selector;
import org.carlspring.strongbox.dependency.snippet.CodeSnippet;
import org.carlspring.strongbox.dependency.snippet.SnippetGenerator;
import org.carlspring.strongbox.domain.ArtifactEntry;
import org.carlspring.strongbox.domain.ArtifactEntity;
import org.carlspring.strongbox.providers.io.RepositoryFiles;
import org.carlspring.strongbox.providers.io.RepositoryPath;
import org.carlspring.strongbox.providers.io.RepositoryPathResolver;
Expand All @@ -30,7 +29,7 @@
public class AqlSearchServiceImpl implements AqlSearchService
{

@PersistenceContext
//@PersistenceContext
private EntityManager entityManager;

@Inject
Expand All @@ -39,14 +38,13 @@ public class AqlSearchServiceImpl implements AqlSearchService
@Inject
private SnippetGenerator snippetGenerator;

public SearchResults search(Selector<ArtifactEntry> selector)
public SearchResults search(Selector<ArtifactEntity> selector)
throws IOException
{
SearchResults result = new SearchResults();

QueryTemplate<List<ArtifactEntry>, ArtifactEntry> queryTemplate = new DetachQueryTemplate<>(
new OQueryTemplate<>(entityManager));
for (ArtifactEntry artifactEntry : queryTemplate.select(selector))
QueryTemplate<List<ArtifactEntity>, ArtifactEntity> queryTemplate = new OQueryTemplate<>(entityManager);
for (ArtifactEntity artifactEntry : queryTemplate.select(selector))
{
SearchResult r = new SearchResult();
result.getResults().add(r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.carlspring.strongbox.data.criteria.Predicate;
import org.carlspring.strongbox.data.criteria.QueryParserException;
import org.carlspring.strongbox.data.criteria.Selector;
import org.carlspring.strongbox.domain.ArtifactEntry;
import org.carlspring.strongbox.domain.ArtifactEntity;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -19,6 +19,9 @@
import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.assertThat;

import static org.carlspring.strongbox.db.schema.Properties.STORAGE_ID;

@Disabled
public class AqlParserTest
{

Expand All @@ -35,7 +38,7 @@ public void testLayoutSpecificKeywords()

logger.debug("Query [{}] parse tree:\n[{}]", query, aqlParser);

Selector<ArtifactEntry> selector = aqlParser.parseQuery();
Selector<ArtifactEntity> selector = aqlParser.parseQuery();
Predicate predicate = selector.getPredicate();

assertThat(predicate).isNotNull();
Expand Down Expand Up @@ -151,14 +154,14 @@ public void testValidQueryWithUpperLowercaseCheck()

logger.debug("Query [{}] parse tree:\n[{}]", query, aqlParser);

Selector<ArtifactEntry> selector = aqlParser.parseQuery();
Selector<ArtifactEntity> selector = aqlParser.parseQuery();
Predicate predicate = selector.getPredicate();

assertThat(predicate).isNotNull();
assertThat(predicate.isEmpty()).isFalse();
assertThat(aqlParser.hasErrors()).isFalse();

OQueryTemplate<Object, ArtifactEntry> queryTemplate = new OQueryTemplate<>(null);
OQueryTemplate<Object, ArtifactEntity> queryTemplate = new OQueryTemplate<>(null);

String sqlQuery = queryTemplate.calculateQueryString(selector);

Expand All @@ -170,7 +173,7 @@ public void testValidQueryWithUpperLowercaseCheck()
"ArtifactEntry " +
"WHERE " +
"artifactCoordinates IS NOT NULL " +
"AND ((storageId = :storageId_0) " +
"AND (("+ STORAGE_ID +" = :storageId_0) " +
"AND repositoryId = :repositoryId_1 " +
"OR (artifactCoordinates.coordinates.groupId = :groupId_1) " +
"AND ( NOT ((artifactCoordinates.coordinates.artifactId = :artifactId_1)) OR " +
Expand Down
4 changes: 2 additions & 2 deletions strongbox-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<relativePath/>
</parent>

<artifactId>strongbox-client</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Strongbox: Client</name>
Expand Down
4 changes: 2 additions & 2 deletions strongbox-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<relativePath/>
</parent>

<artifactId>strongbox-commons</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>

<name>Strongbox: Commons</name>

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"org.carlspring.strongbox.configuration",
"org.carlspring.strongbox.io",
"org.carlspring.strongbox.net",
"org.carlspring.strongbox.db",
"org.carlspring.strongbox.resource",
"org.carlspring.strongbox.rest",
"org.carlspring.strongbox.storage.repository",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static Object flattenObject(Object o)
return o;
}

private static Stream<Entry<String, Object>> flatten(Map<String, Object> map)
public static Stream<Entry<String, Object>> flatten(Map<String, Object> map)
{
return map.entrySet().stream().flatMap(CollectionUtils::flatten);
}
Expand Down
16 changes: 7 additions & 9 deletions strongbox-commons/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,16 @@ strongbox:
feed: false
version: @{project.version}
revision: @{strongbox.revision}
orientdb:
studio:
enabled: false
ip:
address: 127.0.0.1
port: 2480
server:
database:
path: ${strongbox.vault}/db
users:
external:
cache:
seconds: 300
sse:
timeoutMillis: 600000
graph:
gremlin:
server:
enabled: false
# Changes to these properties must also be applied to [strongbox/strongbox-web-integration-tests] and possibly the pipeline.
# Please ping us on our chat channel (https://chat.carlspring.org/) to confirm.
logging:
Expand All @@ -62,6 +57,9 @@ ehcache:
store:
dir: ${strongbox.vault}/cache
management:
health:
neo4j:
enabled: false
endpoint:
health:
show-details: always
Expand Down
4 changes: 2 additions & 2 deletions strongbox-configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<relativePath/>
</parent>

<artifactId>strongbox-configuration</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>

<name>Strongbox: Configuration</name>

Expand Down
4 changes: 2 additions & 2 deletions strongbox-cron/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<relativePath/>
</parent>

<artifactId>strongbox-cron</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Strongbox: Cron</name>
Expand Down