use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class SysRepositoriesService method addRepositories.
private void addRepositories(@Nullable RepositoriesMetaData repositoriesMetaData) {
if (repositoriesMetaData == null) {
return;
}
for (RepositoryMetaData repositoryMetaData : repositoriesMetaData.repositories()) {
SysRepository repository = new SysRepository(repositoryMetaData.name(), repositoryMetaData.type(), repositoryMetaData.settings().getAsStructuredMap());
repositoriesTable.put(repositoryMetaData.name(), repository);
}
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class AwsS3ServiceImplTests method testGetClientForSameSettingsReturnsCachedClient.
@Test
public void testGetClientForSameSettingsReturnsCachedClient() {
RepositoryMetadata metadata = new RepositoryMetadata("", "", Settings.builder().put("access_key", "access_key").put("secret_key", "secret_key").build());
var clientRef = service.client(metadata);
assertThat(clientRef.refCount(), is(2));
var newClientRef = service.client(metadata);
assertThat(newClientRef.refCount(), is(3));
assertThat(clientRef.client(), is(newClientRef.client()));
clientRef.client().shutdown();
newClientRef.client().shutdown();
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class AwsS3ServiceImplTests method testGetClientForUpdatedSettingsReturnsNewClient.
@Test
public void testGetClientForUpdatedSettingsReturnsNewClient() {
Settings settings = Settings.builder().put("access_key", "access_key").put("secret_key", "secret_key").build();
Settings newSettings = Settings.builder().put("access_key", "access_key").put("secret_key", "new_secret_key").build();
RepositoryMetadata metadata = new RepositoryMetadata("", "", settings);
RepositoryMetadata newMetadata = new RepositoryMetadata("", "", newSettings);
AmazonS3Reference clientRef = service.client(metadata);
assertThat(clientRef.refCount(), is(2));
AmazonS3Reference newClientRef = service.client(newMetadata);
assertThat(newClientRef.refCount(), is(2));
assertThat(clientRef.client(), is(not(newClientRef.client())));
clientRef.client().shutdown();
newClientRef.client().shutdown();
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class S3RepositoryPluginAnalyzerTest method prepare.
@Before
public void prepare() {
RepositoriesMetadata repositoriesMetadata = new RepositoriesMetadata(Collections.singletonList(new RepositoryMetadata("my_repo", "fs", Settings.builder().put("location", "/tmp/my_repo").build())));
ClusterState clusterState = ClusterState.builder(new ClusterName("testing")).metadata(Metadata.builder().putCustom(RepositoriesMetadata.TYPE, repositoriesMetadata)).build();
ClusterServiceUtils.setState(clusterService, clusterState);
e = SQLExecutor.builder(clusterService).build();
plannerContext = e.getPlannerContext(clusterService.state());
repositoryParamValidator = new RepositoryParamValidator(Map.of("s3", new TypeSettings(List.of(), S3Repository.optionalSettings())));
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class AzureBlobStoreContainerTests method newBlobStore.
@Override
protected BlobStore newBlobStore() {
RepositoryMetadata repositoryMetadata = new RepositoryMetadata("azure", "ittest", Settings.EMPTY);
AzureStorageServiceMock client = new AzureStorageServiceMock();
try (AzureBlobStore azureBlobStore = new AzureBlobStore(repositoryMetadata, client)) {
return azureBlobStore;
}
}
Aggregations