public VPBuilderInitVPDbConfig( String atrSrcDataHdfsFolder, String fieldsSplit, String accountTypeIdSplit, String actVpEventDatabasename, String actVpEventOnCreateParameters, String actVpEventOnCloseParameters, String actNShards, String actWinSeconds, String dstHdfsFolder, String recordLength, String[] rules, String[] predineAttrbitues, boolean deleteBuffers) { this.atrSrcDataHdfsFolder = atrSrcDataHdfsFolder; this.fieldsSplit = Base64.encode(fieldsSplit.getBytes()); this.accountTypeIdSplit = Base64.encode(accountTypeIdSplit.getBytes()); this.actVpEventDatabasename = actVpEventDatabasename; this.actVpEventOnCreateParameters = actVpEventOnCreateParameters; this.actVpEventOnCloseParameters = actVpEventOnCloseParameters; this.actNShards = actNShards; this.actWinSeconds = actWinSeconds; this.dstHdfsFolder = dstHdfsFolder; this.recordLength = recordLength; this.rules = rules; this.predineAttrbitues = predineAttrbitues; this.delBuffers = deleteBuffers; }
/** * This method takes screen shot of web page. After taking screen shot, it saves that to file with * test method name and time stamp. This also writes a comment (having link to screenshot) to * selenium logging file created through LoggingSelenium. */ public void captureScreenShot(LoggingSelenium selenium, String screenshotsResultsPath) { try { final String SCREENSHOT_PATH = "screenshots"; /* String screenshotsResultsPath = new File(RESULTS_BASE_PATH + File.separator + SCREENSHOT_PATH).getAbsolutePath(); if (!new File(screenshotsResultsPath).exists()) { new File(screenshotsResultsPath).mkdirs(); }*/ String imageName = "Image" + timeStampForFileName() + ".png"; String finalImage = screenshotsResultsPath + File.separator + imageName; String browser = ConfigFileReader.getConfigItemValue("browser"); if (browser.equals("*chrome") || browser.equals("*firefox") || browser.equals("*iehta")) { // call captureEntirePageScreenshotToString method and it will // return Base64 encoded string referring to screen shot String base64Screenshot = selenium.captureEntirePageScreenshotToString(""); // Decode that Base64 encoded string to get actual screen shot. // Finally this screen shot will be written to file object. byte[] decodedScreenshot = Base64.decode(base64Screenshot); // create instance of FileOutputStream by passing it filename FileOutputStream fos = new FileOutputStream(new File(finalImage)); // Write decoded screenshot to fileoutputstream object fos.write(decodedScreenshot); fos.close(); } else { selenium.captureScreenshot(finalImage); } String failedSS = "<a href=\"file://" + finalImage + "\">Screenshot for previous action " + "</a>"; logger.debug(finalImage); // selenium.logComment(failedSS); selenium.logComment( "<a href=\"" + SCREENSHOT_PATH + "/" + imageName + "\"><img src=\"" + SCREENSHOT_PATH + "/" + imageName + "\" alt=\"Page Screen Shot\" width=\"150\" height=\"300\" border=\"5\"/></a>"); } catch (Exception e) { e.printStackTrace(); } }
public void readLogIn() { try { FileReader fr = new FileReader("log.tmp"); BufferedReader br = new BufferedReader(fr); String str; try { while ((str = br.readLine()) != null) { System.out.println(new String(Base64.decode(str))); } } catch (IOException ex) { Logger.getLogger(LogIn.class.getName()).log(Level.SEVERE, null, ex); } } catch (FileNotFoundException ex) { Logger.getLogger(LogIn.class.getName()).log(Level.SEVERE, null, ex); } }
private void logIn(java.awt.event.ActionEvent evt) throws ClassNotFoundException, SQLException { String userName = txtfldUserName.getText(); setcurrentUser(userName); char[] passwordEntered = this.txtfldPassword.getPassword(); String passwordStored = ""; boolean loggedIn = (passwordStored.equals(passwordStored)); if (true) { // DataAccessor da = new DataAccessor(); JOptionPane.showMessageDialog(this, "Login Successful."); // currentUser.setUserFirstName(txtfldUserName.getText()); // currentUser.setType(da.getUserType(userName)); // currentUser.setImage((Icon)da.getUserImage(userName)); try { PrintWriter out; java.util.Date date = new java.util.Date(); String dateFormatted = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm").format(date.getTime()); out = new PrintWriter(new BufferedWriter(new FileWriter("log.tmp", true))); String encoded; encoded = Base64.encode( ("User Name : " + userName + "\tTime : " + dateFormatted).getBytes("UTF-16")); out.println(encoded); out.close(); } catch (IOException e) { } this.setVisible(false); try { UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaAluOxideLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(LogIn.class.getName()).log(Level.SEVERE, null, ex); } // MainGUI mi = new MainGUI(); // mi.setVisible(true); } else if (passwordStored == null) { JOptionPane.showMessageDialog(this, "Login Failure.\nInvalid User Name"); } else { JOptionPane.showMessageDialog(this, "Login Failure.\nInvalid Password"); } }
/** @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { EmailUtil as = new EmailUtil(); String host = "smtp.163.com"; String from = "*****@*****.**"; String username = "******"; String password = new String(Base64.decode("MTM0ODM3MjQwNTE=")); // 接收者邮箱 String to = "*****@*****.**"; String subject = "找回密码"; String mailConent = "找回密码"; // 调用发送附件邮件方法 as.sendAttachmentMail(host, from, username, password, to, subject, mailConent); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * Feed Media * * @param m * @throws MalformedURLException */ protected void feedMedia(Media m) throws MalformedURLException { this.setParsingMaker(new ParsingMaker(this.getMediaTitleRegex(), this.getData())); m.setTitle(this.getParsingMaker().findOut(">", "<")); if (m.getTitle() != null) m.setTitle(m.getTitle().trim()); this.setParsingMaker(new ParsingMaker(this.getMediaAsinRegex(), this.getData())); m.setAsin(this.getParsingMaker().findOut("=\"", "\"")); if (m.getAsin() != null) m.setAsin(m.getAsin().trim()); this.setParsingMaker(new ParsingMaker(this.getMediaPriceRegex(), this.getData())); m.setPrice(this.getParsingMaker().findOut(" ", "<")); if (m.getPrice() != null) m.setPrice(m.getPrice().trim()); this.setParsingMaker(new ParsingMaker(this.getMediaPriceRegex(), this.getData())); m.setDevise(this.getParsingMaker().findOut(">", " ")); if (m.getDevise() != null) m.setDevise(m.getDevise().trim()); this.setParsingMaker(new ParsingMaker(this.getMediaImageRegex(), this.getData())); String imageUrl = this.getParsingMaker().findOut("=\"", "\""); if (imageUrl != null) { imageUrl = imageUrl.trim(); this.setFileLoader(new FileLoader(new URL(imageUrl))); m.setImage(Base64.encode(this.getFileLoader().getFile()).toString()); } }
public Server provision(JCloudsCloud cloud) { final ServerCreateBuilder builder = Builders.server(); final String nodeName = name + "-" + System.currentTimeMillis() % 1000; LOGGER.info("Provisioning new openstack node " + nodeName); // Ensure predictable node name so we can inject it into user data builder.name(nodeName); if (!Strings.isNullOrEmpty(imageId)) { LOGGER.info("Setting image id to " + imageId); builder.image(imageId); } if (!Strings.isNullOrEmpty((hardwareId))) { LOGGER.info("Setting hardware Id to " + hardwareId); builder.flavor(hardwareId); } if (!Strings.isNullOrEmpty(networkId)) { LOGGER.info("Setting network to " + networkId); builder.networks(Arrays.asList(networkId)); } if (!Strings.isNullOrEmpty(securityGroups)) { LOGGER.info("Setting security groups to " + securityGroups); for (String sg: csvToArray(securityGroups)) { builder.addSecurityGroup(sg); } } if (!Strings.isNullOrEmpty(keyPairName)) { LOGGER.info("Setting keyPairName to " + keyPairName); builder.keypairName(keyPairName); } if (!Strings.isNullOrEmpty(availabilityZone)) { LOGGER.info("Setting availabilityZone to " + availabilityZone); builder.availabilityZone(availabilityZone); } ExtensionList<ConfigProvider> providers = ConfigProvider.all(); UserDataConfig.UserDataConfigProvider myProvider = providers.get(UserDataConfig.UserDataConfigProvider.class); Config userData = myProvider.getConfigById(userDataId); if (userData != null && !userData.content.isEmpty()) { HashMap<String, String> vars = new HashMap<String, String>(); String rootUrl = Jenkins.getInstance().getRootUrl(); vars.put("JENKINS_URL", rootUrl); vars.put("SLAVE_JAR_URL", rootUrl + "jnlpJars/slave.jar"); vars.put("SLAVE_JNLP_URL", rootUrl + "computer/" + nodeName + "/slave-agent.jnlp"); vars.put("SLAVE_LABELS", labelString); String content = Util.replaceMacro(userData.content, vars); LOGGER.info("Sending user-data:\n" + content); builder.userData(Base64.encode(content.getBytes())); } final Openstack openstack = cloud.getOpenstack(); final Server server = openstack.bootAndWaitActive(builder, cloud.startTimeout); LOGGER.info("Provisioned: " + server.toString()); if (cloud.isFloatingIps()) { LOGGER.info("Assiging floating IP to " + nodeName); openstack.assignFloatingIp(server); } // Make sure address information is propagated return openstack.updateInfo(server); }
public static String toBase64(final String hex) { return Base64.encode(DatatypeConverter.parseHexBinary(hex)); }
public static byte[] decode(final String base64) { return Base64.decode(base64); }
public void setAccountTypeIdSplit(String accountTypeIdSplit) { this.accountTypeIdSplit = Base64.encode(accountTypeIdSplit.getBytes()); }
public void setFieldsSplit(String fieldsSplit) { this.fieldsSplit = Base64.encode(fieldsSplit.getBytes()); }