Search in sources :

Example 31 with RepositoryMetadata

use of org.elasticsearch.cluster.metadata.RepositoryMetadata in project elasticsearch by elastic.

the class S3RepositoryTests method assertValidBuffer.

private void assertValidBuffer(long bufferMB, long chunkMB) throws IOException {
    RepositoryMetaData metadata = new RepositoryMetaData("dummy-repo", "mock", Settings.builder().put(Repository.BUFFER_SIZE_SETTING.getKey(), new ByteSizeValue(bufferMB, ByteSizeUnit.MB)).put(Repository.CHUNK_SIZE_SETTING.getKey(), new ByteSizeValue(chunkMB, ByteSizeUnit.MB)).build());
    new S3Repository(metadata, Settings.EMPTY, NamedXContentRegistry.EMPTY, new DummyS3Service());
}
Also used : RepositoryMetaData(org.elasticsearch.cluster.metadata.RepositoryMetaData) ByteSizeValue(org.elasticsearch.common.unit.ByteSizeValue)

Example 32 with RepositoryMetadata

use of org.elasticsearch.cluster.metadata.RepositoryMetadata in project elasticsearch by elastic.

the class S3RepositoryTests method assertInvalidBuffer.

private void assertInvalidBuffer(int bufferMB, int chunkMB, Class<? extends Exception> clazz, String msg) throws IOException {
    RepositoryMetaData metadata = new RepositoryMetaData("dummy-repo", "mock", Settings.builder().put(Repository.BUFFER_SIZE_SETTING.getKey(), new ByteSizeValue(bufferMB, ByteSizeUnit.MB)).put(Repository.CHUNK_SIZE_SETTING.getKey(), new ByteSizeValue(chunkMB, ByteSizeUnit.MB)).build());
    Exception e = expectThrows(clazz, () -> new S3Repository(metadata, Settings.EMPTY, NamedXContentRegistry.EMPTY, new DummyS3Service()));
    assertThat(e.getMessage(), containsString(msg));
}
Also used : RepositoryMetaData(org.elasticsearch.cluster.metadata.RepositoryMetaData) ByteSizeValue(org.elasticsearch.common.unit.ByteSizeValue) IOException(java.io.IOException) RepositoryException(org.elasticsearch.repositories.RepositoryException)

Example 33 with RepositoryMetadata

use of org.elasticsearch.cluster.metadata.RepositoryMetadata in project elasticsearch by elastic.

the class RepositoriesMetaDataSerializationTests method createTestInstance.

@Override
protected Custom createTestInstance() {
    int numberOfRepositories = randomInt(10);
    List<RepositoryMetaData> entries = new ArrayList<>();
    for (int i = 0; i < numberOfRepositories; i++) {
        entries.add(new RepositoryMetaData(randomAsciiOfLength(10), randomAsciiOfLength(10), randomSettings()));
    }
    entries.sort(Comparator.comparing(RepositoryMetaData::name));
    return new RepositoriesMetaData(entries.toArray(new RepositoryMetaData[entries.size()]));
}
Also used : RepositoriesMetaData(org.elasticsearch.cluster.metadata.RepositoriesMetaData) ArrayList(java.util.ArrayList) RepositoryMetaData(org.elasticsearch.cluster.metadata.RepositoryMetaData)

Example 34 with RepositoryMetadata

use of org.elasticsearch.cluster.metadata.RepositoryMetadata in project elasticsearch by elastic.

the class RepositoriesMetaDataSerializationTests method doParseInstance.

@Override
protected Custom doParseInstance(XContentParser parser) throws IOException {
    assertEquals(XContentParser.Token.START_OBJECT, parser.nextToken());
    RepositoriesMetaData repositoriesMetaData = RepositoriesMetaData.fromXContent(parser);
    assertEquals(XContentParser.Token.END_OBJECT, parser.currentToken());
    List<RepositoryMetaData> repos = repositoriesMetaData.repositories();
    repos.sort(Comparator.comparing(RepositoryMetaData::name));
    return new RepositoriesMetaData(repos.toArray(new RepositoryMetaData[repos.size()]));
}
Also used : RepositoriesMetaData(org.elasticsearch.cluster.metadata.RepositoriesMetaData) RepositoryMetaData(org.elasticsearch.cluster.metadata.RepositoryMetaData)

Example 35 with RepositoryMetadata

use of org.elasticsearch.cluster.metadata.RepositoryMetadata in project elasticsearch by elastic.

the class AzureBlobStoreContainerTests method newBlobStore.

@Override
protected BlobStore newBlobStore() throws IOException {
    try {
        RepositoryMetaData repositoryMetaData = new RepositoryMetaData("azure", "ittest", Settings.EMPTY);
        AzureStorageServiceMock client = new AzureStorageServiceMock();
        return new AzureBlobStore(repositoryMetaData, Settings.EMPTY, client);
    } catch (URISyntaxException | StorageException e) {
        throw new IOException(e);
    }
}
Also used : RepositoryMetaData(org.elasticsearch.cluster.metadata.RepositoryMetaData) AzureStorageServiceMock(org.elasticsearch.cloud.azure.storage.AzureStorageServiceMock) AzureBlobStore(org.elasticsearch.cloud.azure.blobstore.AzureBlobStore) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) StorageException(com.microsoft.azure.storage.StorageException)

Aggregations

RepositoryMetadata (org.elasticsearch.cluster.metadata.RepositoryMetadata)29 RepositoryMetaData (org.elasticsearch.cluster.metadata.RepositoryMetaData)24 ClusterState (org.elasticsearch.cluster.ClusterState)13 RepositoriesMetadata (org.elasticsearch.cluster.metadata.RepositoriesMetadata)13 ArrayList (java.util.ArrayList)11 Settings (org.elasticsearch.common.settings.Settings)11 RepositoriesMetaData (org.elasticsearch.cluster.metadata.RepositoriesMetaData)10 IOException (java.io.IOException)8 ClusterName (org.elasticsearch.cluster.ClusterName)8 Before (org.junit.Before)7 HashMap (java.util.HashMap)6 BlobStoreRepository (org.elasticsearch.repositories.blobstore.BlobStoreRepository)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 ParameterizedMessage (org.apache.logging.log4j.message.ParameterizedMessage)5 ActionListener (org.elasticsearch.action.ActionListener)5 BlobContainer (org.elasticsearch.common.blobstore.BlobContainer)5 RepositoryException (org.elasticsearch.repositories.RepositoryException)5 Test (org.junit.Test)5 List (java.util.List)4 Map (java.util.Map)4