@SuppressWarnings("unchecked") private ProductPartitionTree(final ProductPartitionTreeImpl impl) { InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( impl, AdWordsInternals.getInstance().getAdsUtilityRegistry()) { @Override public String toString() { return impl.toString(); } }; this.impl = Reflection.newProxy(ProductPartitionTreeInterface.class, invocationHandler); }
/** * Constructs a {@link ReportDownloader}. * * @param session AdWordsSession to use to make report download requests. */ public ReportDownloader(AdWordsSession session) { this( AdWordsInternals.getBootstrapper().getInstanceOf(session, AdHocReportDownloadHelper.class)); }
/** * Tests that {@link AdHocReportDownloadHelper#getReportDownloadTimeout()} retrieves the global * timeout if not set on the helper. */ @Test public void testGetReportDownloadTimeout() { assertEquals( AdWordsInternals.getInstance().getAdWordsLibConfiguration().getReportDownloadTimeout(), helper.getReportDownloadTimeout()); }
@Override public Internals getInternals() { switch (this) { case ADWORDS: return com.google.api.ads.adwords.lib.utils.AdWordsInternals.getInstance(); case AD_MANAGER: return com.google.api.ads.admanager.lib.utils.AdManagerInternals.getInstance(); default: return null; } } }
/** * Tests that {@link AdHocReportDownloadHelper#setReportDownloadTimeout(int)} sets the * helper-specific timeout and does not affect the global timeout. */ @Test public void testSetReportDownloadTimeout() { int internalsTimeout = AdWordsInternals.getInstance().getAdWordsLibConfiguration().getReportDownloadTimeout(); assertEquals(internalsTimeout, helper.getReportDownloadTimeout()); int helperTimeout = internalsTimeout + 10; helper.setReportDownloadTimeout(helperTimeout); assertEquals("Timeout on helper does not reflect changes made via setReportDownloadTimeout", helperTimeout, helper.getReportDownloadTimeout()); assertEquals("Setting the timeout on a helper instance modified the global timeout", internalsTimeout, AdWordsInternals.getInstance().getAdWordsLibConfiguration().getReportDownloadTimeout()); }
@Override public Internals getInternals() { switch (this) { case ADWORDS: return com.google.api.ads.adwords.lib.utils.AdWordsInternals.getInstance(); case AD_MANAGER: return com.google.api.ads.admanager.lib.utils.AdManagerInternals.getInstance(); default: return null; } } }
@SuppressWarnings("unchecked") private ProductPartitionTree(final ProductPartitionTreeImpl impl) { InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( impl, AdWordsInternals.getInstance().getAdsUtilityRegistry()) { @Override public String toString() { return impl.toString(); } }; this.impl = Reflection.newProxy(ProductPartitionTreeInterface.class, invocationHandler); }
/** * Test method for {@link AdWordsInternals#getInstance()}. */ @Test public void testGetInstance() { Internals internals = AdWordsInternals.getInstance(); String userAgent = internals.getUserAgentCombiner().getUserAgent("test"); assertTrue(userAgent.contains("AwApi")); assertFalse(userAgent.contains("DfaApi")); assertFalse(userAgent.contains("DfpApi")); }
/** * Constructs a {@link ReportDownloader}. * * @param session AdWordsSession to use to make report download requests. */ public ReportDownloader(AdWordsSession session) { this( AdWordsInternals.getBootstrapper().getInstanceOf(session, AdHocReportDownloadHelper.class)); }
@SuppressWarnings("unchecked") private ProductPartitionTree(final ProductPartitionTreeImpl impl) { InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( impl, AdWordsInternals.getInstance().getAdsUtilityRegistry()) { @Override public String toString() { return impl.toString(); } }; this.impl = Reflection.newProxy(ProductPartitionTreeInterface.class, invocationHandler); }
/** * Constructs a {@link ReportDownloader}. * * @param session AdWordsSession to use to make report download requests. */ public ReportDownloader(AdWordsSession session) { this( AdWordsInternals.getBootstrapper().getInstanceOf(session, AdHocReportDownloadHelper.class)); }
@SuppressWarnings("unchecked") private ProductPartitionTree(final ProductPartitionTreeImpl impl) { InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( impl, AdWordsInternals.getInstance().getAdsUtilityRegistry()) { @Override public String toString() { return impl.toString(); } }; this.impl = Reflection.newProxy(ProductPartitionTreeInterface.class, invocationHandler); }
/** * Constructs a {@link ReportDownloader}. * * @param session AdWordsSession to use to make report download requests. */ public ReportDownloader(AdWordsSession session) { this( AdWordsInternals.getBootstrapper().getInstanceOf(session, AdHocReportDownloadHelper.class)); }
@SuppressWarnings("unchecked") private ProductPartitionTree(final ProductPartitionTreeImpl impl) { InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( impl, AdWordsInternals.getInstance().getAdsUtilityRegistry()) { @Override public String toString() { return impl.toString(); } }; this.impl = Reflection.newProxy(ProductPartitionTreeInterface.class, invocationHandler); }
/** * Constructs a {@link ReportDownloader}. * * @param session AdWordsSession to use to make report download requests. */ public ReportDownloader(AdWordsSession session) { this( AdWordsInternals.getBootstrapper().getInstanceOf(session, AdHocReportDownloadHelper.class)); }
/** Constructs a new report query builder. */ public Builder() { proxiedImpl = new ReportQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
/** Constructs a new service query builder. */ @SuppressWarnings("unchecked") public Builder() { proxiedImpl = new ServiceQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
/** Constructs a new service query builder. */ @SuppressWarnings("unchecked") public Builder() { proxiedImpl = new ServiceQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
/** Constructs a new service query builder. */ @SuppressWarnings("unchecked") public Builder() { proxiedImpl = new ServiceQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }
/** Constructs a new report query builder. */ public Builder() { proxiedImpl = new ReportQueryBuilderImpl(this); InvocationHandler invocationHandler = new AdsUtilityInvocationHandler( proxiedImpl, AdWordsInternals.getInstance().getAdsUtilityRegistry()); this.proxy = Reflection.newProxy(BuilderInterface.class, invocationHandler); }