Пример #1
0
    private boolean testInfo() {
      String username = userName.getText();
      String password = passWord.getText();

      if (!Verify.acceptableLength(username, password)) {
        String str = "Username/Password must be between 5 and 16 characters";
        JOptionPane.showMessageDialog(null, str);
        return false;
      } else if (Verify.containsIllegals(username) || Verify.containsIllegals(password)) {
        String str =
            "Username/Password contains Illegal Characters"
                + "Please use only letters, numbers, and/or underscores";
        JOptionPane.showMessageDialog(null, str);
        return false;

      } else
        try {
          if (!Verify.verifyCombination(username, password)) {
            System.out.println("Log in unsuccessful, please check username/password combination");
            return false;
          }
        } catch (FileNotFoundException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
          return false;
        }
      return true;
    }
Пример #2
0
 public static void check(String result, Long id) {
   Verify verify = Verify.find("byId", id).first();
   if (result.equals("admit")) {
     Upload upload = new Upload(verify.author, verify.title, verify.content, verify.photoUrl);
     upload.save();
     verify.delete();
   } else {
     verify.delete();
   }
   index();
 }
Пример #3
0
 public static void main(String[] args) {
   // Create a Scanner object for keyboard input.
   Scanner keyboard = new Scanner(System.in);
   // Get the starting number.
   int number;
   Verify testnum;
   System.out.print("Enter a number between 10 and 100.");
   number = keyboard.nextInt();
   testnum = new Verify(10, 100);
   try {
     testnum.Validate(number);
   } catch (Exception e) {
   }
 }
  public void doExecute() throws Exception {
    String param1Filtered = storedVars.fillValues(param1);
    String param2Filtered = storedVars.fillValues(param2);

    if (param1Filtered.equals(param2Filtered)) {
      String verifyMessage = String.format("%s == %s", param1Filtered, param2Filtered);
      Verify.fail(verifyMessage);
    }
  }
Пример #5
0
 public static void index() {
   List<Verify> verifies = Verify.findAll();
   if (verifies.size() > 0) {
     render(verifies);
   } else {
     String message = "There is no upload need to be verified.";
     render(verifies, message);
   }
 }
Пример #6
0
 public static void runTest(Verify.UnaryMethod method) {
   for (int i = 0; i < 20000; ++i) {
     Verify.verifyUnary(Integer.MIN_VALUE, method);
     Verify.verifyUnary(minvalues[0], method);
     Verify.verifyUnary(Integer.MIN_VALUE - values[2], method);
     Verify.verifyUnary(0, method);
     Verify.verifyUnary(values[2], method);
     Verify.verifyUnary(Integer.MAX_VALUE, method);
     Verify.verifyUnary(Integer.MIN_VALUE - values[0] + values[3], method);
     Verify.verifyUnary(Integer.MIN_VALUE + 1 - values[0], method);
   }
 }
Пример #7
0
  private void verifyContent(File export, String name, Verify v) {
    ZipInputStream zis = null;

    try {
      zis = new ZipInputStream(new FileInputStream(export));
      ZipEntry entry = null;
      while ((entry = zis.getNextEntry()) != null) {
        byte[] buf = new byte[1024];

        if (entry.getName().equals("consumer_export.zip")) {
          OutputStream os = new FileOutputStream("/tmp/consumer_export.zip");

          int n;
          while ((n = zis.read(buf, 0, 1024)) > -1) {
            os.write(buf, 0, n);
          }
          os.flush();
          os.close();
          File exportdata = new File("/tmp/consumer_export.zip");
          // open up the zip and look for the metadata
          verifyContent(exportdata, name, v);
        } else if (entry.getName().equals(name)) {
          v.verify(zis, buf);
        }
        zis.closeEntry();
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (zis != null) {
        try {
          zis.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
Пример #8
0
 public static void show(Long id) {
   Verify verify = Verify.find("byId", id).first();
   render(verify);
 }