Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rules): remove unused code #1677

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 1 addition & 51 deletions src/main/java/io/cryostat/rules/RulesModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
package io.cryostat.rules;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.Executors;
import java.util.function.Function;

import javax.inject.Named;
import javax.inject.Singleton;
Expand All @@ -30,13 +28,9 @@
import io.cryostat.configuration.ConfigurationModule;
import io.cryostat.configuration.CredentialsManager;
import io.cryostat.core.log.Logger;
import io.cryostat.core.net.Credentials;
import io.cryostat.core.sys.FileSystem;
import io.cryostat.discovery.DiscoveryStorage;
import io.cryostat.net.HttpServer;
import io.cryostat.net.NetworkConfiguration;
import io.cryostat.net.TargetConnectionManager;
import io.cryostat.net.web.http.AbstractAuthenticatedRequestHandler;
import io.cryostat.recordings.RecordingArchiveHelper;
import io.cryostat.recordings.RecordingMetadataManager;
import io.cryostat.recordings.RecordingOptionsBuilderFactory;
Expand All @@ -46,17 +40,11 @@
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;
import io.vertx.core.MultiMap;
import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.client.WebClientOptions;
import org.apache.commons.codec.binary.Base64;

@Module
public abstract class RulesModule {
public static final String RULES_SUBDIRECTORY = "rules";
public static final String RULES_WEB_CLIENT = "RULES_WEB_CLIENT";
public static final String RULES_HEADERS_FACTORY = "RULES_HEADERS_FACTORY";

@Provides
@Singleton
Expand Down Expand Up @@ -141,45 +129,7 @@ static RuleProcessor provideRuleProcessor(

@Provides
@Singleton
static PeriodicArchiverFactory providePeriodicArchivedFactory(
@Named(RULES_HEADERS_FACTORY) Function<Credentials, MultiMap> headersFactory,
Logger logger) {
static PeriodicArchiverFactory providePeriodicArchivedFactory(Logger logger) {
return new PeriodicArchiverFactory(logger);
}

@Provides
@Singleton
@Named(RULES_WEB_CLIENT)
static WebClient provideRulesWebClient(
Vertx vertx, HttpServer server, NetworkConfiguration netConf) {
WebClientOptions opts =
new WebClientOptions()
.setSsl(server.isSsl())
.setDefaultHost("localhost")
.setDefaultPort(netConf.getInternalWebServerPort())
.setTrustAll(true)
.setVerifyHost(false);
return WebClient.create(vertx, opts);
}

@Provides
@Named(RULES_HEADERS_FACTORY)
static Function<Credentials, MultiMap> provideRulesHeadersFactory() {
return credentials -> {
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
if (credentials != null) {
headers.add(
AbstractAuthenticatedRequestHandler.JMX_AUTHORIZATION_HEADER,
String.format(
"Basic %s",
Base64.encodeBase64String(
String.format(
"%s:%s",
credentials.getUsername(),
credentials.getPassword())
.getBytes(StandardCharsets.UTF_8))));
}
return headers;
};
}
}
59 changes: 0 additions & 59 deletions src/test/java/io/cryostat/rules/RulesHeadersFactoryTest.java

This file was deleted.

Loading