コード例 #1
0
ファイル: VMUtils.java プロジェクト: skydogch/ethereumjtest
  private static File createProgramTraceFile(String txHash) {
    File result = null;

    if (CONFIG.vmTrace() && !isEmpty(CONFIG.vmTraceDir())) {

      String pathname =
          format(
              "%s/%s/%s/%s.json",
              getProperty("user.dir"), CONFIG.databaseDir(), CONFIG.vmTraceDir(), txHash);
      File file = new File(pathname);

      if (file.exists()) {
        if (file.isFile() && file.canWrite()) {
          result = file;
        }
      } else {
        try {
          file.getParentFile().mkdirs();
          file.createNewFile();
          result = file;
        } catch (IOException e) {
          // ignored
        }
      }
    }

    return result;
  }
コード例 #2
0
ファイル: FindRuleListActivity.java プロジェクト: bunu/myra
  @Override
  public RuleList create() {
    Instance[] instances = Instance.newArray(dataset.size());
    Instance.markAll(instances, NOT_COVERED);
    Entry[] heuristic = Entry.deepClone(INITIAL_HEURISTIC);

    RuleList list = new RuleList();
    list.setIteration(iteration);

    int available = dataset.size();
    int uncovered = (int) ((dataset.size() * CONFIG.get(UNCOVERED)) + 0.5);

    while (available >= uncovered) {
      if (list.size() > 0) {
        // the heuristic procedure only takes into account
        // the instances covered by a rule, so we prepare an
        // instance array where each NOT_COVERED value is
        // replaced by a RULE_COVERED value

        Instance.mark(instances, NOT_COVERED, RULE_COVERED);

        heuristic = CONFIG.get(DEFAULT_HEURISTIC).compute(graph, dataset, instances);

        Instance.mark(instances, RULE_COVERED, NOT_COVERED);
      }

      // creates a rule for the current level

      Rule rule = LevelRuleFactory.create(list.size(), graph, heuristic, dataset, instances);

      available = CONFIG.get(DEFAULT_PRUNER).prune(dataset, rule, instances);

      list.add(rule);

      if (rule.size() == 0) {
        break;
      }

      // marks the instances covered by the current rule as
      // COVERED, so they are not available for the next
      // iterations
      Dataset.markCovered(instances);
    }

    if (!list.hasDefault()) {
      if (available == 0) {
        Instance.markAll(instances, NOT_COVERED);
      }

      Rule rule = new Rule();
      rule.apply(dataset, instances);
      CONFIG.get(ASSIGNATOR).assign(rule);
      list.add(rule);
    }

    list.setQuality(CONFIG.get(DEFAULT_MEASURE).evaluate(dataset, list));

    return list;
  }
コード例 #3
0
  public static Ethereum createEthereum() {

    if (CONFIG.databaseReset()) {
      FileUtil.recursiveDelete(CONFIG.databaseDir());
      logger.info("Database reset done");
    }

    return createEthereum(DefaultConfig.class);
  }
コード例 #4
0
  @Test
  public void exportTimesheetrough() throws IOException, InterruptedException {
    initialize();
    openBrowser();
    driver.get(CONFIG.getProperty("testSiteName"));
    login_Valid();

    // moving on to payslip for generating new payslip
    getObject("payBillX").click();
    getObject("timeSheetLinkX").click();
    getObject("exportTimesheetsX").click();

    // getObjectById("exportFormatTimesheetsId").sendKeys("");
    // for Export Timesheets Date Starting
    getObjectById("exportExportDateStartingId").click();
    Select monthForExportTimesheetstart = new Select(getObject("exportDateStartingMonthX"));
    monthForExportTimesheetstart.selectByVisibleText("Sep");
    Select yearForExportTimesheetstart = new Select(getObject("exportDateStartingYearX"));
    yearForExportTimesheetstart.selectByValue("2015");
    getObject("exportDateStartingSep3X").click();

    // For Timesheets Export Date Ending
    getObjectById("exportDateEndingId").click();
    Select monthForExportTimesheetend = new Select(getObject("exportDateEndingMonthX"));
    monthForExportTimesheetend.selectByVisibleText("Sep");
    Select yearForExportTimesheetend = new Select(getObject("exportDateEndingYearX"));
    yearForExportTimesheetend.selectByValue("2015");
    getObjectById("exportCandidateNameId").sendKeys("");
    getObject("exportDateStartingSep3X").click();
  }
 public static String Navigate(String objname, String data) {
   if (objname.equals("testsiteurl")) {
     Objvalue = CONFIG.getProperty("testsiteurl");
     return Spicejetpage.navigate(Objvalue, data);
   } else {
     Objvalue = OBJECTS.getProperty(objname);
     return Functionlibrary.navigate(Objvalue, data);
   }
 }
