Esempio n. 1
0
  public void killApp() throws Exception {
    // try to kill just by calling exit
    try {
      Client.getInstance().map("java.lang.System", "exit", 0);
    } catch (Exception e) {
      // this will actually throw an exception since it doesnt get a response from this command
    }

    // shut down the thread
    if (ap != null) {
      ap.close();
      ap.interrupt();
      ap = null;
    }

    // wait for the server to be dead
    for (int x = 0; x < 10; x++) {
      // try to make a query.. if it doesnt work then sleep
      TestLogger.get().info("Trying to see if server is still available..");

      if (!Client.getInstance().isListening()) break;

      if (x == 9) throw new Exception("Server is still available, but should not be");

      Thread.sleep(2000);
    }
  }
Esempio n. 2
0
 public static String[] getCurrentViews(String classToFilterBy, String parent) throws Exception {
   ArrayList<String> abar =
       Utils.jsonArrayToStringList(
           Client.getInstance()
               .map(Constants.ROBOTIUM_SOLO, "getCurrentViews", classToFilterBy, parent));
   return abar.toArray(new String[0]);
 }
Esempio n. 3
0
 public static String[] getCurrentToggleButtons() throws Exception {
   ArrayList<String> abar =
       Utils.jsonArrayToStringList(
           Client.getInstance()
               .map(Constants.ROBOTIUM_SOLO, "getCurrentViews", "android.widget.ToggleButton"));
   return abar.toArray(new String[0]);
 }
Esempio n. 4
0
 public static String[] clickLongInList(int line, int index, int time) throws Exception {
   ArrayList<String> abar =
       Utils.jsonArrayToStringList(
           Client.getInstance()
               .map(Constants.ROBOTIUM_SOLO, "clickLongInList", line, index, time));
   return abar.toArray(new String[0]);
 }
Esempio n. 5
0
  /**
   * Get the location of a view on the screen
   *
   * @param view - string reference to the view
   * @return - int array(x, y) of the view location
   * @throws Exception
   */
  public static int[] getLocationOnScreen(String view) throws Exception {
    int[] location = new int[2];

    JSONArray results =
        Client.getInstance().map(Constants.ROBOTIUM_SOLO, "getLocationOnScreen", view);
    location[0] = results.getInt(0);
    location[1] = results.getInt(1);

    return location;
  }
Esempio n. 6
0
 public static void startScreenshotSequence(
     String name, int quality, int frameDelay, int maxFrames) throws Exception {
   Client.getInstance()
       .map(
           Constants.ROBOTIUM_SOLO,
           "startScreenshotSequence",
           name,
           quality,
           frameDelay,
           maxFrames);
 }
Esempio n. 7
0
 public static String waitForView(
     String viewClass, int minimumNumberOfMatches, int timeout, boolean scroll) throws Exception {
   return Client.getInstance()
       .map(
           Constants.ROBOTIUM_SOLO,
           "waitForView",
           viewClass,
           minimumNumberOfMatches,
           timeout,
           scroll)
       .getString(0);
 }
Esempio n. 8
0
 public static boolean searchText(
     String text, int minimumNumberOfMatches, boolean scroll, boolean onlyVisible)
     throws Exception {
   return Client.getInstance()
       .map(
           Constants.ROBOTIUM_SOLO,
           "searchText",
           text,
           minimumNumberOfMatches,
           scroll,
           onlyVisible)
       .getBoolean(0);
 }
  /**
   * @param friends the Client the Plugin belongs to
   * @param starter is true if the Clients started the plugin (start() will be called instead of
   *     follow()
   * @return a new instance of the Plugin.
   */
  public Plugin newInstance(ConnectInfo[] friends, boolean starter) {
    QuickLaunch self = new QuickLaunch();

    try {
      self.trayIcon =
          new TrayIcon(
              this.getImageIcon16(),
              Client.getInstance().getMyInfos().getName() + " - Lucane Groupware");
    } catch (Throwable t) {
      self.trayIcon = null;
    }

    return self;
  }
Esempio n. 10
0
  public void startApp() throws Exception {
    ap = new AppThread();
    ap.start();

    for (int x = 0; x < 10; x++) {
      // try to make a query.. if it doesnt work then sleep
      TestLogger.get().info("Trying to ping test server..");
      if (Client.getInstance().isListening()) break;

      if (x == 9) throw new Exception("Could not contact test server");

      Thread.sleep(5000);
    }
  }
Esempio n. 11
0
  /** Show a dialog asking for the friend name */
  public void start() {
    if (this.trayIcon == null) {
      // no user message if we aren't on windows
      if (System.getProperty("os.name").startsWith("Win")) DialogBox.error(tr("err.noTray"));
      else Logging.getLogger().info("Not on windows, running MainInterface instead of QuickLaunch");

      PluginManager.getInstance().run(MAIN_INTERFACE, new ConnectInfo[0]);
      Client.getInstance().setStartupPlugin(MAIN_INTERFACE);
      return;
    }

    addMenuToTray();

    this.trayIcon.addMouseListener(this);
    this.trayIcon.setVisible(true);
    this.trayIcon.showInfo(tr("lucane.is.ready"), "Lucane Groupware");
  }
