List of usage examples for org.apache.commons.io FileUtils readFileToString
public static String readFileToString(File file) throws IOException
From source file:de.eidottermihi.rpicheck.test.FirmwareTest.java
@Test public void firmware_hash() throws IOException, RaspiQueryException { String output = FileUtils.readFileToString( FileUtils.getFile("src/test/java/de/eidottermihi/rpicheck/test/vcgencmd_version.txt")); sessionMocker.withCommand("vcgencmd version", new CommandMocker().withResponse(output).mock()); String firmwareVersion = raspiQuery.queryFirmwareVersion("vcgencmd"); assertEquals("7789db48 (clean) (release)", firmwareVersion); }
From source file:io.fabric8.kubernetes.pipeline.devops.ApplyTest.java
@Test public void testAddRegistryToImageNameIfNotPresent() throws Exception { String json = FileUtils.readFileToString( new File(this.getClass().getResource("/kubernetesJsonWithoutRegistry.json").toURI())); String registry = "MY-REGISTRY:5000"; String expectedImageName = registry + "/TEST_NS/my-test-image:TEST-1.0"; testAddRegistryToImageName(json, registry, expectedImageName); }
From source file:com.playonlinux.core.scripts.ScriptRecentTest.java
@Test public void testDetectType_passARecentScript_FormatIsDetected() throws IOException { assertEquals(Script.Type.RECENT, Script.detectScriptType( FileUtils.readFileToString(new File(this.getClass().getResource("scriptExample.py").getPath())))); }
From source file:eu.optimis.datamanager.GetStoraceLocations.java
/** * @param args// w w w . j a va 2 s .co m */ //called at http://localhost:8080/eu.optimis.datamanager/rest/GetStorageLocations //file locations.xml must be on the server dir, or define different path //difference with SetPolicy the commons-io-1.3.1.jar @GET @Produces(MediaType.TEXT_XML) public String returnLocations() { File file = new File("locations.xml"); try { String content = FileUtils.readFileToString(file); return content; } catch (Exception e) { e.printStackTrace(); return "Failed"; } }
From source file:fr.fastconnect.tibco.businessworks.fcunit.AssertXMLEqualTest.java
private String getActual() throws IOException { return FileUtils.readFileToString(new File("src/test/resources/actual.xml")); }
From source file:de.eidottermihi.rpicheck.test.MemoryTest.java
@Test public void memory() throws RaspiQueryException, IOException { String output = FileUtils.readFileToString( FileUtils.getFile("src/test/java/de/eidottermihi/rpicheck/test/proc_meminfo.txt")); sessionMocker.withCommand(MemoryQuery.MEMORY_INFO_CMD, new CommandMocker().withResponse(output).mock()); RaspiMemoryBean memoryBean = raspiQuery.queryMemoryInformation(); Assert.assertNotNull(memoryBean);//from w w w .j a va 2 s . c o m Assert.assertEquals(949328L * 1024, memoryBean.getTotalMemory().getBytes()); Assert.assertEquals(884628L * 1024, memoryBean.getTotalFree().getBytes()); Assert.assertEquals(64700L * 1024, memoryBean.getTotalUsed().getBytes()); Assert.assertEquals(64700.0 / 949328.0, memoryBean.getPercentageUsed(), 0.001); }
From source file:gov.nih.nci.cacis.ip.mirthconnect.CanonicalModelProcessorClientMCIntegrationTest.java
@Test public void invokeStr() throws Exception, IOException { final URL url = getClass().getClassLoader().getResource(SOAP_MSG_FILENAME); String sampleMessage = FileUtils.readFileToString(new File(url.toURI())); client.acceptCanonical(serviceUrl, sampleMessage); }
From source file:com.jaeksoft.searchlib.util.Sequence.java
public Sequence(File file, int radix) throws NumberFormatException, IOException { this.radix = radix; this.file = file; if (file.exists()) if (file.length() > 0) counter = Long.parseLong(FileUtils.readFileToString(file), radix); }
From source file:io.cortical.services.api.client.api.ExpressionsApiTest.java
@BeforeClass public void setUp() throws Exception { expressionsApi = new ExpressionsApi(TestConfig.getClient()); jsonBulkExpression = FileUtils.readFileToString( new File(ExpressionsApiTest.class.getClassLoader().getResource("bulkInput.json").getFile())); }
From source file:com.alibaba.druid.sql.oracle.demo.OracleResourceTest2.java
public void test_0() throws Exception { File file = new File("/Users/wenshao/Downloads/ff.sql"); String sql = FileUtils.readFileToString(file); OracleStatementParser parser = new OracleStatementParser(sql); List<SQLStatement> statementList = parser.parseStatementList(); // Assert.assertEquals(1, statementList.size()); System.out.println(sql);/*from w w w. j a v a2 s . c o m*/ print(statementList); OracleSchemaStatVisitor visitor = new OracleSchemaStatVisitor(); for (int i = 0, size = statementList.size(); i < size; ++i) { SQLStatement statement = statementList.get(i); statement.accept(visitor); } System.out.println("Tables : " + visitor.getTables()); System.out.println("fields : " + visitor.getColumns()); System.out.println(); System.out.println(); }