Skip to content

Commit

Permalink
Remove guava from tests, it is not provided by nebula-test anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
chali committed Jun 9, 2021
1 parent ff6311f commit f4e1715
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.netflix.gradle.plugins.application

import com.google.common.base.Throwables
import com.netflix.gradle.plugins.deb.Scanner
import nebula.test.IntegrationSpec
import org.junit.Rule
Expand All @@ -39,7 +38,7 @@ class OspackageApplicationSpringBootPluginLauncherSpec extends IntegrationSpec {
def result = runTasks("help")

then:
Throwables.getRootCause(result.failure).message == "The 'org.springframework.boot' plugin must be applied before applying this plugin"
result.failure.getCause().getCause().getCause().message == "The 'org.springframework.boot' plugin must be applied before applying this plugin"
}

String buildScript(String bootVersion, File startScript) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.netflix.gradle.plugins.deb

import com.google.common.io.Files
import nebula.test.ProjectSpec
import nebula.test.dependencies.DependencyGraph
import nebula.test.dependencies.GradleDependencyGenerator
Expand All @@ -32,7 +31,7 @@ class DebPluginTest extends ProjectSpec {
project.version = 1.0

File appleFile = new File(project.buildDir, 'src/apple')
Files.createParentDirs(appleFile)
FileUtils.forceMkdirParent(appleFile)
appleFile.text = 'apple'

when:
Expand Down Expand Up @@ -298,7 +297,7 @@ class DebPluginTest extends ProjectSpec {
project.version = 1.0

File scriptDir = new File(projectDir, 'src')
Files.createParentDirs(scriptDir)
FileUtils.forceMkdirParent(scriptDir)
scriptDir.mkdir()

File preinstallScript = new File(scriptDir, 'preinstall')
Expand All @@ -308,7 +307,7 @@ class DebPluginTest extends ProjectSpec {
postinstallScript.text = "#!/bin/bash\necho Postinstall"

File appleFile = new File(project.buildDir, 'src/apple')
Files.createParentDirs(appleFile)
FileUtils.forceMkdirParent(appleFile)
appleFile.text = 'apple'

project.apply plugin: 'nebula.deb'
Expand Down Expand Up @@ -336,7 +335,7 @@ class DebPluginTest extends ProjectSpec {
project.version = 1.0

File scriptDir = new File(project.buildDir, 'src')
Files.createParentDirs(scriptDir)
FileUtils.forceMkdirParent(scriptDir)
scriptDir.mkdir()

File installScript = new File(scriptDir, 'install')
Expand All @@ -349,7 +348,7 @@ class DebPluginTest extends ProjectSpec {
postinstallScript.text = "echo Postinstall"

File appleFile = new File(project.buildDir, 'src/apple')
Files.createParentDirs(appleFile)
FileUtils.forceMkdirParent(appleFile)
appleFile.text = 'apple'

project.apply plugin: 'nebula.deb'
Expand Down Expand Up @@ -1189,7 +1188,7 @@ class DebPluginTest extends ProjectSpec {
given:
File nodeModules = new File(projectDir, 'node_modules')
File file = new File(nodeModules, "memoizee/node_modules/es5-ext/string/#/at.js")
Files.createParentDirs(file)
FileUtils.forceMkdirParent(file)
file.text = "dummy"
project.apply plugin: 'nebula.deb'
Deb debTask = project.task('buildDeb', type: Deb) {
Expand All @@ -1215,7 +1214,7 @@ class DebPluginTest extends ProjectSpec {
File target = new File(packageDir,"my-script.sh")
target.createNewFile()
File file = new File(packageDir,'bin/my-symlink')
Files.createParentDirs(file)
FileUtils.forceMkdirParent(file)
java.nio.file.Files.createSymbolicLink(file.toPath(), target.toPath())

when:
Expand All @@ -1239,7 +1238,7 @@ class DebPluginTest extends ProjectSpec {
File target = new File(packageDir,"my-script.sh")
target.createNewFile()
File file = new File(packageDir,'bin/my-symlink')
Files.createParentDirs(file)
FileUtils.forceMkdirParent(file)
java.nio.file.Files.createSymbolicLink(file.toPath(), target.toPath())

when:
Expand All @@ -1263,7 +1262,7 @@ class DebPluginTest extends ProjectSpec {
given:
Path target = java.nio.file.Files.createTempFile("file-to-symlink-to", "sh")
File file = project.file('bin/my-symlink')
Files.createParentDirs(file)
FileUtils.forceMkdirParent(file)
java.nio.file.Files.createSymbolicLink(file.toPath(), target)

when:
Expand Down
4 changes: 2 additions & 2 deletions src/test/groovy/com/netflix/gradle/plugins/deb/Scanner.groovy
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.netflix.gradle.plugins.deb

import com.google.common.io.Files
import org.apache.commons.compress.archivers.ArchiveStreamFactory
import org.apache.commons.compress.archivers.ar.ArArchiveEntry
import org.apache.commons.compress.archivers.ar.ArArchiveInputStream
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
import org.apache.commons.io.FileUtils
import org.apache.commons.io.IOUtils

public class Scanner {
Expand Down Expand Up @@ -127,7 +127,7 @@ public class Scanner {
File outputFile = null
if(outputDir != null) {
outputFile = new File(outputDir, entry.getName()).getCanonicalFile()
Files.createParentDirs(outputFile);
FileUtils.forceMkdirParent(outputFile);

if(entry.isFile()) {
final OutputStream outputFileStream = new FileOutputStream(outputFile);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.netflix.gradle.plugins.rpm

import com.google.common.io.Files
import com.netflix.gradle.plugins.utils.GradleUtils
import nebula.test.IntegrationSpec
import nebula.test.dependencies.DependencyGraph
Expand Down Expand Up @@ -106,11 +105,11 @@ task buildRpm(type: Rpm) {
def 'category_on_spec'() {
given:
File bananaFile = new File(projectDir, 'test/banana')
Files.createParentDirs(bananaFile)
FileUtils.forceMkdirParent(bananaFile)
bananaFile.text = 'banana'

File appleFile = new File(projectDir, 'src/apple')
Files.createParentDirs(appleFile)
FileUtils.forceMkdirParent(appleFile)
appleFile.text = 'apple'

buildFile << """
Expand Down Expand Up @@ -147,7 +146,7 @@ task buildRpm(type: Rpm) {
def 'filter_expression'() {
given:
File appleFile = new File(projectDir, 'src/apple')
Files.createParentDirs(appleFile)
FileUtils.forceMkdirParent(appleFile)
appleFile.text = '{{BASE}}/apple'

buildFile << """
Expand Down Expand Up @@ -296,7 +295,7 @@ task buildRpm(type: Rpm) {
File target = new File(packageDir,"my-script.sh")
target.createNewFile()
File file = new File(packageDir,'bin/my-symlink')
Files.createParentDirs(file)
FileUtils.forceMkdirParent(file)
java.nio.file.Files.createSymbolicLink(file.toPath(), target.toPath())
buildFile << """
apply plugin: 'nebula.rpm'
Expand Down Expand Up @@ -325,7 +324,7 @@ task buildRpm(type: Rpm) {
File target = new File(packageDir,"my-script.sh")
target.createNewFile()
File file = new File(packageDir,'bin/my-symlink')
Files.createParentDirs(file)
FileUtils.forceMkdirParent(file)
java.nio.file.Files.createSymbolicLink(file.toPath(), target.toPath())
buildFile << """
apply plugin: 'nebula.rpm'
Expand Down

0 comments on commit f4e1715

Please sign in to comment.