Examples of fromFile()


Examples of Dictionary.Dictionary.fromFile()

  {
    Dictionary d;
    try
    {
      d = new Dawg();
      d.fromFile(dictionaryPath);

      for (String s : wordToFind)
        System.out.println("The dictionary " + (d.contains(s) ? "contains" : "does not contain") + " the word " + s);
    }
    catch (Exception e)
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.ClientLoginTokens.ForApiBuilder.fromFile()

    when(configurationHelper.fromFile("path")).thenReturn(config);

    ForApiBuilder builder = new ClientLoginTokens.ForApiBuilder(
        configurationHelper, clientLogin, ClientLoginTokens.Api.DFP);

    ClientLoginTokens clientLoginTokens = builder.fromFile("path").build();

    assertEquals(clientLoginTokens.clientLogin.getUsername(), "email");
    assertEquals(clientLoginTokens.clientLogin.getPassword(), "password");
    assertEquals(clientLoginTokens.clientLogin.getAuthTokenType(),
        ClientLoginTokens.Api.DFP.getService());
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.ClientLoginTokens.ForApiBuilder.fromFile()

    when(configurationHelper.fromFile("path")).thenReturn(config);

    ForApiBuilder builder = new ClientLoginTokens.ForApiBuilder(
        configurationHelper, clientLogin, ClientLoginTokens.Api.ADWORDS);

    ClientLoginTokens clientLoginTokens = builder.fromFile("path").build();

    assertEquals("AUTH_TOKEN", clientLoginTokens.getToken());
  }
}
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.GoogleClientSecretsBuilder.GoogleClientSecretsForApiBuilder.fromFile()

    when(configurationHelper.fromFile("path")).thenReturn(config);

    GoogleClientSecretsForApiBuilder builder = new GoogleClientSecretsForApiBuilder(
        configurationHelper, GoogleClientSecretsBuilder.Api.DFP);

    GoogleClientSecrets googleClientSecrets = builder.fromFile("path").build();

    assertEquals(googleClientSecrets.getInstalled().getClientId(), "clientId");
    assertEquals(googleClientSecrets.getInstalled().getClientSecret(), "clientSecret");
  }
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.GoogleClientSecretsBuilder.GoogleClientSecretsForApiBuilder.fromFile()

    GoogleClientSecretsForApiBuilder builder = new GoogleClientSecretsForApiBuilder(
        configurationHelper, GoogleClientSecretsBuilder.Api.DFP);

    try {
      builder.fromFile("/home/user/path").build();
      fail("Validation exception should have been thrown");
    } catch (ValidationException e) {
      assertEquals("Client ID must be set as api.dfp.clientId in /home/user/path."
          + "\nIf you do not have a client ID or secret, please create one in the API "
          + "console: https://code.google.com/apis/console#access", e.getMessage());
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.GoogleClientSecretsBuilder.GoogleClientSecretsForApiBuilder.fromFile()

    GoogleClientSecretsForApiBuilder builder = new GoogleClientSecretsForApiBuilder(
        configurationHelper, GoogleClientSecretsBuilder.Api.DFP);

    try {
      builder.fromFile("/home/user/path").build();
      fail("Validation exception should have been thrown");
    } catch (ValidationException e) {
      assertEquals("Client secret must be set as api.dfp.clientSecret in /home/user/path."
          + "\nIf you do not have a client ID or secret, please create one in the API "
          + "console: https://code.google.com/apis/console#access", e.getMessage());
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.OfflineCredentials.ForApiBuilder.fromFile()

    when(configurationHelper.fromFile("path")).thenReturn(config);

    ForApiBuilder builder = new OfflineCredentials.ForApiBuilder(
        configurationHelper, OfflineCredentials.Api.DFP, oAuth2Helper);

    OfflineCredentials offlineCredentials = builder.fromFile("path").build();

    assertEquals(offlineCredentials.getClientId(), "clientId");
    assertEquals(offlineCredentials.getClientSecret(), "clientSecret");
    assertEquals(offlineCredentials.getRefreshToken(), "refreshToken");
  }
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.OfflineCredentials.ForApiBuilder.fromFile()

    ForApiBuilder builder = new OfflineCredentials.ForApiBuilder(
        configurationHelper, OfflineCredentials.Api.DFP, oAuth2Helper);

    OfflineCredentials offlineCredentials =
        builder.fromFile("path").withRefreshToken("overrideRefreshToken").build();

    assertEquals(offlineCredentials.getClientId(), "clientId");
    assertEquals(offlineCredentials.getClientSecret(), "clientSecret");
    assertEquals(offlineCredentials.getRefreshToken(), "overrideRefreshToken");
  }
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.OfflineCredentials.ForApiBuilder.fromFile()

    ForApiBuilder builder = new OfflineCredentials.ForApiBuilder(
        configurationHelper, OfflineCredentials.Api.DFP, oAuth2Helper);

    try {
      OfflineCredentials offlineCredentials = builder.fromFile("/home/user/path").build();
      fail("Validation exception should have been thrown");
    } catch (ValidationException e) {
      assertEquals("A refresh token must be set as api.dfp.refreshToken in /home/user/path."
          + "\nIt is required for offline credentials. If you need to create one, "
          + "see the GetRefreshToken example.", e.getMessage());
View Full Code Here

Examples of com.google.api.ads.common.lib.auth.OfflineCredentials.ForApiBuilder.fromFile()

    ForApiBuilder builder = new OfflineCredentials.ForApiBuilder(
        configurationHelper, OfflineCredentials.Api.DFP, oAuth2Helper);

    try {
      OfflineCredentials offlineCredentials = builder.fromFile("/home/user/path").build();
      fail("Validation exception should have been thrown");
    } catch (ValidationException e) {
      assertEquals("Client ID must be set as api.dfp.clientId in /home/user/path."
          + "\nIf you do not have a client ID or secret, please create one in the API "
          + "console: https://code.google.com/apis/console#access", e.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.