-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #853 from cherylking/springBoot3Support
Spring boot3 support
- Loading branch information
Showing
18 changed files
with
520 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
src/test/groovy/io/openliberty/tools/gradle/TestSpringBootApplication30.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* (C) Copyright IBM Corporation 2023. | ||
* | ||
* 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 | ||
* | ||
* http://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 io.openliberty.tools.gradle | ||
|
||
import groovy.xml.QName | ||
import org.junit.* | ||
import org.junit.rules.TestName | ||
|
||
public class TestSpringBootApplication30 extends AbstractIntegrationTest{ | ||
static File resourceDir = new File("build/resources/test/sample.springboot3") | ||
static String buildFilename = "springboot_3_archive.gradle" | ||
|
||
File buildDir; | ||
|
||
@Rule | ||
public TestName testName = new TestName(); | ||
|
||
@Before | ||
public void setup() { | ||
buildDir = new File(integTestDir, "/" + testName.getMethodName()) | ||
createDir(buildDir) | ||
createTestProject(buildDir, resourceDir, testName.getMethodName() + '.gradle') | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
runTasks(buildDir,'libertyStop') | ||
} | ||
|
||
|
||
@Test | ||
public void test_spring_boot_apps_30() { | ||
try { | ||
runTasks(buildDir, 'deploy', 'libertyStart') | ||
|
||
String webPage = new URL("http://localhost:9080").getText() | ||
Assert.assertEquals("Did not get expected http response.","Hello!", webPage) | ||
Assert.assertTrue('defaultServer/dropins has app deployed', | ||
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0) | ||
Assert.assertTrue('no app in apps folder', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT.jar").exists() ) | ||
} catch (Exception e) { | ||
throw new AssertionError ("Fail on task deploy.", e) | ||
} | ||
} | ||
|
||
@Test | ||
public void test_spring_boot_classifier_apps_30() { | ||
try { | ||
runTasks(buildDir, 'deploy', 'libertyStart') | ||
|
||
String webPage = new URL("http://localhost:9080").getText() | ||
Assert.assertEquals("Did not get expected http response.","Hello!", webPage) | ||
Assert.assertTrue('defaultServer/dropins has app deployed', | ||
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0) | ||
Assert.assertTrue('no app in apps folder', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT-test.jar").exists() ) | ||
} catch (Exception e) { | ||
throw new AssertionError ("Fail on task deploy.", e) | ||
} | ||
} | ||
|
||
@Test | ||
public void test_spring_boot_classifier_apps_30_no_feature() { | ||
try { | ||
runTasks(buildDir, 'deploy') | ||
|
||
Assert.assertTrue('defaultServer/dropins has app deployed', | ||
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0) | ||
Assert.assertTrue('no app in apps folder', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT-test.jar").exists() ) | ||
} catch (Exception e) { | ||
throw new AssertionError ("Fail on task deploy.", e) | ||
} | ||
} | ||
|
||
@Test | ||
public void test_spring_boot_war_apps_30() { | ||
try { | ||
runTasks(buildDir, 'deploy', 'libertyStart') | ||
|
||
String webPage = new URL("http://localhost:9080").getText() | ||
Assert.assertEquals("Did not get expected http response.","Hello!", webPage) | ||
Assert.assertTrue('defaultServer/dropins has app deployed', | ||
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0) | ||
Assert.assertTrue('no app in apps folder', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT.war").exists() ) | ||
} catch (Exception e) { | ||
throw new AssertionError ("Fail on task deploy.", e) | ||
} | ||
} | ||
|
||
@Test | ||
public void test_spring_boot_war_classifier_apps_30() { | ||
try { | ||
runTasks(buildDir, 'deploy', 'libertyStart') | ||
|
||
String webPage = new URL("http://localhost:9080").getText() | ||
Assert.assertEquals("Did not get expected http response.","Hello!", webPage) | ||
Assert.assertTrue('defaultServer/dropins has app deployed', | ||
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0) | ||
Assert.assertTrue('no app in apps folder', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT-test.war").exists() ) | ||
} catch (Exception e) { | ||
throw new AssertionError ("Fail on task deploy.", e) | ||
} | ||
} | ||
|
||
@Test | ||
public void test_spring_boot_dropins_30() { | ||
try { | ||
runTasks(buildDir, 'deploy', 'libertyStart') | ||
String webPage = new URL("http://localhost:9080").getText() | ||
Assert.assertEquals("Did not get expected http response.","Hello!", webPage) | ||
Assert.assertTrue('defaultServer/dropins/spring has no app', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/dropins/spring/thin-${testName.getMethodName()}-1.0-SNAPSHOT.jar").exists()) | ||
Assert.assertTrue('apps folder should be empty', | ||
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps").list().size() == 0 ) | ||
} catch (Exception e) { | ||
throw new AssertionError ("Fail on task deploy.", e) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//Empty |
18 changes: 18 additions & 0 deletions
18
src/test/resources/sample.springboot3/src/main/java/com/ibm/test/springboot/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.ibm.test.springboot; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@SpringBootApplication | ||
@RestController | ||
public class App { | ||
public static void main(String[] args) { | ||
SpringApplication.run(App.class, args); | ||
} | ||
@RequestMapping("/") | ||
public String index() { | ||
return "Hello!"; | ||
} | ||
} |
Oops, something went wrong.