List of usage examples for java.io FileWriter flush
public void flush() throws IOException
From source file:at.tuwien.minimee.migration.engines.MonitorEngineJIP.java
private void writeJIPconfigFile(long time) throws IOException { FileWriter w = new FileWriter(new File(makeConfigfileName(time))); w.write("ClassLoaderFilter.1=com.mentorgen.tools.profile.instrument.clfilter.StandardClassLoaderFilter\n"); w.write("thread.compact.threshold.ms=1\n"); w.write("method.compact.threshold.ms=1\n"); w.write("file="); w.write(makeJIPOutFilename(time) + "\n"); //JIP will append .txt! w.write("track.object.alloc=on\n"); w.write("output=text\n"); w.write("output-method-signatures=yes"); w.flush(); w.close();/* ww w.java 2s . c om*/ }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PupilResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set//from ww w .jav a 2 s. c o m * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Pupil searchObject = new Pupil(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Pupil", searchObject); String id = ""; if (results != null && results.size() > 0) { Pupil obj = (Pupil) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Pupil/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Pupil" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.BankResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set//from w w w . j a v a 2 s . c o m * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Bank searchObject = new Bank(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.Bank", searchObject); String id = ""; if (results != null && results.size() > 0) { Bank obj = (Bank) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Bank/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Bank" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.CashResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set/*from w w w . ja v a 2 s. co m*/ * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Cash searchObject = new Cash(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.Cash", searchObject); String id = ""; if (results != null && results.size() > 0) { Cash obj = (Cash) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Cash/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Cash" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.PaymentResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set/* www .j ava 2 s . c om*/ * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Payment searchObject = new Payment(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.Payment", searchObject); String id = ""; if (results != null && results.size() > 0) { Payment obj = (Payment) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Payment/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Payment" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.sametable.ShoesResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set/* w ww .j a v a 2 s. c o m*/ * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Shoes searchObject = new Shoes(); Collection results = getApplicationService().search( "gov.nih.nci.cacoresdk.domain.inheritance.childwithassociation.sametable.Shoes", searchObject); String id = ""; if (results != null && results.size() > 0) { Shoes obj = (Shoes) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Shoes/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Shoes" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.implicit.FishTankResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set//from w w w . j a v a 2s.c om * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { FishTank searchObject = new FishTank(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.implicit.FishTank", searchObject); String id = ""; if (results != null && results.size() > 0) { FishTank obj = (FishTank) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/FishTank/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("FishTank" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.implicit.FreshwaterFishTankResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set//w ww.j a va 2 s . c om * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { FreshwaterFishTank searchObject = new FreshwaterFishTank(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.implicit.FreshwaterFishTank", searchObject); String id = ""; if (results != null && results.size() > 0) { FreshwaterFishTank obj = (FreshwaterFishTank) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/FreshwaterFishTank/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("FreshwaterFishTank" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.implicit.SubstrateResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set/* w w w.j a v a 2 s . c o m*/ * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { Substrate searchObject = new Substrate(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.implicit.Substrate", searchObject); String id = ""; if (results != null && results.size() > 0) { Substrate obj = (Substrate) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/Substrate/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("Substrate" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:test.gov.nih.nci.cacoresdk.domain.inheritance.multiplechild.GraduateStudentResourceTest.java
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set// w w w . j a v a 2 s.co m * Verifies that none of the attributes are null * * @throws Exception */ public void testGet() throws Exception { try { GraduateStudent searchObject = new GraduateStudent(); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.multiplechild.GraduateStudent", searchObject); String id = ""; if (results != null && results.size() > 0) { GraduateStudent obj = (GraduateStudent) ((List) results).get(0); id = obj.getId().getExtension(); } else return; if (id.equals("")) return; String url = baseURL + "/rest/GraduateStudent/" + id; WebClient client = WebClient.create(url); client.type("application/xml").accept("application/xml"); Response response = client.get(); if (response.getStatus() == Status.NOT_ACCEPTABLE.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { InputStream is = (InputStream) response.getEntity(); org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder(false); org.jdom.Document jDoc = builder.build(is); assertEquals(jDoc.getRootElement().getName(), "response"); } else if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } File myFile = new File("GraduateStudent" + "XML.xml"); System.out.println("writing data to file " + myFile.getAbsolutePath()); FileWriter myWriter = new FileWriter(myFile); BufferedReader br = new BufferedReader(new InputStreamReader(((InputStream) response.getEntity()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { myWriter.write(output); System.out.println(output); } myWriter.flush(); myWriter.close(); } catch (Exception e) { e.printStackTrace(); throw e; } }