List of usage examples for java.text SimpleDateFormat SimpleDateFormat
public SimpleDateFormat(String pattern)
SimpleDateFormat
using the given pattern and the default date format symbols for the default java.util.Locale.Category#FORMAT FORMAT locale. From source file:clases.Main.java
public static void main(String[] args) { try {/*from ww w . j ava 2 s .co m*/ Manejador admin = new Manejador(); admin.setRuta("notebooks.json"); admin.Conectar(); admin.setNom_bd("notebooks"); admin.setNom_coleccion("notebooks"); DateFormat format_date = new SimpleDateFormat("yyyy-MM-dd"); Date fecha = new Date(); String date_now = format_date.format(fecha); JSONObject param_1 = new JSONObject("{id_notebook: 1}"); JSONObject busqueda = admin.Select(param_1); if (busqueda.has("id") && busqueda.get("id").equals(0)) { System.out.println(busqueda.toString(4)); } else { JSONObject[] obj_param_arr = { new JSONObject("{ notes: [{id_note: 1}] }"), new JSONObject("{ prueba: [{id_pedo: 1}] }") }; JSONObject nota = admin.SelectIntoArray(busqueda, obj_param_arr[0]); String claves = "\"HESOYAM\\nLXGIWYL\""; String str_js = "{ notes: [{titulo: Claves GTA San andreas PC, note: " + claves + ", fecha_modificacion: " + date_now + "}] }"; String str_js2 = "{ prueba: [{texto: HOla}] }"; String str_js3 = "{ notes: [{note: \"No c, weno si c pero no te wa decir\"}] }"; String[] arr_changes = { str_js, str_js2, str_js3 }; /*JSONObject cambios = new JSONObject(arr_changes[2]); boolean exito = admin.updateIntoArray(nota, cambios); if(exito) { System.out.println("Registro editado de manera satisfactoria!"); } else { System.out.println("Registro no encontrado"); }*/ String[] targets = { "{ notes: [{id_note: 1}] }" }; //admin.delete(param_1); JSONObject target = new JSONObject(targets[0]); admin.deleteIntoArray(busqueda, target); } /* JSONObject cambio = new JSONObject("{nombre: Cronicas Rata, fecha_modificacion: \""+ date_now +"\"}"); boolean exito = admin.update(new JSONObject("{id_notebook: 2}"), cambio); if(exito) { System.out.println("Registro modificado de manera satisfactoria"); }*/ } catch (FileNotFoundException fe) { fe.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (JSONException je) { je.printStackTrace(); } }
From source file:SyncMultipleLeads.java
public static void main(String[] args) { System.out.println("Executing syncMultipleLeads"); try {/*from www.jav a2 s . co m*/ URL marketoSoapEndPoint = new URL("https://100-AEK-913.mktoapi.com/soap/mktows/2_1" + "?WSDL"); String marketoUserId = "demo17_1_809934544BFABAE58E5D27"; String marketoSecretKey = "27272727aa"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); MktowsPort port = service.getMktowsApiSoapPort(); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsSyncMultipleLeads request = new ParamsSyncMultipleLeads(); ObjectFactory objectFactory = new ObjectFactory(); JAXBElement<Boolean> dedup = objectFactory.createParamsSyncMultipleLeadsDedupEnabled(true); request.setDedupEnabled(dedup); ArrayOfLeadRecord arrayOfLeadRecords = new ArrayOfLeadRecord(); // Create First Lead Record LeadRecord rec1 = new LeadRecord(); JAXBElement<String> email = objectFactory.createLeadRecordEmail("t@t.com"); rec1.setEmail(email); Attribute attr1 = new Attribute(); attr1.setAttrName("FirstName"); attr1.setAttrValue("George"); Attribute attr2 = new Attribute(); attr2.setAttrName("LastName"); attr2.setAttrValue("of the Jungle"); ArrayOfAttribute aoa = new ArrayOfAttribute(); aoa.getAttributes().add(attr1); aoa.getAttributes().add(attr2); QName qname = new QName("http://www.marketo.com/mktows/", "leadAttributeList"); JAXBElement<ArrayOfAttribute> attrList = new JAXBElement(qname, ArrayOfAttribute.class, aoa); rec1.setLeadAttributeList(attrList); arrayOfLeadRecords.getLeadRecords().add(rec1); // Create Second Lead Record LeadRecord rec2 = new LeadRecord(); JAXBElement<String> email2 = objectFactory.createLeadRecordEmail("myemail@test.com"); rec2.setEmail(email2); Attribute attr11 = new Attribute(); attr11.setAttrName("FirstName"); attr11.setAttrValue("Nancy"); Attribute attr21 = new Attribute(); attr21.setAttrName("LastName"); attr21.setAttrValue("Lady"); ArrayOfAttribute aoa2 = new ArrayOfAttribute(); aoa2.getAttributes().add(attr11); aoa2.getAttributes().add(attr21); qname = new QName("http://www.marketo.com/mktows/", "leadAttributeList"); JAXBElement<ArrayOfAttribute> attrList2 = new JAXBElement(qname, ArrayOfAttribute.class, aoa2); rec2.setLeadAttributeList(attrList); arrayOfLeadRecords.getLeadRecords().add(rec2); request.setLeadRecordList(arrayOfLeadRecords); SuccessSyncMultipleLeads result = port.syncMultipleLeads(request, header); JAXBContext context = JAXBContext.newInstance(SuccessSyncMultipleLeads.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch (Exception e) { e.printStackTrace(); } }
From source file:GetLeadChanges.java
public static void main(String[] args) { System.out.println("Executing Get Lead Changes"); try {// www . ja v a 2s . c om URL marketoSoapEndPoint = new URL("CHANGE ME" + "?WSDL"); String marketoUserId = "CHANGE ME"; String marketoSecretKey = "CHANGE ME"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); MktowsPort port = service.getMktowsApiSoapPort(); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsGetLeadChanges request = new ParamsGetLeadChanges(); ObjectFactory objectFactory = new ObjectFactory(); JAXBElement<Integer> batchSize = objectFactory.createParamsGetLeadActivityBatchSize(10); request.setBatchSize(batchSize); ArrayOfString activities = new ArrayOfString(); activities.getStringItems().add("Visit Webpage"); activities.getStringItems().add("Click Link"); JAXBElement<ArrayOfString> activityFilter = objectFactory .createParamsGetLeadChangesActivityNameFilter(activities); request.setActivityNameFilter(activityFilter); // Create oldestCreateAt timestamp from 5 days ago GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(new Date().getTime()); gc.add(GregorianCalendar.DAY_OF_YEAR, -5); DatatypeFactory factory = DatatypeFactory.newInstance(); JAXBElement<XMLGregorianCalendar> oldestCreateAtValue = objectFactory .createStreamPositionOldestCreatedAt(factory.newXMLGregorianCalendar(gc)); StreamPosition sp = new StreamPosition(); sp.setOldestCreatedAt(oldestCreateAtValue); request.setStartPosition(sp); SuccessGetLeadChanges result = port.getLeadChanges(request, header); JAXBContext context = JAXBContext.newInstance(SuccessGetLeadChanges.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch (Exception e) { e.printStackTrace(); } }
From source file:ImportToList.java
public static void main(String[] args) { System.out.println("Executing Import To List"); try {/*from ww w . j av a 2 s . c om*/ URL marketoSoapEndPoint = new URL("CHANGE ME" + "?WSDL"); String marketoUserId = "CHANGE ME"; String marketoSecretKey = "CHANGE ME"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); MktowsPort port = service.getMktowsApiSoapPort(); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsImportToList request = new ParamsImportToList(); request.setProgramName("Trav-Demo-Program"); request.setCampaignName("Batch Campaign Example"); request.setImportFileHeader("Last Name,First Name,Job Title,Company Name,Email Address"); ArrayOfString rows = new ArrayOfString(); rows.getStringItems().add("Awesomesauce,Developer,Code Slinger,Marketo,dawesomesauce@marketo.com"); rows.getStringItems().add("Doe,Jane,VP Marketing,Jane Consulting,jdoe@janeconsulting.com"); request.setImportFileRows(rows); request.setImportListMode(ImportToListModeEnum.UPSERTLEADS); request.setListName("Trav-Test-List"); request.setClearList(false); SuccessImportToList result = port.importToList(request, header); JAXBContext context = JAXBContext.newInstance(SuccessImportToList.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch (Exception e) { e.printStackTrace(); } }
From source file:ScheduleCampaign.java
public static void main(String[] args) { System.out.println("Executing Schedule Campaign"); try {//from w w w. j a v a2s .c o m URL marketoSoapEndPoint = new URL("CHANGE ME" + "?WSDL"); String marketoUserId = "CHANGE ME"; String marketoSecretKey = "CHANGE ME"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); MktowsPort port = service.getMktowsApiSoapPort(); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsScheduleCampaign request = new ParamsScheduleCampaign(); request.setProgramName("Trav-Demo-Program"); request.setCampaignName("Batch Campaign Example"); // Create setCampaignRunAt timestamp GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(new Date().getTime()); DatatypeFactory factory = DatatypeFactory.newInstance(); ObjectFactory objectFactory = new ObjectFactory(); JAXBElement<XMLGregorianCalendar> setCampaignRunAtValue = objectFactory .createParamsScheduleCampaignCampaignRunAt(factory.newXMLGregorianCalendar(gc)); request.setCampaignRunAt(setCampaignRunAtValue); request.setCloneToProgramName("TestProgramCloneFromSOAP"); ArrayOfAttrib aoa = new ArrayOfAttrib(); Attrib attrib = new Attrib(); attrib.setName("{{my.message}}"); attrib.setValue("Updated message"); aoa.getAttribs().add(attrib); JAXBElement<ArrayOfAttrib> arrayOfAttrib = objectFactory .createParamsScheduleCampaignProgramTokenList(aoa); request.setProgramTokenList(arrayOfAttrib); SuccessScheduleCampaign result = port.scheduleCampaign(request, header); JAXBContext context = JAXBContext.newInstance(SuccessScheduleCampaign.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.payne.test.DateFormateTest.java
public static void main(String[] args) throws ParseException { // String a = null; // boolean ismmediated = a == null || DateUtils.parseDate(null,"yyyy-MM-dd HH:mm").compareTo(new Date()) <= 0; // //from w ww. j a va 2 s. c o m // System.out.println(""+ismmediated); // System.out.println(""+System.currentTimeMillis()); // // String randomNum = String.valueOf(Math.random()); // randomNum = randomNum.replace(".", ""); // randomNum = randomNum.substring(0, 8); // // System.out.println(""+Integer.valueOf(randomNum.toString())); // // Integer a = 1000000000; // BigDecimal b = new BigDecimal("3000000000"); // System.out.println(""+b.longValue()); // System.out.println(""+b.intValue()); SimpleDateFormat sdf = new SimpleDateFormat(""); // Calendar c = Calendar.getInstance(); // c.setTime(new Date()); // c.set(Calendar.MINUTE, 0); // c.set(Calendar.SECOND, 0); // c.set(Calendar.MILLISECOND, 0); // System.out.println(sdf.format(new Date())); }
From source file:GetMultipleLeads.java
public static void main(String[] args) { System.out.println("Executing GetMultipleLeads"); try {/*from www . j a v a 2 s .c o m*/ URL marketoSoapEndPoint = new URL("CHANGE ME" + "?WSDL"); String marketoUserId = "CHANGE ME"; String marketoSecretKey = "CHANGE ME"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); MktowsPort port = service.getMktowsApiSoapPort(); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsGetMultipleLeads request = new ParamsGetMultipleLeads(); // Request Using LeadKey Selector //////////////////////////////////////////////////////// LeadKeySelector keySelector = new LeadKeySelector(); keySelector.setKeyType(LeadKeyRef.EMAIL); ArrayOfString aos = new ArrayOfString(); aos.getStringItems().add("formtest1@marketo.com"); aos.getStringItems().add("joe@marketo.com"); keySelector.setKeyValues(aos); request.setLeadSelector(keySelector); /* // Request Using LastUpdateAtSelector //////////////////////////////////////////////////////// LastUpdateAtSelector leadSelector = new LastUpdateAtSelector(); GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(new Date().getTime()); gc.add( GregorianCalendar.DAY_OF_YEAR, -2); DatatypeFactory factory = DatatypeFactory.newInstance(); ObjectFactory objectFactory = new ObjectFactory(); JAXBElement<XMLGregorianCalendar> until =objectFactory.createLastUpdateAtSelectorLatestUpdatedAt(factory.newXMLGregorianCalendar(gc)); GregorianCalendar since = new GregorianCalendar(); since.setTimeInMillis(new Date().getTime()); since.add( GregorianCalendar.DAY_OF_YEAR, -5); leadSelector.setOldestUpdatedAt(factory.newXMLGregorianCalendar(since)); leadSelector.setLatestUpdatedAt(until); request.setLeadSelector(leadSelector); */ /* // Request Using StaticList Selector //////////////////////////////////////////////////////// StaticListSelector staticListSelector = new StaticListSelector(); //staticListSelector.setStaticListId(value) ObjectFactory objectFactory = new ObjectFactory(); JAXBElement<String> listName = objectFactory.createStaticListSelectorStaticListName("SMSProgram.listForTesting"); staticListSelector.setStaticListName(listName); // JAXBElement<Integer> listId = objectFactory.createStaticListSelectorStaticListId(6926); // staticListSelector.setStaticListId(listId); request.setLeadSelector(staticListSelector); */ ArrayOfString attributes = new ArrayOfString(); attributes.getStringItems().add("FirstName"); attributes.getStringItems().add("AnonymousIP"); attributes.getStringItems().add("Company"); request.setIncludeAttributes(attributes); JAXBElement<Integer> batchSize = new ObjectFactory().createParamsGetMultipleLeadsBatchSize(10); request.setBatchSize(batchSize); SuccessGetMultipleLeads result = port.getMultipleLeads(request, header); JAXBContext context = JAXBContext.newInstance(SuccessGetLead.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch (Exception e) { e.printStackTrace(); } }
From source file:GetChannels.java
public static void main(String[] args) { System.out.println("Executing Get Channels"); try {//from w w w. ja v a2s . c o m URL marketoSoapEndPoint = new URL("CHANGEME" + "?WSDL"); String marketoUserId = "CHANGEME"; String marketoSecretKey = "CHANGEME"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsGetChannels params = new ParamsGetChannels(); Tag tags = new Tag(); ArrayOfString tagArray = new ArrayOfString(); tagArray.getStringItems().add("Webinar"); tagArray.getStringItems().add("Blog"); tagArray.getStringItems().add("Tradeshow"); tags.setValues(tagArray); MktowsPort port = service.getMktowsApiSoapPort(); SuccessGetChannels result = port.getChannels(params, header); JAXBContext context = JAXBContext.newInstance(SuccessGetLead.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch (Exception e) { e.printStackTrace(); } }
From source file:cn.lynx.emi.license.GenerateLicense.java
public static void main(String[] args) throws ClassNotFoundException, ParseException { if (args == null || args.length != 4) { System.err.println("Please provide [machine code] [cpu] [memory in gb] [yyyy-MM-dd] as parameter"); return;// ww w .java 2 s. co m } InputStream is = GenerateLicense.class.getResourceAsStream("/privatekey"); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String key = null; try { key = br.readLine(); } catch (IOException e) { System.err.println( "Can't read the private key file, make sure there's a file named \"privatekey\" in the root classpath"); e.printStackTrace(); return; } if (key == null) { System.err.println( "Can't read the private key file, make sure there's a file named \"privatekey\" in the root classpath"); return; } String machineCode = args[0]; int cpu = Integer.parseInt(args[1]); long mem = Long.parseLong(args[2]) * 1024 * 1024 * 1024; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); long expDate = sdf.parse(args[3]).getTime(); LicenseBean lb = new LicenseBean(); lb.setCpuCount(cpu); lb.setMemCount(mem); lb.setMachineCode(machineCode); lb.setExpireDate(expDate); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream os = new ObjectOutputStream(baos); os.writeObject(lb); os.close(); String serializedLicense = Base64.encodeBase64String(baos.toByteArray()); System.out.println("License:" + encrypt(key, serializedLicense)); } catch (IOException e) { e.printStackTrace(); } }
From source file:ke.co.tawi.babblesms.server.utils.randomgenerate.IncomingLogGenerator.java
/** * @param args/* w ww . j a v a2s .com*/ */ public static void main(String[] args) { System.out.println("Have started IncomingSMSGenerator."); File outFile = new File("/tmp/logs/incomingSMS.csv"); RandomDataGenerator randomDataImpl = new RandomDataGenerator(); String randomStrFile = "/tmp/random.txt"; List<String> randomStrings = new ArrayList<>(); int randStrLength = 0; long startDate = 1412380800; // Unix time in seconds for Oct 4 2014 long stopDate = 1420070340; // Unix time for in seconds Dec 31 2014 SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 2011-06-01 00:16:45" List<String> shortcodeUuids = new ArrayList<>(); shortcodeUuids.add("094def52-bc18-4a9e-9b84-c34cc6476c75"); shortcodeUuids.add("e9570c5d-0cc4-41e5-81df-b0674e9dda1e"); shortcodeUuids.add("a118c8ea-f831-4288-986d-35e22c91fc4d"); shortcodeUuids.add("a2688d72-291b-470c-8926-31a903f5ed0c"); shortcodeUuids.add("9bef62f6-e682-4efd-98e9-ca41fa4ef993"); int shortcodeCount = shortcodeUuids.size() - 1; try { randomStrings = FileUtils.readLines(new File(randomStrFile)); randStrLength = randomStrings.size(); for (int j = 0; j < 30000; j++) { FileUtils.write(outFile, // shortcodeUuids.get(randomDataImpl.nextInt(0, shortcodeCount)) + "|" // Destination UUID.randomUUID().toString() + "|" // Unique Code + randomDataImpl.nextLong(new Long("254700000000").longValue(), new Long("254734999999").longValue()) + "|" // Origin + shortcodeUuids.get(randomDataImpl.nextInt(0, shortcodeCount)) + "|" + randomStrings.get(randomDataImpl.nextInt(0, randStrLength - 1)) + "|" // Message + "N|" // deleted + dateFormatter.format( new Date(randomDataImpl.nextLong(startDate, stopDate) * 1000)) + "\n", // smsTime true); // Append to file } } catch (IOException e) { System.err.println("IOException in main."); e.printStackTrace(); } System.out.println("Have finished IncomingSMSGenerator."); }