Codota Logo
ProfileFetcherResult
Code IndexAdd Codota to your IDE (free)

How to use
ProfileFetcherResult
in
com.microsoft.applicationinsights.web.internal.correlation

Best Java code snippets using com.microsoft.applicationinsights.web.internal.correlation.ProfileFetcherResult (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: Microsoft/ApplicationInsights-Java

@Override
public ProfileFetcherResult fetchAppProfile(String instrumentationKey) throws ExecutionException {
  ++callCounter;
  
  if (throwException) {
    throw new ExecutionException("No doughnuts for you.", null);
  }
  return new ProfileFetcherResult(this.appId, this.status);
}

origin: com.microsoft.azure/applicationinsights-web

  private String processResult(ProfileFetcherResult result, String instrumentationKey) {
    
    String appId = null;
    
    switch (result.getStatus()) {
      case PENDING:
        InternalLogger.INSTANCE.trace("InstrumentationKeyResolver - pending resolution of instrumentation key: %s", instrumentationKey);
        break;
      case FAILED:
        InternalLogger.INSTANCE.error("InstrumentationKeyResolver - failed to resolve instrumentation key: %s", instrumentationKey);
        break;
      case COMPLETE:
        InternalLogger.INSTANCE.trace("InstrumentationKeyResolver - successfully resolved instrumentation key: %s", instrumentationKey);
        appId = String.format(CorrelationIdFormat, result.getAppId());
        break;
      default:
        InternalLogger.INSTANCE.error("InstrumentationKeyResolver - unexpected status. Instrumentation key: %s", instrumentationKey);
        break;
    }

    return appId;
  }
}
origin: Microsoft/ApplicationInsights-Java

  private String processResult(ProfileFetcherResult result, String instrumentationKey) {
    
    String appId = null;
    
    switch (result.getStatus()) {
      case PENDING:
        InternalLogger.INSTANCE.trace("InstrumentationKeyResolver - pending resolution of instrumentation key: %s", instrumentationKey);
        break;
      case FAILED:
        InternalLogger.INSTANCE.error("InstrumentationKeyResolver - failed to resolve instrumentation key: %s", instrumentationKey);
        break;
      case COMPLETE:
        InternalLogger.INSTANCE.trace("InstrumentationKeyResolver - successfully resolved instrumentation key: %s", instrumentationKey);
        appId = String.format(CorrelationIdFormat, result.getAppId());
        break;
      default:
        InternalLogger.INSTANCE.error("InstrumentationKeyResolver - unexpected status. Instrumentation key: %s", instrumentationKey);
        break;
    }

    return appId;
  }
}
origin: com.microsoft.azure/applicationinsights-web

ProfileFetcherResult result = new ProfileFetcherResult(null, ProfileFetcherResultTaskStatus.PENDING);
    return new ProfileFetcherResult(null, ProfileFetcherResultTaskStatus.FAILED);
    return new ProfileFetcherResult(null, ProfileFetcherResultTaskStatus.FAILED);
  return new ProfileFetcherResult(appId, ProfileFetcherResultTaskStatus.COMPLETE);
origin: Microsoft/ApplicationInsights-Java

@Test
public void testFetchApplicationIdMultipleIkeys() throws InterruptedException, ExecutionException, ParseException, IOException {
  //setup
  MockHttpAsyncClientWrapper clientWrapper = new MockHttpAsyncClientWrapper();
  clientWrapper.setAppId("AppId");
  clientWrapper.setFailureOn(false);
  
  CdsProfileFetcher fetcher = new CdsProfileFetcher();
  fetcher.setHttpClient(clientWrapper.getClient());
  // the first time we try to fetch the profile, we should get a "pending" task status
  // since the profile fetcher uses asynchronous calls to retrieve the profile from CDS
  ProfileFetcherResult result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.PENDING, result.getStatus());
  Assert.assertNull(result.getAppId());
  // call for a second ikey, should also return "pending"
  result = fetcher.fetchAppProfile("ikey2");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.PENDING, result.getStatus());
  Assert.assertNull(result.getAppId());
  // mimic task completion
  clientWrapper.setTaskAsComplete();
  result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.COMPLETE, result.getStatus());
  Assert.assertEquals("AppId", result.getAppId());
  clientWrapper.setAppId("AppId2");
  result = fetcher.fetchAppProfile("ikey2");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.COMPLETE, result.getStatus());
  Assert.assertEquals("AppId2", result.getAppId());
}
origin: Microsoft/ApplicationInsights-Java