コード例 #6
0
ファイル: RedisDataSource.java プロジェクト: crowne/ethereumj
 @Override
 public void init() {
   if (CONFIG.databaseReset()) {
     pooled(
         new Consumer<Jedis>() {
           @Override
           public void accept(Jedis jedis) {
             jedis.flushAll();
           }
         });
   }
 }
コード例 #7
0
ファイル: FindRuleListActivity.java プロジェクト: bunu/myra
  @Override
  public boolean terminate() {
    if (stagnation > CONFIG.get(STAGNATION)) {
      if (reset) {
        policy.initialise(graph);
        stagnation = 0;
        reset = false;
      } else {
        return true;
      }
    }

    return super.terminate();
  }
コード例 #8
0
ファイル: CommonConfig.java プロジェクト: fjl/ethereumj
  @Bean
  @Scope("prototype")
  public KeyValueDataSource keyValueDataSource() {
    String dataSource = CONFIG.getKeyValueDataSource();
    try {
      if ("redis".equals(dataSource) && redisConnection.isAvailable()) {
        // Name will be defined before initialization
        return redisConnection.createDataSource("");
      }

      dataSource = "leveldb";
      return new LevelDbDataSource();
    } finally {
      logger.info(dataSource + " key-value data source created.");
    }
  }
コード例 #9
0
ファイル: FindRuleListActivity.java プロジェクト: bunu/myra
  @Override
  public void initialise() {
    super.initialise();

    policy = new LevelPheromonePolicy();
    policy.initialise(graph);

    reset = true;

    // (initial) heuristic of the whole dataset

    Instance[] instances = Instance.newArray(dataset.size());
    Instance.markAll(instances, RULE_COVERED);

    INITIAL_HEURISTIC = CONFIG.get(DEFAULT_HEURISTIC).compute(graph, dataset, instances);
  }
コード例 #10
0
  @Test
  public void dayBookRough() throws IOException, InterruptedException, AWTException {
    initialize();
    openBrowser();
    driver.get(CONFIG.getProperty("testSiteName"));
    login_Valid();

    Set<String> handles = driver.getWindowHandles();
    System.out.println(handles.size());
    Iterator<String> iterate = handles.iterator();
    Thread.sleep(5000);
    String dayBookNumber = getObjectValue("dayBookBullsEyeStatsX");
    Thread.sleep(4000);
    System.out.println(dayBookNumber);
    getObject("dayBookBullsEyeX").click();
    getObjectById("dayBookExportPdfId").click();
    handles = driver.getWindowHandles();
    iterate = handles.iterator();
    String firstWindow = iterate.next();
    String SecondWindow = iterate.next();

    driver.switchTo().window(SecondWindow);
    // waitForElementClickableId(15, "dayBookExportPdfDownloadId");

    System.out.println(driver.getCurrentUrl());
    driver.findElement(By.xpath("//*[@id='download']")).click();
    Thread.sleep(4000);

    Robot rob = new Robot();
    rob.keyPress(KeyEvent.VK_ENTER);
    rob.keyRelease(KeyEvent.VK_ENTER);
    rob.keyPress(KeyEvent.VK_ENTER);
    rob.keyRelease(KeyEvent.VK_ENTER);
    rob.keyPress(KeyEvent.VK_ENTER);
    rob.keyRelease(KeyEvent.VK_ENTER);
    rob.keyPress(KeyEvent.VK_ENTER);
    rob.keyRelease(KeyEvent.VK_ENTER);
    rob.keyPress(KeyEvent.VK_ENTER);
    rob.keyRelease(KeyEvent.VK_ENTER);
    rob.keyPress(KeyEvent.VK_ENTER);
    rob.keyRelease(KeyEvent.VK_ENTER);
    // getObjectById("dayBookExportPdfDownloadId").click();

  }
