Search in sources :

Example 1 with StatisticsHttpClientSender

use of com.intellij.internal.statistic.connect.StatisticsHttpClientSender in project intellij-community by JetBrains.

the class RemotelyConfigurableStatServiceTest method testIncorrectUrlSending.

@Test
public void testIncorrectUrlSending() {
    RemotelyConfigurableStatisticsService service = new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(STAT_CONFIG_URL, STAT_URL), new StatisticsHttpClientSender(), new StatisticsUploadAssistant() {

        @Override
        public String getData(@NotNull Set<String> disabledGroups) {
            return "group:key1=11";
        }
    });
    StatisticsResult result = service.send();
    assertEquals(StatisticsResult.ResultCode.SENT_WITH_ERRORS, result.getCode());
}
Also used : StatisticsResult(com.intellij.internal.statistic.connect.StatisticsResult) StatisticsConnectionService(com.intellij.internal.statistic.connect.StatisticsConnectionService) StatisticsHttpClientSender(com.intellij.internal.statistic.connect.StatisticsHttpClientSender) RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService) StatisticsUploadAssistant(com.intellij.internal.statistic.StatisticsUploadAssistant) Test(org.junit.Test)

Example 2 with StatisticsHttpClientSender

use of com.intellij.internal.statistic.connect.StatisticsHttpClientSender in project intellij-community by JetBrains.

the class RemotelyConfigurableStatServiceTest method testErrorInRemoteConfiguration.

@Test
public void testErrorInRemoteConfiguration() {
    RemotelyConfigurableStatisticsService service = new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(STAT_CONFIG_URL, null), new StatisticsHttpClientSender(), new StatisticsUploadAssistant());
    StatisticsResult result = service.send();
    assertEquals(StatisticsResult.ResultCode.ERROR_IN_CONFIG, result.getCode());
}
Also used : StatisticsResult(com.intellij.internal.statistic.connect.StatisticsResult) StatisticsConnectionService(com.intellij.internal.statistic.connect.StatisticsConnectionService) StatisticsHttpClientSender(com.intellij.internal.statistic.connect.StatisticsHttpClientSender) RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService) StatisticsUploadAssistant(com.intellij.internal.statistic.StatisticsUploadAssistant) Test(org.junit.Test)

Example 3 with StatisticsHttpClientSender

use of com.intellij.internal.statistic.connect.StatisticsHttpClientSender in project intellij-community by JetBrains.

the class RemotelyConfigurableStatServiceTest method testRemotelyDisabledTransmission.

@Test
public void testRemotelyDisabledTransmission() {
    RemotelyConfigurableStatisticsService service = new RemotelyConfigurableStatisticsService(new StatisticsConnectionService() {

        @Override
        public boolean isTransmissionPermitted() {
            return false;
        }
    }, new StatisticsHttpClientSender(), new StatisticsUploadAssistant());
    StatisticsResult result = service.send();
    assertEquals(StatisticsResult.ResultCode.NOT_PERMITTED_SERVER, result.getCode());
}
Also used : StatisticsResult(com.intellij.internal.statistic.connect.StatisticsResult) StatisticsConnectionService(com.intellij.internal.statistic.connect.StatisticsConnectionService) StatisticsHttpClientSender(com.intellij.internal.statistic.connect.StatisticsHttpClientSender) RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService) StatisticsUploadAssistant(com.intellij.internal.statistic.StatisticsUploadAssistant) Test(org.junit.Test)

Example 4 with StatisticsHttpClientSender

use of com.intellij.internal.statistic.connect.StatisticsHttpClientSender in project intellij-community by JetBrains.

the class RemotelyConfigurableStatServiceTest method testEmptyDataSending.

@Test
public void testEmptyDataSending() {
    RemotelyConfigurableStatisticsService service = new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(), new StatisticsHttpClientSender(), new StatisticsUploadAssistant() {

        @Override
        public String getData(@NotNull Set<String> disabledGroups) {
            return "";
        }
    });
    StatisticsResult result = service.send();
    assertEquals(StatisticsResult.ResultCode.NOTHING_TO_SEND, result.getCode());
}
Also used : StatisticsResult(com.intellij.internal.statistic.connect.StatisticsResult) StatisticsConnectionService(com.intellij.internal.statistic.connect.StatisticsConnectionService) StatisticsHttpClientSender(com.intellij.internal.statistic.connect.StatisticsHttpClientSender) RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService) StatisticsUploadAssistant(com.intellij.internal.statistic.StatisticsUploadAssistant) Test(org.junit.Test)

Example 5 with StatisticsHttpClientSender

use of com.intellij.internal.statistic.connect.StatisticsHttpClientSender in project intellij-community by JetBrains.

the class StatisticsUploadAssistant method getStatisticsService.

public static StatisticsService getStatisticsService() {
    String key = ((ApplicationInfoImpl) ApplicationInfoImpl.getShadowInstance()).getStatisticsServiceKey();
    StatisticsService service = key == null ? null : COLLECTOR.findSingle(key);
    if (service != null) {
        return service;
    }
    return new RemotelyConfigurableStatisticsService(new StatisticsConnectionService(), new StatisticsHttpClientSender(), new StatisticsUploadAssistant());
}
Also used : RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService) StatisticsService(com.intellij.internal.statistic.connect.StatisticsService) StatisticsConnectionService(com.intellij.internal.statistic.connect.StatisticsConnectionService) ApplicationInfoImpl(com.intellij.openapi.application.impl.ApplicationInfoImpl) StatisticsHttpClientSender(com.intellij.internal.statistic.connect.StatisticsHttpClientSender) RemotelyConfigurableStatisticsService(com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService)

Aggregations

RemotelyConfigurableStatisticsService (com.intellij.internal.statistic.connect.RemotelyConfigurableStatisticsService)5 StatisticsConnectionService (com.intellij.internal.statistic.connect.StatisticsConnectionService)5 StatisticsHttpClientSender (com.intellij.internal.statistic.connect.StatisticsHttpClientSender)5 StatisticsUploadAssistant (com.intellij.internal.statistic.StatisticsUploadAssistant)4 StatisticsResult (com.intellij.internal.statistic.connect.StatisticsResult)4 Test (org.junit.Test)4 StatisticsService (com.intellij.internal.statistic.connect.StatisticsService)1 ApplicationInfoImpl (com.intellij.openapi.application.impl.ApplicationInfoImpl)1