use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class CreateDropRepositoryAnalyzerTest method init.
@Before
public void init() throws Exception {
RepositoriesMetaData repositoriesMetaData = new RepositoriesMetaData(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();
NoopClusterService clusterService = new NoopClusterService(clusterState);
e = SQLExecutor.builder(clusterService).build();
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class AzureRepositorySettingsTests method azureRepository.
private AzureRepository azureRepository(Settings settings) {
Settings internalSettings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath()).putList(Environment.PATH_DATA_SETTING.getKey(), tmpPaths()).put(settings).build();
final AzureRepository azureRepository = new AzureRepository(new RepositoryMetadata("foo", "azure", internalSettings), NamedXContentRegistry.EMPTY, mock(AzureStorageService.class), BlobStoreTestUtil.mockClusterService());
assertThat(azureRepository.getBlobStore(), is(nullValue()));
return azureRepository;
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class S3BlobStoreTests method randomMockS3BlobStore.
/**
* Creates a new {@link S3BlobStore} with random settings.
* <p>
* The blobstore uses a {@link MockAmazonS3} client.
*/
public static S3BlobStore randomMockS3BlobStore() {
String bucket = randomAlphaOfLength(randomIntBetween(1, 10)).toLowerCase(Locale.ROOT);
ByteSizeValue bufferSize = new ByteSizeValue(randomIntBetween(5, 100), ByteSizeUnit.MB);
boolean serverSideEncryption = randomBoolean();
String cannedACL = null;
if (randomBoolean()) {
cannedACL = randomFrom(CannedAccessControlList.values()).toString();
}
String storageClass = null;
if (randomBoolean()) {
storageClass = randomValueOtherThan(StorageClass.Glacier, () -> randomFrom(StorageClass.values())).toString();
}
final AmazonS3 client = new MockAmazonS3(new ConcurrentHashMap<>(), bucket, serverSideEncryption, cannedACL, storageClass);
final S3Service service = new S3Service() {
@Override
public synchronized AmazonS3Reference client(RepositoryMetadata metadata) {
return new AmazonS3Reference(client);
}
};
return new S3BlobStore(service, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass, new RepositoryMetadata(bucket, "s3", Settings.EMPTY));
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class AzureBlobStoreTests 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;
}
}
use of org.elasticsearch.cluster.metadata.RepositoryMetaData in project crate by crate.
the class CreateDropRepositoryAnalyzerTest 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("fs", new TypeSettings(FsRepository.mandatorySettings(), FsRepository.optionalSettings())));
}
Aggregations