ProfileFetcherResult result = new ProfileFetcherResult(null, ProfileFetcherResultTaskStatus.PENDING);
    return new ProfileFetcherResult(null, ProfileFetcherResultTaskStatus.FAILED);
    return new ProfileFetcherResult(null, ProfileFetcherResultTaskStatus.FAILED);
  return new ProfileFetcherResult(appId, ProfileFetcherResultTaskStatus.COMPLETE);
origin: Microsoft/ApplicationInsights-Java

@Test
public void testFetchApplicationId() throws InterruptedException, ExecutionException, ParseException, IOException {
  //setup
  MockHttpAsyncClientWrapper clientWrapper = new MockHttpAsyncClientWrapper();
  clientWrapper.setAppId("AppId");
  clientWrapper.setFailureOn(false);
  
  CdsProfileFetcher fetcher = new CdsProfileFetcher();
  fetcher.setHttpClient(clientWrapper.getClient());
  // the first time we try to fetch the profile, we might get a "pending" task status
  // since the profile fetcher uses asynchronous calls to retrieve the profile from CDS
  // this is mimic'ed with clientWrapper.setTaskAsPending();
  clientWrapper.setTaskAsPending();
  ProfileFetcherResult result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.PENDING, result.getStatus());
  Assert.assertNull(result.getAppId());
  // mimic task completion
  clientWrapper.setTaskAsComplete();
  result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.COMPLETE, result.getStatus());
  Assert.assertEquals("AppId", result.getAppId());
}
origin: Microsoft/ApplicationInsights-Java

@Test
public void testFetchApplicationIdFailureWithNon200StatusCode() throws InterruptedException, ExecutionException, ParseException, IOException {
  //setup
  MockHttpAsyncClientWrapper clientWrapper = new MockHttpAsyncClientWrapper();
  clientWrapper.setAppId("AppId");
  clientWrapper.setFailureOn(false);
  
  CdsProfileFetcher fetcher = new CdsProfileFetcher();
  fetcher.setHttpClient(clientWrapper.getClient());
  // the first time we try to fetch the profile, we might get a "pending" task status
  // since the profile fetcher uses asynchronous calls to retrieve the profile from CDS
  // this is mimic'ed with clientWrapper.setTaskAsPending();
  clientWrapper.setTaskAsPending();
  ProfileFetcherResult result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.PENDING, result.getStatus());
  Assert.assertNull(result.getAppId());
  // mimic task completion with 404 status code
  clientWrapper.setTaskAsComplete();
  clientWrapper.setStatusCode(404);
  result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.FAILED, result.getStatus());
  Assert.assertNull(result.getAppId());
}
origin: Microsoft/ApplicationInsights-Java

@Test
public void testFetchApplicationIdWithTaskCompleteImmediately() throws InterruptedException, ExecutionException, ParseException, IOException {
  //setup
  MockHttpAsyncClientWrapper clientWrapper = new MockHttpAsyncClientWrapper();
  clientWrapper.setAppId("AppId");
  clientWrapper.setFailureOn(false);
  clientWrapper.setTaskAsComplete();
  
  CdsProfileFetcher fetcher = new CdsProfileFetcher();
  fetcher.setHttpClient(clientWrapper.getClient());
  // task is completed right away
  ProfileFetcherResult result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.COMPLETE, result.getStatus());
  Assert.assertEquals("AppId", result.getAppId());
}
origin: Microsoft/ApplicationInsights-Java

@Test(expected = ExecutionException.class)
public void testFetchApplicationIdFailureWithException() throws InterruptedException, ExecutionException, ParseException, IOException {
  //setup - mimic timeout from the async http call
  MockHttpAsyncClientWrapper clientWrapper = new MockHttpAsyncClientWrapper();
  clientWrapper.setAppId("AppId");
  
  CdsProfileFetcher fetcher = new CdsProfileFetcher();
  fetcher.setHttpClient(clientWrapper.getClient());
  // the first time we try to fetch the profile, we should get a "pending" task status
  // since the profile fetcher uses asynchronous calls to retrieve the profile from CDS
  ProfileFetcherResult result = fetcher.fetchAppProfile("ikey");
  Assert.assertEquals(ProfileFetcherResultTaskStatus.PENDING, result.getStatus());
  Assert.assertNull(result.getAppId());
  // instruct mock task to fail
  clientWrapper.setFailureOn(true);
  clientWrapper.setTaskAsComplete();
  result = fetcher.fetchAppProfile("ikey");
  Assert.fail("Should not have reached here. Instead, an exception should have been thrown.");
}
com.microsoft.applicationinsights.web.internal.correlationProfileFetcherResult

Most used methods

  • <init>
  • getAppId
  • getStatus

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSharedPreferences (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getExternalFilesDir (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now