IDEA-314605 disable ability to substitute template url

Remove old deprecated EventLogEndpointSubstitutor EP

GitOrigin-RevId: 1158e0665e850f1d99554f50d2723b4b6e8c2c04
This commit is contained in:
Victor Matchenko
2023-03-07 19:38:12 +00:00
committed by intellij-monorepo-bot
parent 8fb76f1f9f
commit 0a95feb352
9 changed files with 9 additions and 87 deletions
@@ -4231,7 +4231,6 @@ io/netty/handler/codec/http/HttpObject.class:lib/util-8.jar
io/netty/handler/codec/http/HttpMessage.class:lib/util-8.jar
io/netty/handler/codec/http/HttpRequest.class:lib/util-8.jar
com/intellij/ide/ui/laf/LafManagerImpl$settingsToolbar$1.class:lib/app.jar
com/intellij/internal/statistic/eventLog/EventLogEndpointSubstitutor.class:lib/stats.jar
com/intellij/openapi/vfs/DiskQueryRelay.class:lib/app.jar
com/intellij/openapi/vfs/newvfs/persistent/PersistentFSSynchronizedRecordsStorage.class:lib/app.jar
it/unimi/dsi/fastutil/longs/LongIterable.class:lib/util-8.jar
@@ -4231,7 +4231,6 @@ io/netty/handler/codec/http/HttpObject.class:lib/util-8.jar
io/netty/handler/codec/http/HttpMessage.class:lib/util-8.jar
io/netty/handler/codec/http/HttpRequest.class:lib/util-8.jar
com/intellij/ide/ui/laf/LafManagerImpl$settingsToolbar$1.class:lib/app.jar
com/intellij/internal/statistic/eventLog/EventLogEndpointSubstitutor.class:lib/stats.jar
com/intellij/openapi/vfs/DiskQueryRelay.class:lib/app.jar
com/intellij/openapi/vfs/newvfs/persistent/PersistentFSSynchronizedRecordsStorage.class:lib/app.jar
it/unimi/dsi/fastutil/longs/LongIterable.class:lib/util-8.jar
@@ -4231,7 +4231,6 @@ io/netty/handler/codec/http/HttpObject.class:lib/util-8.jar
io/netty/handler/codec/http/HttpMessage.class:lib/util-8.jar
io/netty/handler/codec/http/HttpRequest.class:lib/util-8.jar
com/intellij/ide/ui/laf/LafManagerImpl$settingsToolbar$1.class:lib/app.jar
com/intellij/internal/statistic/eventLog/EventLogEndpointSubstitutor.class:lib/stats.jar
com/intellij/openapi/vfs/DiskQueryRelay.class:lib/app.jar
com/intellij/openapi/vfs/newvfs/persistent/PersistentFSSynchronizedRecordsStorage.class:lib/app.jar
it/unimi/dsi/fastutil/longs/LongIterable.class:lib/util-8.jar
@@ -196,7 +196,6 @@
<extensionPoint name="statistic.eventLog.eventLoggerProvider" interface="com.intellij.internal.statistic.eventLog.StatisticsEventLoggerProvider"/>
<extensionPoint name="statistic.eventLog.fusStateEventTracker" interface="com.intellij.internal.statistic.eventLog.fus.FeatureUsageStateEventTracker"/>
<extensionPoint name="statistic.eventLog.eventLogEndpointSubstitutor" interface="com.intellij.internal.statistic.eventLog.EventLogEndpointSubstitutor" dynamic="true"/>
<extensionPoint name="statistic.eventLog.externalEventLogSettings" interface="com.intellij.internal.statistic.eventLog.ExternalEventLogSettings" dynamic="true"/>
<extensionPoint name="productivityFeaturesProvider" interface="com.intellij.featureStatistics.ProductivityFeaturesProvider"
@@ -1,32 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("DEPRECATION")
package com.intellij.internal.statistics
import com.intellij.internal.statistic.eventLog.EventLogEndpointSubstitutor
import com.intellij.internal.statistic.eventLog.EventLogInternalApplicationInfo
import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import org.assertj.core.api.Assertions.assertThat
private const val URL = "https://localhost/"
class ConfigEndpointSubstitutorTest : BasePlatformTestCase() {
private class TestEndpointSubstitutor: EventLogEndpointSubstitutor {
override fun getTemplateUrl(recorderId: String) = URL
}
override fun setUp() {
super.setUp()
installEp()
}
fun installEp() {
ExtensionTestUtil.maskExtensions(EventLogEndpointSubstitutor.EP_NAME, listOf(TestEndpointSubstitutor()), testRootDisposable)
}
fun testSubstitution() {
val applicationInfo = EventLogInternalApplicationInfo("FUS", true)
assertThat(applicationInfo.templateUrl).isEqualTo(URL)
}
}
@@ -31,7 +31,7 @@ class ExternalEventLogSettingsTest : BasePlatformTestCase() {
fun testSubstitution() {
val applicationInfo = EventLogInternalApplicationInfo(true)
Assertions.assertThat(applicationInfo.templateUrl).isEqualTo(URL)
Assertions.assertThat(applicationInfo.templateUrl).isNotEqualTo(URL)
}
fun testSendOverride() {
@@ -1,30 +0,0 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.internal.statistic.eventLog;
import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @deprecated use {@link ExternalEventLogSettings} instead
*/
@Deprecated(forRemoval = true)
@ApiStatus.Internal
public interface EventLogEndpointSubstitutor {
ExtensionPointName<EventLogEndpointSubstitutor> EP_NAME = new ExtensionPointName<>("com.intellij.statistic.eventLog.eventLogEndpointSubstitutor");
/**
* @deprecated Endpoint shouldn't depend on recorder id. Use {@link #getTemplateUrl()}
*/
@Deprecated
@Nullable String getTemplateUrl(@NotNull String recorderId);
/**
* Provides a custom endpoint for fetching configuration
* @return Remote endpoint URL or null if platform default should be used
*/
default @Nullable String getTemplateUrl() {
return getTemplateUrl("UNDEFINED");
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.internal.statistic.eventLog;
import com.intellij.internal.statistic.eventLog.connection.EventLogConnectionSettings;
@@ -44,23 +44,6 @@ public class EventLogInternalApplicationInfo implements EventLogApplicationInfo
@NotNull
@Override
public String getTemplateUrl() {
ExternalEventLogSettings externalEventLogSettings = StatisticsEventLogProviderUtil.getExternalEventLogSettings();
if (externalEventLogSettings != null) {
String result = externalEventLogSettings.getTemplateUrl();
return result == null ? getDefaultTemplateUrl() : result;
}
else if (ApplicationManager.getApplication().getExtensionArea().hasExtensionPoint(EventLogEndpointSubstitutor.EP_NAME.getName())) {
EventLogEndpointSubstitutor validSubstitutor = EventLogEndpointSubstitutor.EP_NAME.findFirstSafe(substitutor -> {
return PluginInfoDetectorKt.getPluginInfo(substitutor.getClass()).isAllowedToInjectIntoFUS();
});
String result = validSubstitutor == null ? null : validSubstitutor.getTemplateUrl();
return result == null ? getDefaultTemplateUrl() : result;
}
return getDefaultTemplateUrl();
}
private static String getDefaultTemplateUrl() {
return ((ApplicationInfoImpl)ApplicationInfoImpl.getShadowInstance()).getEventLogSettingsUrl();
}
@@ -25,13 +25,18 @@ public interface ExternalEventLogSettings {
/**
* @deprecated Endpoint shouldn't depend on recorder id. Use {@link #getTemplateUrl()}
*/
@Deprecated
@Nullable String getTemplateUrl(@NotNull String recorderId);
@Deprecated(since = "2022.2")
default @Nullable String getTemplateUrl(@NotNull String recorderId) {
return null;
}
/**
* Provides a custom endpoint for fetching configuration
*
* @return Remote endpoint URL or null if platform default should be used
* @deprecated functionality is disabled
*/
@Deprecated(since = "2023.1")
default @Nullable String getTemplateUrl() {
return getTemplateUrl("UNDEFINED");
}