コード例 #11
0
  @Test
  public void candidateManualCheck() throws IOException, InterruptedException {
    initialize();
    openBrowser();
    driver.get(CONFIG.getProperty("testSiteName"));
    login_Valid();
    System.out.println("logged in Recruiters Portal");
    driver1 = new FirefoxDriver();
    driver1.get("https://staging.tempbuddy.com");
    // login_Candidate();
    driver1.findElement(By.id("username")).sendKeys("temp-buddy");
    driver1.findElement(By.id("password")).sendKeys("qwerty1");
    driver1.findElement(By.id("_submit")).click();
    System.out.println("in worker portal");
    Thread.sleep(3000);
    driver1.findElement(By.xpath("//*[@id='checkin-button']/div/span")).click();
    Thread.sleep(10000);
    driver1.findElement(By.xpath("//*[@id='checkin-button']/div/span")).click();
    Thread.sleep(5000);
    driver1.close();
    System.out.println("closed driver1");
    getObject("clientsLinkx").click();
    // getObject("addNewClientX").click();
    // Thread.sleep(5000);
    driver.quit();
    System.out.println("closed driver");

    /*Set<String> windows = driver.getWindowHandles();
    String recruiterHandle = driver.getWindowHandle();

    //opening another window using javascript
    ((JavascriptExecutor)driver).executeScript("window.open();");
    Set<String> window2 = driver.getWindowHandles();
    window2.removeAll(windows);
    String workerHandle = (String) window2.toArray()[0];
    driver.switchTo().window(workerHandle);
    driver.get("https://staging.tempbuddy.com");
    login_Candidate();
    System.out.println("in worker portal");
    driver.switchTo().window(recruiterHandle);
    System.out.println("back on recruiter portal");*/

  }
コード例 #12
0
  public LandingPage doLogin(String userName, String password) {

    try {
      Assert.assertEquals(
          "XXXWelcome to Facebook — Log in, sign up or learn more", driver.getTitle());
    } catch (Throwable t) {
      Page.takeScreenshot("Login.jpg"); // get screenshot on error, need to know how to delete
    }

    driver.get(CONFIG.getProperty("testSiteLadingPageURL"));
    System.out.println(isElementPresent("//input[@id='email']"));
    input("Email", userName);
    input("Password", password);
    click("Login_Button");

    if (isElementPresent("go_To_Profile")) {
      return new LandingPage();
    } else {
      return null;
    }
  }
コード例 #13
0
ファイル: TestEnd2End.java プロジェクト: MGQA/mgqaautomation
 @Override
 protected void initialize() {
   getURL(CONFIG.getProperty("sbgDesktopURL"));
 }
コード例 #14
0
  /**
   * ERROR (exceptions) WARN (when something happens that's not supposed to) INFO (wire output)
   * DEBUG (test/displaying intermediate values), TRACE (start/end method)
   */
  public ConnectionConsoleWindow(ToolBar toolBar) {
    final ConnectionConsoleWindow thisConsole = this;
    this.toolBar = toolBar;

    java.net.URL url = ClassLoader.getSystemResource("ethereum-icon.png");
    Toolkit kit = Toolkit.getDefaultToolkit();
    Image img = kit.createImage(url);
    this.setIconImage(img);
    addCloseAction();

    JPanel cp = new JPanel(new BorderLayout());

    AbstractTokenMakerFactory atmf =
        (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
    atmf.putMapping("text/console", "org.ethereum.gui.ConsoleTokenMaker");

    textArea = new RSyntaxTextArea(16, 44);
    textArea.setSyntaxEditingStyle("text/console");
    //        textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_LISP);
    textArea.setCodeFoldingEnabled(true);
    textArea.setAntiAliasingEnabled(true);

    changeStyleProgrammatically();
    RTextScrollPane sp = new RTextScrollPane(textArea);

    cp.add(sp);

    setContentPane(cp);
    setTitle("Connection Console");
    //        setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    setLocation(802, 460);

    if (CONFIG.peerDiscovery()) UIEthereumManager.ethereum.startPeerDiscovery();

    Thread t =
        new Thread() {
          public void run() {

            UIEthereumManager.ethereum.connect(
                SystemProperties.CONFIG.activePeerIP(), SystemProperties.CONFIG.activePeerPort());
          }
        };

    UIEthereumManager.ethereum.addListener(
        new EthereumListenerAdapter() {
          @Override
          public void trace(final String output) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    textArea.append(output);
                    textArea.append("\n");

                    if (autoScroll) textArea.setCaretPosition(textArea.getText().length());
                  }
                });
          }
        });
    t.start();
  }
