Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Merging changes for Third party dependencies upgrade #665

Merged
merged 3 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions boms/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<cxf.version>3.1.9</cxf.version>
<cxf.version>3.2.5</cxf.version>
<mmm.util.version>7.5.1</mmm.util.version>
<oasp.flatten.mode>bom</oasp.flatten.mode>
</properties>
Expand Down Expand Up @@ -108,12 +108,6 @@
<artifactId>cglib</artifactId>
<version>3.2.5</version>
</dependency>
<!-- Support for dynamic and type-safe JPA queries -->
Copy link
Member

@hohwille hohwille Aug 10, 2018

Choose a reason for hiding this comment

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

Why was this query-dsl dependency removed from BOM? Does the new spring-boot parent already come with a more recent version of this dependency?

Copy link
Member

Choose a reason for hiding this comment

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

I verified that 4.1.4 is used. Seems fine.

<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>4.1.4</version>
</dependency>
<!-- DataBase Connection Pooling -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -143,7 +137,7 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
<version>2.1</version>
</dependency>
<!-- CXF for REST and Webservices -->
<dependency>
Expand Down Expand Up @@ -181,6 +175,12 @@
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- Json Dependency -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
</dependency>
<!-- Jackson for JSON mapping -->
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
Expand Down Expand Up @@ -240,7 +240,7 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ public void execute(Operation operation, List<String> configurations, String job
throws Exception {

// get sources of configuration
Object[] configurationObjects = new Object[configurations.size()];
Class<?>[] configurationClasses = new Class[configurations.size()];
for (int i = 0; i < configurations.size(); i++) {

configurationObjects[i] = getConfiguration(configurations.get(i));
configurationClasses[i] = Class.forName(configurations.get(i));
}

SpringApplication app = new SpringApplication(configurationObjects);
SpringApplication app = new SpringApplication(configurationClasses);

// no (web) server needed
app.setWebEnvironment(false);
Expand All @@ -182,14 +182,14 @@ public void execute(Operation operation, List<String> configurations, String job
ConfigurableApplicationContext ctx = app.run(new String[0]);

switch (operation) {
case START:
startBatch(ctx, jobName, parameters);
break;
case STOP:
stopBatch(ctx, jobName);
break;
default:
throw new RuntimeException("Unknown operation: " + operation);
case START:
startBatch(ctx, jobName, parameters);
break;
case STOP:
stopBatch(ctx, jobName);
break;
default:
throw new RuntimeException("Unknown operation: " + operation);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ protected <E> Page<E> findPaginatedGeneric(Pageable pageable, JPAQuery<E> query,
if (determineTotal) {
total = query.clone().fetchCount();
}
int offset = 0;
long offset = 0;
if (pageable != null) {
offset = pageable.getOffset();
query.offset(offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,4 @@ public void delete(Iterable<? extends E> entities) {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.io.Serializable;
import java.util.Collection;

import net.sf.mmm.util.exception.api.ObjectNotFoundException;
import net.sf.mmm.util.exception.api.ObjectNotFoundUserException;

import org.springframework.data.jpa.repository.JpaRepository;
Expand Down Expand Up @@ -42,16 +41,11 @@ public interface GenericRepository<E, ID extends Serializable>
/**
* @param id the {@link net.sf.mmm.util.entity.api.PersistenceEntity#getId() primary key}. May not be {@code null}.
* @return the requested entity. Never {@code null}.
* @throws ObjectNotFoundException if the requested entity does not exist.
* @see #findOne(java.io.Serializable)
* @see #findById(java.io.Serializable)
*/
default E find(ID id) throws ObjectNotFoundException {
default E find(ID id) {

E entity = findOne(id);
if (entity == null) {
throw new ObjectNotFoundUserException(getEntityClass(), id);
}
return entity;
return findById(id).orElseThrow(() -> new ObjectNotFoundUserException(getEntityClass(), id));
}

/**
Expand Down
4 changes: 4 additions & 0 deletions modules/logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<artifactId>oasp4j-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

why do we need that for logging module? IMHO there is no need to couple this with spring.
Maybe just a test dependency and forgot to add the scope?

</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.WebApplicationContext;

import io.oasp.module.logging.common.api.DiagnosticContextFacade;

Expand All @@ -39,6 +41,9 @@ public class DiagnosticContextFilter implements Filter {
/** @see #setCorrelationIdHttpHeaderName(String) */
private String correlationIdHttpHeaderName;

@Autowired
private WebApplicationContext webApplicationContext;

private DiagnosticContextFacade diagnosticContextFacade;

/**
Expand Down Expand Up @@ -141,8 +146,8 @@ public void init(FilterConfig config) throws ServletException {
// ClassNotFoundException and use the fallback in the catch statement.
ServletContext servletContext = config.getServletContext();
org.springframework.web.context.WebApplicationContext springContext;
springContext =
org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(servletContext);
springContext = org.springframework.web.context.support.WebApplicationContextUtils
.getWebApplicationContext(servletContext);
this.diagnosticContextFacade = springContext.getBean(DiagnosticContextFacade.class);
} catch (Throwable e) {
LOG.warn("DiagnosticContextFacade not defined in spring. Falling back to default", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void testCorrelationIdHttpHeaderNameAfterConstructor() {
DiagnosticContextFilter filter = new DiagnosticContextFilter();

// exercise
String correlationIdHttpHeaderName =
(String) ReflectionTestUtils.getField(filter, CORRELATION_ID_HEADER_NAME_PARAM);
String correlationIdHttpHeaderName = (String) ReflectionTestUtils.getField(filter,
CORRELATION_ID_HEADER_NAME_PARAM);

// verify
assertThat(correlationIdHttpHeaderName).isNotNull();
Expand All @@ -56,8 +56,8 @@ public void testInitWithNullInitParameter() throws Exception {
filter.init(this.config);

// verify
String correlationIdHttpHeaderName =
(String) ReflectionTestUtils.getField(filter, CORRELATION_ID_HEADER_NAME_PARAM);
String correlationIdHttpHeaderName = (String) ReflectionTestUtils.getField(filter,
CORRELATION_ID_HEADER_NAME_PARAM);
assertThat(correlationIdHttpHeaderName).isNotNull()
.isEqualTo(DiagnosticContextFilter.CORRELATION_ID_HEADER_NAME_DEFAULT);
}
Expand All @@ -76,8 +76,8 @@ public void testInitWithNonDefaultParameter() throws Exception {
// exercise
filter.init(this.config);
// verify
String correlationIdHttpHeaderName =
(String) ReflectionTestUtils.getField(filter, CORRELATION_ID_HEADER_NAME_PARAM);
String correlationIdHttpHeaderName = (String) ReflectionTestUtils.getField(filter,
CORRELATION_ID_HEADER_NAME_PARAM);
assertThat(correlationIdHttpHeaderName).isEqualTo(nonDefaultParameter);
}
}
2 changes: 1 addition & 1 deletion modules/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;

import io.oasp.module.basic.common.api.config.ConfigProperties;
Expand All @@ -24,8 +24,7 @@
*
* @since 3.0.0
*/
public class ServiceDiscovererImplConfig
implements ServiceDiscoverer, ApplicationListener<EmbeddedServletContainerInitializedEvent> {
public class ServiceDiscovererImplConfig implements ServiceDiscoverer, ApplicationListener<WebServerInitializedEvent> {

// @Value("${local.server.port}")
private int localServerPort;
Expand All @@ -45,9 +44,9 @@ public void setConfig(ServiceConfig config) {
}

@Override
public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
public void onApplicationEvent(WebServerInitializedEvent event) {

this.localServerPort = event.getEmbeddedServletContainer().getPort();
this.localServerPort = event.getWebServer().getPort();
}

@Override
Expand Down Expand Up @@ -107,8 +106,8 @@ private String resolveVariables(String url2, String application) {

String resolvedUrl = url2;
resolvedUrl = resolvedUrl.replace(ServiceConstants.VARIABLE_APP, application);
resolvedUrl =
resolvedUrl.replace(ServiceConstants.VARIABLE_LOCAL_SERVER_PORT, Integer.toString(this.localServerPort));
resolvedUrl = resolvedUrl.replace(ServiceConstants.VARIABLE_LOCAL_SERVER_PORT,
Integer.toString(this.localServerPort));
return resolvedUrl;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
</modules>

<properties>
<java.version>1.7</java.version>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<oasp4j.version>3.0.0-SNAPSHOT</oasp4j.version>
<oasp4j.version>3.0.0-alpha.1</oasp4j.version>
<oasp.flatten.mode>oss</oasp.flatten.mode>
<spring.boot.version>1.5.3.RELEASE</spring.boot.version>
<spring.boot.version>2.0.4.RELEASE</spring.boot.version>
<javadoc.option.doclint></javadoc.option.doclint>
<maven.archetype.version>3.0.1</maven.archetype.version>
</properties>
Expand Down Expand Up @@ -338,7 +338,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.7.RELEASE</version>
<version>2.0.4.RELEASE</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package ${package};

import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;

import io.oasp.module.jpa.dataaccess.api.AdvancedRevisionEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

<!-- For Bean-Validation (JSR 303) -->
<dependency>
<groupId>org.hibernate</groupId>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>

Expand Down Expand Up @@ -265,4 +265,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ public BinaryObjectEto saveBinaryObject(Blob data, BinaryObjectEto binaryObjectE
@Override
public void deleteBinaryObject(Long binaryObjectId) {

this.binaryObjectRepository.delete(binaryObjectId);
this.binaryObjectRepository.deleteById(binaryObjectId);
Copy link
Member

Choose a reason for hiding this comment

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

Woah. So spring-data changed their API in an incompatible way? That is not so great to here. I will double check...

Copy link
Member

Choose a reason for hiding this comment

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

Verified. Nothing we can do about it but good that we have these upgrades before we actually spread out spring-data support in devon.


}

@Override
public BinaryObjectEto findBinaryObject(Long binaryObjectId) {

return getBeanMapper().map(this.binaryObjectRepository.findOne(binaryObjectId), BinaryObjectEto.class);
return getBeanMapper().map(this.binaryObjectRepository.find(binaryObjectId), BinaryObjectEto.class);
Copy link
Member

Choose a reason for hiding this comment

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

As it seems the spring-data guys have renamed findOne to getOne. After things have been spread out to the wild these breaking API changes will not amuse the projects I assume. We should consider this for devonfw-forge/devcon#135

}

@Override
public Blob getBinaryObjectBlob(Long binaryObjectId) {

return this.binaryObjectRepository.findOne(binaryObjectId).getData();
return this.binaryObjectRepository.find(binaryObjectId).getData();
}

}
Loading