Esempio n. 12
0
  private void runPlugin(String pluginName) {
    ConnectInfo[] friends = null;
    Plugin plugin = PluginManager.getInstance().getPlugin(pluginName);

    // get users
    if (plugin.isStandalone()) friends = new ConnectInfo[0];
    else {
      ListBox userList =
          new ListBox(
              null, plugin.getTitle(), tr("msg.selectUsers"), Client.getInstance().getUserList());
      Object[] users = userList.selectItems();
      if (users != null) {
        friends = new ConnectInfo[users.length];
        for (int i = 0; i < friends.length; i++)
          friends[i] = Communicator.getInstance().getConnectInfo((String) users[i]);
      }
    }

    // run the plugin if the user didn't click on cancel
    if (friends != null) PluginManager.getInstance().run(pluginName, friends);
  }
Esempio n. 13
0
 public static boolean waitForText(
     String text, int minimumNumberOfMatches, long timeout, boolean scroll) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForText", text, minimumNumberOfMatches, timeout, scroll)
       .getBoolean(0);
 }
Esempio n. 14
0
 public static boolean waitForLogMessage(String logMessage) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForLogMessage", logMessage)
       .getBoolean(0);
 }
Esempio n. 15
0
 public static boolean waitForFragmentByTag(String tag) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForFragmentByTag", tag)
       .getBoolean(0);
 }
Esempio n. 16
0
 public static boolean waitForFragmentById(int id) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForFragmentById", id)
       .getBoolean(0);
 }
Esempio n. 17
0
 /** SOLO2 addons */
 public static boolean isVisible(String view) throws Exception {
   return Client.getInstance().map(Constants.ROBOTIUM_SOLO, "isVisible", view).getBoolean(0);
 }
Esempio n. 18
0
 public static String[] getVisibleText() throws Exception {
   ArrayList<String> abar =
       Utils.jsonArrayToStringList(
           Client.getInstance().map(Constants.ROBOTIUM_SOLO, "getVisibleText"));
   return abar.toArray(new String[0]);
 }
Esempio n. 19
0
 /**
  * Returns a string array of all of the text contained within a view
  *
  * @param viewName
  * @return
  */
 public static String[] getTextFromView(String viewName) throws Exception {
   ArrayList<String> abar =
       Utils.jsonArrayToStringList(
           Client.getInstance().map(Constants.ROBOTIUM_SOLO, "getTextFromView", viewName));
   return abar.toArray(new String[0]);
 }
Esempio n. 20
0
 public static String waitForView(int id) throws Exception {
   return Client.getInstance().map(Constants.ROBOTIUM_SOLO, "waitForView", id).getString(0);
 }
Esempio n. 21
0
 public static String waitForView(String view, int timeout, boolean scroll) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForView", view, timeout, scroll)
       .getString(0);
 }
Esempio n. 22
0
 public static void typeText(int index, String text) throws Exception {
   Client.getInstance().map(Constants.ROBOTIUM_SOLO, "typeText", index, text);
 }
Esempio n. 23
0
 public static String waitForView(int id, int minimumNumberOfMatches, int timeout)
     throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForView", id, minimumNumberOfMatches, timeout)
       .getString(0);
 }
Esempio n. 24
0
 public static void typeText(String editText, String text) throws Exception {
   Client.getInstance().map(Constants.ROBOTIUM_SOLO, "typeText", editText, text);
 }
Esempio n. 25
0
 public static void waitForHintText(String hintText, int timeout) throws Exception {
   Client.getInstance().map(Constants.ROBOTIUM_SOLO, "waitForHintText", hintText, timeout);
 }
Esempio n. 26
0
 public static boolean waitForActivity(String name) throws Exception {
   return Client.getInstance().map(Constants.ROBOTIUM_SOLO, "waitForActivity", name).getBoolean(0);
 }
Esempio n. 27
0
 public static int getResourceId(String namespace, String resourceType, String resourceName)
     throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "getResourceId", namespace, resourceType, resourceName)
       .getInt(0);
 }
Esempio n. 28
0
 public static boolean waitForCondition(String condition, int timeout) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForActivity", condition, timeout)
       .getBoolean(0);
 }
Esempio n. 29
0
 public static boolean waitForActivity(String applicationName, String activityName, int timeout)
     throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForActivity", applicationName, activityName, timeout)
       .getBoolean(0);
 }
Esempio n. 30
0
 public static boolean waitForDialogToClose(long timeout) throws Exception {
   return Client.getInstance()
       .map(Constants.ROBOTIUM_SOLO, "waitForDialogToClose", timeout)
       .getBoolean(0);
 }