org.springframework.util.FileCopyUtils



API Populatity

12 Client projects

Related APIs
2 java.net.URLDecoder
Project spring-projects/spring-boot in file ...ngframework.boot.loader.tools.RepackagerTests.java (2014-03-17)
@@ -30,6 +30,7 @@ import org.junit.rules.ExpectedException;
 import org.junit.rules.TemporaryFolder;
 import org.springframework.boot.loader.tools.sample.ClassWithMainMethod;
 import org.springframework.boot.loader.tools.sample.ClassWithoutMainMethod;
+import org.springframework.util.FileCopyUtils;
 
 import static org.hamcrest.Matchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -256,6 +257,8 @@ public class RepackagerTests {
 		TestJarFile libJar = new TestJarFile(this.temporaryFolder);
 		libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class);
 		final File libJarFile = libJar.getFile();
+		final File libNonJarFile = this.temporaryFolder.newFile();
+		FileCopyUtils.copy(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, libNonJarFile);
 		this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
 		File file = this.testJarFile.getFile();
 		Repackager repackager = new Repackager(file);
@@ -263,9 +266,11 @@ public class RepackagerTests {
 			@Override
 			public void doWithLibraries(LibraryCallback callback) throws IOException {
 				callback.library(libJarFile, LibraryScope.COMPILE);
+				callback.library(libNonJarFile, LibraryScope.COMPILE);
 			}
 		});
 		assertThat(hasEntry(file, "lib/" + libJarFile.getName()), equalTo(true));
+		assertThat(hasEntry(file, "lib/" + libNonJarFile.getName()), equalTo(false));
 	}
 
 	@Test
Project spring-projects/spring-boot in file ...work.boot.gradle.MultiProjectRepackagingTests.java (2014-08-21)
@@ -24,7 +24,6 @@ import org.gradle.tooling.ProjectConnection;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.springframework.boot.dependency.tools.ManagedDependencies;
-import org.springframework.util.FileCopyUtils;
 
 import static org.hamcrest.Matchers.notNullValue;
 import static org.junit.Assert.assertThat;
@@ -48,10 +47,8 @@ public class MultiProjectRepackagingTests {
 
 	@Test
 	public void repackageWithTransitiveFileDependency() throws Exception {
-		FileCopyUtils.copy(new File("src/test/resources/foo.jar"), new File(
-				"target/multi-project-repackage/foo.jar"));
 		project.newBuild().forTasks("clean", "build")
-		.withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run();
+				.withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run();
 		File buildLibs = new File("target/multi-project-repackage/main/build/libs");
 		JarFile jarFile = new JarFile(new File(buildLibs, "main.jar"));
 		assertThat(jarFile.getEntry("lib/commons-logging-1.1.3.jar"), notNullValue());
Project flyway/flyway in file ...ore.dbsupport.oracle.OracleSqlScriptSmallTest.java (2010-07-20)
@@ -19,7 +19,10 @@ package com.googlecode.flyway.core.dbsupport.oracle;
 import com.googlecode.flyway.core.runtime.SqlStatement;
 import org.junit.Test;
 import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.FileCopyUtils;
 
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.List;
 
@@ -30,9 +33,10 @@ import static org.junit.Assert.assertEquals;
  */
 public class OracleSqlScriptSmallTest {
     @Test
-    public void testSqlStatements() {
-        OracleSqlScript sqlScript =
-                new OracleSqlScript(new ClassPathResource("migration/oracle/sql/V1.sql"), new HashMap<String, String>());
+    public void testSqlStatements() throws Exception {
+        String source = FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource("migration/oracle/sql/V1.sql").getInputStream(), Charset.forName("UTF-8")));
+
+        OracleSqlScript sqlScript = new OracleSqlScript(source, new HashMap<String, String>());
         List<SqlStatement> sqlStatements = sqlScript.getSqlStatements();
         assertEquals(3, sqlStatements.size());
         assertEquals(18, sqlStatements.get(0).getLineNumber());