Skip to content

JSON B in web ui #749

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

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright 2021 - 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sbm;

import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.IOException;
import java.nio.file.Path;

@SpringBootTest(properties = {
"spring.shell.interactive.enabled=false",
"spring.shell.script.enabled=false",
"sbm.gitSupportEnabled=false"
})
public abstract class IntegrationTestBaseClass {

/**
* Points to the source root directory where example projects are expected.
*
* See {@link #getTestSubDir()}.
*/
public static final String TESTCODE_DIR = "src/test/resources/testcode/";

/**
* Points to the target root directory where example projects will be copied to.
*
* See {@link #getTestSubDir()}.
*/
public static final String INTEGRATION_TEST_DIR = "./target/sbm-integration-test/";

private Path testDir;

private String output;


@BeforeEach
public void beforeEach() throws IOException {
testDir = Path.of(INTEGRATION_TEST_DIR).resolve(getTestSubDir());
clearTestDir();
testDir.resolve(this.getClass().getName());
FileUtils.forceMkdir(testDir.toFile());
testDir = testDir.toRealPath();
}

/**
* Copies example project used for integrationTest.
*/
protected void intializeTestProject() {
try {
Path s = Path.of(TESTCODE_DIR).resolve(getTestSubDir());
FileUtils.copyDirectory(s.toFile(), getTestDir().toFile());
} catch (IOException e) {
throw new RuntimeException(e);
}
}


protected abstract String getTestSubDir();

protected Path getTestDir() {
return testDir;
}


@AfterEach
public void afterEach() throws IOException {
clearTestDir();
}

private void clearTestDir() throws IOException {
if (getTestDir().toFile().exists()) {
FileUtils.forceDelete(getTestDir().toFile());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2021 - 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sbm;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.DefaultApplicationArguments;

import static org.assertj.core.api.Assertions.assertThat;

public class ReportTestSingleModule extends IntegrationTestBaseClass {

@Autowired
private SpringBootMigratorRunner springBootMigratorRunner;

@Autowired
private ReportHolder reportHolder;

@Override
protected String getTestSubDir() {
return "boot-migration-27-30";
}


@Test
public void generatesAllRelevantSection() {
intializeTestProject();

springBootMigratorRunner.run(new DefaultApplicationArguments(getTestDir().toString()));

assertThat(reportHolder.getReport()).contains("Constructor Binding");
assertThat(reportHolder.getReport()).contains("Johnzon Dependency Upgrade");
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Features used in the current project**

* ehcache in pom is mentioned this helps validate our migration to spring 3 where ehcache classifier has to be used to resolve version.
* Uses Constructor binding on classes which will be removed when migrating to Spring 3
* Uses PagingAndSortingRepo interface where CrudRepo has been removed.
* Uses properties that will be removed/moved on spring 3 migration
* Uses micrometer packages which are moved to a new structure.

Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>boot-upgrade-27_30</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>boot-upgrade-27_30</name>
<description>boot-upgrade-27_30</description>
<properties>
<java.version>17</java.version>
<spring-cloud.version>2021.0.4</spring-cloud.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.26.3</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
<version>3.1.5</version>
</dependency>
<dependency>
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>spring-snapshot</id>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-release</id>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.hello;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GreetingConfig {

@Bean
public String hello() {
return "こんにちは";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.springboot.example.ehcache;

import org.ehcache.event.CacheEvent;
import org.ehcache.event.CacheEventListener;

public class EventLogger implements CacheEventListener<Object, Object> {
@Override
public void onEvent(CacheEvent<?, ?> cacheEvent) {
System.out.println("My ehcache event listener is called");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.springboot.example.upgrade;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class BootUpgrade2730Application {

public static void main(String[] args) {
SpringApplication.run(BootUpgrade2730Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.springboot.example.upgrade;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConfigurationProperties(prefix = "mail")
@ConstructorBinding
public class ConstructorBindingConfig {
private String hostName;

public ConstructorBindingConfig(String hostName) {
this.hostName = hostName;
}
}
Loading