コード例 #15
0
ファイル: LoginTest.java プロジェクト: HadiAbu/DDF
 @org.junit.Test
 public void loginTest() {
   evDriver.get(CONFIG.getProperty("testSiteName"));
 }
コード例 #16
0
  public LandingPage doLogin() {

    return doLogin(CONFIG.getProperty("defaultUserName"), CONFIG.getProperty("defaultPassword"));
  }
コード例 #17
0
  @SuppressWarnings("deprecation")
  @Override
  public void run(Spawner spawner, CommandSender sender, String subCommand, String[] args) {

    if (!(sender instanceof Player)) {
      PLUGIN.sendMessage(sender, NO_CONSOLE);
      return;
    }

    Player player = (Player) sender;

    SpawnableEntity entity = null;

    String in = getValue(args, 0, "");

    if (in.isEmpty()) {
      Integer selection = CustomSpawners.entitySelection.get(player);
      if (selection == null) {
        PLUGIN.sendMessage(sender, NO_ID);
        return;
      }
      entity = CustomSpawners.getEntity(selection);
    } else {
      entity = CustomSpawners.getEntity(in);
    }

    if (entity == null) {
      PLUGIN.sendMessage(sender, NO_ID);
      return;
    }

    Block target =
        player.getTargetBlock(CustomSpawners.transparent, CONFIG.getInt("players.maxDistance", 5));

    if (target == null) {
      PLUGIN.sendMessage(
          player, ChatColor.RED + "You must look at a block to make a spawner there.");
      return;
    }

    if (target.getType().equals(Material.AIR)) {
      PLUGIN.sendMessage(
          player, ChatColor.RED + "You must look at a block to make a spawner there.");
      return;
    }

    Spawner newSpawner = PLUGIN.createSpawner(entity, target.getLocation());

    if (CONFIG.getBoolean("data.autosave") && CONFIG.getBoolean("data.saveOnCreate")) {
      PLUGIN.getFileManager().autosave(newSpawner);
    }

    // TODO Add this to wiki.
    Group addTo = null;
    if (sender instanceof Player) {
      Player p = (Player) sender;
      if (CustomSpawners.groupSelection.containsKey(p)) {
        addTo = CustomSpawners.getGroup(CustomSpawners.groupSelection.get(sender));
      }
    } else {
      if (CustomSpawners.consoleGroup != -1) {
        addTo = CustomSpawners.getGroup(CustomSpawners.consoleGroup);
      }
    }

    if (addTo != null
        && CONFIG.getBoolean("players.groupAutoAdd", false)
        && addTo.getType().equals(Group.Type.SPAWNER)) {
      addTo.addItem(newSpawner);
      PLUGIN.sendMessage(
          sender,
          ChatColor.GREEN
              + "Successfully created a new "
              + ChatColor.GOLD
              + in
              + ChatColor.GREEN
              + " spawner with ID number "
              + ChatColor.GOLD
              + newSpawner.getId()
              + ChatColor.GREEN
              + "! This spawner was added to group "
              + ChatColor.GOLD
              + PLUGIN.getFriendlyName(addTo)
              + ChatColor.GREEN
              + ".");
    }

    PLUGIN.sendMessage(
        player,
        ChatColor.GREEN
            + "Successfully created a "
            + ChatColor.GOLD
            + PLUGIN.getFriendlyName(entity)
            + ChatColor.GREEN
            + " spawner with ID "
            + ChatColor.GOLD
            + PLUGIN.getFriendlyName(newSpawner)
            + ChatColor.GREEN
            + "!");
  }