Ejemplo n.º 1
0
  public static void main(String[] args) throws OnePageException {
    Properties prop = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream("config.properties");

      // Load the properties file
      prop.load(input);

    } catch (IOException e) {
      LOG.severe("Error loading the config.properties file");
      LOG.severe(e.toString());
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          LOG.severe("Error closing the config.properties file");
          LOG.severe(e.toString());
        }
      }
    }

    OnePageCRM.setServer(Request.DEV_SERVER);

    User loggedInUser = User.login(prop.getProperty("username"), prop.getProperty("password"));

    GetRequest companiesRequest = new GetRequest("companies", "");
    companiesRequest.send();

    GetRequest singleCompanyRequest = new GetRequest("companies/56fd40b49007ba716f00000b", "");
    singleCompanyRequest.send();
  }
  public static void main(String[] args) throws OnePageException {
    Properties prop = new Properties();
    InputStream input = null;

    try {
      input = new FileInputStream("config.properties");

      // Load the properties file
      prop.load(input);

    } catch (IOException e) {
      LOG.severe("Error loading the config.properties file");
      LOG.severe(e.toString());
    } finally {
      if (input != null) {
        try {
          input.close();
        } catch (IOException e) {
          LOG.severe("Error closing the config.properties file");
          LOG.severe(e.toString());
        }
      }
    }

    OnePageCRM.setServer(Request.DEV_SERVER);

    User.login(prop.getProperty("username"), prop.getProperty("password"));

    // Register the device.
    final String firebaseToken =
        "d7sIgbT9wsg:APA91bFQvHUxKdLWzEKfwZpWzwQ0qQFoDElh-wThQDFVojYXD69WBhvsLoqKOb2KNQj47ZCzQ0qLB5Al34HUmASzYxBkQGtmTBQGHw7tv2lO2hwlUSzRF8HEfZVSGHsXircLhCtSIrq4";
    Device phone = new Device().setDeviceId(firebaseToken).register();
    LOG.info("Registered device : " + phone);

    // List current devices.
    List<Device> devices = Device.list();
    LOG.info("Device list : " + devices);
  }