update of dependencies

This commit is contained in:
Michele Artini 2021-07-06 13:29:38 +02:00
parent 80d0aba5c3
commit 8c45ff2ef2
14 changed files with 67 additions and 74 deletions

View File

@ -31,6 +31,7 @@ public class LiteratureBrokerServiceConfiguration extends AbstractElasticsearchC
@Override
@Bean
public RestHighLevelClient elasticsearchClient() {
final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
.connectedTo(elasticSearchProperties.getClusterNodes().split(","))
.withConnectTimeout(elasticSearchProperties.getConnectionTimeout())

View File

@ -8,7 +8,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.Operator;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery;
import org.elasticsearch.index.search.MatchQueryParser.ZeroTermsQuery;
import eu.dnetlib.broker.common.utils.DateParser;

View File

@ -1,15 +1,12 @@
package eu.dnetlib.broker;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Ignore
@RunWith(SpringRunner.class)
@Disabled
@SpringBootTest
public class LiteratureBrokerServiceApplicationTests {
class LiteratureBrokerServiceApplicationTests {
@Test
public void contextLoads() {}

View File

@ -1,7 +1,7 @@
package eu.dnetlib.broker.integration;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestTemplate;
import eu.dnetlib.broker.objects.OaBrokerEventPayload;
@ -16,7 +16,7 @@ public class ScrollTest {
private static final String subscriptionId = "sub-c9767c84-3597-462b-803b-2d3e09de44c4";
@Test
@Ignore
@Disabled
public void testScroll() {
int total = 0;

View File

@ -6,11 +6,10 @@ import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
@ -20,7 +19,6 @@ import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.objects.OaBrokerEventPayload;
@ -29,8 +27,8 @@ import eu.dnetlib.broker.openaire.AdvQueryObject;
import eu.dnetlib.broker.openaire.ElasticSearchQueryUtils;
import eu.dnetlib.broker.openaire.Range;
@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@Disabled
@SpringBootTest
@ContextConfiguration(locations = {
"classpath:/applicationContext-test-queries.xml"
})
@ -41,13 +39,8 @@ public class OpenaireQueriesTest {
@Autowired
private ElasticsearchOperations esOperations;
@Before
public void setUp() throws Exception {
}
@Test
@Ignore
@Disabled
public void testAdvancedShowEvents() {
final AdvQueryObject qObj = new AdvQueryObject();

View File

@ -25,23 +25,7 @@
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.0-cdh5.9.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>

View File

@ -1,7 +1,7 @@
package eu.dnetlib.broker.oa.integration;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestTemplate;
import eu.dnetlib.broker.api.ShortEventMessage;
@ -18,7 +18,7 @@ public class ScrollTest {
public class TestScrollPage extends ScrollPage<ShortEventMessage> {}
@Test
@Ignore
@Disabled
public void testScroll() {
int total = 0;

View File

@ -42,22 +42,8 @@
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.0-cdh5.9.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>parquet-hadoop</artifactId>

View File

@ -131,6 +131,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -7,7 +7,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
@Document(indexName = "#{elasticSearchProperties.eventsIndexName}", shards = 48, replicas = 1, refreshInterval = "600s")
@Document(indexName = "#{@elasticSearchProperties.getEventsIndexName()}")
public class Event {
@Id

View File

@ -11,7 +11,7 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
import eu.dnetlib.broker.common.subscriptions.Subscription;
@Document(indexName = "#{elasticSearchProperties.notificationsIndexName}", shards = 48, replicas = 1, refreshInterval = "600s")
@Document(indexName = "#{@elasticSearchProperties.getNotificationsIndexName()}")
public class Notification {
@Id

View File

@ -5,7 +5,7 @@ import javax.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@Component("elasticSearchProperties")
@ConfigurationProperties(prefix = "lbs.elastic")
public class ElasticSearchProperties {

View File

@ -12,7 +12,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.Operator;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery;
import org.elasticsearch.index.search.MatchQueryParser.ZeroTermsQuery;
import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.common.utils.DateParser;
@ -87,8 +87,9 @@ public class MapCondition {
case LIST_STRING:
return ((List<?>) val).stream().map(Object::toString).anyMatch(s -> cp.verify(s, operator));
case LIST_DATE:
return ((List<?>) val).stream().map(o -> o instanceof Date ? (Date) o : DateParser.parse(o.toString()))
.anyMatch(s -> cp.verify(s, operator));
return ((List<?>) val).stream()
.map(o -> o instanceof Date ? (Date) o : DateParser.parse(o.toString()))
.anyMatch(s -> cp.verify(s, operator));
case LIST_INTEGER:
return ((List<?>) val).stream().map(Object::toString).map(NumberUtils::toInt).anyMatch(n -> cp.verify(n, operator));
case LIST_FLOAT:
@ -123,8 +124,9 @@ public class MapCondition {
private QueryBuilder createSimpleOperator(final ConditionParams p) {
if (StringUtils.isNotBlank(p.getValue())) {
return QueryBuilders.matchQuery("map." + field, convertToType(p.getValue())).operator(Operator.AND)
.zeroTermsQuery(ZeroTermsQuery.ALL);
return QueryBuilders.matchQuery("map." + field, convertToType(p.getValue()))
.operator(Operator.AND)
.zeroTermsQuery(ZeroTermsQuery.ALL);
} else {
return null;
}
@ -133,8 +135,9 @@ public class MapCondition {
private QueryBuilder createListOperator(final List<ConditionParams> list) {
final BoolQueryBuilder query = QueryBuilders.boolQuery();
for (final ConditionParams p : list) {
query.should(QueryBuilders.matchQuery("map." + field, convertToType(p.getValue())).operator(Operator.AND)
.zeroTermsQuery(ZeroTermsQuery.ALL));
query.should(QueryBuilders.matchQuery("map." + field, convertToType(p.getValue()))
.operator(Operator.AND)
.zeroTermsQuery(ZeroTermsQuery.ALL));
}
return query;
}
@ -142,8 +145,8 @@ public class MapCondition {
private QueryBuilder createSimpleRangeOperator(final ConditionParams p) {
if (StringUtils.isNotBlank(p.getValue()) || StringUtils.isNotBlank(p.getOtherValue())) {
return QueryBuilders.rangeQuery("map." + field)
.from(convertToType(p.getValue()))
.to(convertToType(p.getOtherValue()));
.from(convertToType(p.getValue()))
.to(convertToType(p.getOtherValue()));
} else {
return null;
}
@ -154,9 +157,9 @@ public class MapCondition {
for (final ConditionParams p : list) {
query.should(QueryBuilders
.rangeQuery("map." + field)
.from(convertToType(p.getValue()))
.to(convertToType(p.getOtherValue())));
.rangeQuery("map." + field)
.from(convertToType(p.getValue()))
.to(convertToType(p.getOtherValue())));
}
return query;
}

27
pom.xml
View File

@ -3,7 +3,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<version>2.5.2</version>
<relativePath />
</parent>
@ -228,6 +228,31 @@
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!-- Hadoop -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.0-cdh5.9.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>