• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CloudTableClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.microsoft.azure.storage.table.CloudTableClient的典型用法代码示例。如果您正苦于以下问题:Java CloudTableClient类的具体用法?Java CloudTableClient怎么用?Java CloudTableClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CloudTableClient类属于com.microsoft.azure.storage.table包,在下文中一共展示了CloudTableClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: connectToAzTable

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/***
 *
 * @param azStorageConnStr
 * @param tableName
 * @param l
   * @return
   */
public CloudTable connectToAzTable(String azStorageConnStr, String tableName) {
	CloudTable cloudTable = null;
	try {
		// Retrieve storage account from connection-string.
		CloudStorageAccount storageAccount = CloudStorageAccount.parse(azStorageConnStr);

		// Create the table client
		CloudTableClient tableClient = storageAccount.createCloudTableClient();

		// Create a cloud table object for the table.
		cloudTable = tableClient.getTableReference(tableName);
		
	} catch (Exception e) 
	{
		logger.warn("Exception in connectToAzTable: "+tableName, e);
	}
	return cloudTable;
}
 
开发者ID:dream-lab,项目名称:echo,代码行数:26,代码来源:InsertAzure.java


示例2: corsRules

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
 * Set CORS rules sample.
 * @param tableClient Azure Storage Table Service
 */
private void corsRules(CloudTableClient tableClient) throws StorageException {
    // Get service properties
    System.out.println("Get service properties");
    ServiceProperties originalProps = tableClient.downloadServiceProperties();

    try {
        // Setr CORS rules
        System.out.println("Set CORS rules");
        CorsRule ruleAllowAll = new CorsRule();
        ruleAllowAll.getAllowedOrigins().add("*");
        ruleAllowAll.getAllowedMethods().add(CorsHttpMethods.GET);
        ruleAllowAll.getAllowedHeaders().add("*");
        ruleAllowAll.getExposedHeaders().add("*");
        ServiceProperties props = new ServiceProperties();
        props.getCors().getCorsRules().add(ruleAllowAll);
        tableClient.uploadServiceProperties(props);
    }
    finally {
        // Revert back to original service properties
        tableClient.uploadServiceProperties(originalProps);
    }
}
 
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:27,代码来源:TableAdvanced.java


示例3: createTable

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
 * Creates and returns a table for the sample application to use.
 *
 * @param tableClient CloudTableClient object
 * @param tableName Name of the table to create
 * @return The newly created CloudTable object
 *
 * @throws StorageException
 * @throws RuntimeException
 * @throws IOException
 * @throws URISyntaxException
 * @throws IllegalArgumentException
 * @throws InvalidKeyException
 * @throws IllegalStateException
 */
private static CloudTable createTable(CloudTableClient tableClient, String tableName) throws StorageException, RuntimeException, IOException, InvalidKeyException, IllegalArgumentException, URISyntaxException, IllegalStateException {

    // Create a new table
    CloudTable table = tableClient.getTableReference(tableName);
    try {
        if (table.createIfNotExists() == false) {
            throw new IllegalStateException(String.format("Table with name \"%s\" already exists.", tableName));
        }
    }
    catch (StorageException s) {
        if (s.getCause() instanceof java.net.ConnectException) {
            System.out.println("Caught connection exception from the client. If running with the default configuration please make sure you have started the storage emulator.");
        }
        throw s;
    }

    return table;
}
 
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:34,代码来源:TableBasics.java


示例4: callUploadServiceProps

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
private void callUploadServiceProps(
        ServiceClient client, ServiceProperties props, FileServiceProperties fileProps)
        throws StorageException, InterruptedException {

    if (client.getClass().equals(CloudBlobClient.class)) {
        ((CloudBlobClient) client).uploadServiceProperties(props);
    }
    else if (client.getClass().equals(CloudTableClient.class)) {
        ((CloudTableClient) client).uploadServiceProperties(props);
    }
    else if (client.getClass().equals(CloudQueueClient.class)) {
        ((CloudQueueClient) client).uploadServiceProperties(props);
    }
    else if (client.getClass().equals(CloudFileClient.class)) {
        ((CloudFileClient) client).uploadServiceProperties(fileProps);
    }
    else {
        fail();
    }

    Thread.sleep(30000);
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:23,代码来源:ServicePropertiesTests.java


示例5: callDownloadServiceProperties

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
private ServiceProperties callDownloadServiceProperties(ServiceClient client) throws StorageException {
    if (client.getClass().equals(CloudBlobClient.class)) {
        CloudBlobClient blobClient = (CloudBlobClient) client;
        return blobClient.downloadServiceProperties();
    }
    else if (client.getClass().equals(CloudTableClient.class)) {
        CloudTableClient tableClient = (CloudTableClient) client;
        return tableClient.downloadServiceProperties();
    }
    else if (client.getClass().equals(CloudQueueClient.class)) {
        CloudQueueClient queueClient = (CloudQueueClient) client;
        return queueClient.downloadServiceProperties();
    }
    else {
        fail();
    }
    return null;
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:19,代码来源:ServicePropertiesTests.java


示例6: testTableDownloadPermissions

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
private static void testTableDownloadPermissions(LocationMode optionsLocationMode, LocationMode clientLocationMode,
        StorageLocation initialLocation, List<RetryContext> retryContextList, List<RetryInfo> retryInfoList)
        throws URISyntaxException, StorageException {
    CloudTableClient client = TestHelper.createCloudTableClient();
    CloudTable table = client.getTableReference(TableTestHelper.generateRandomTableName());

    MultiLocationTestHelper helper = new MultiLocationTestHelper(table.getServiceClient().getStorageUri(),
            initialLocation, retryContextList, retryInfoList);

    table.getServiceClient().getDefaultRequestOptions().setLocationMode(clientLocationMode);
    TableRequestOptions options = new TableRequestOptions();

    options.setLocationMode(optionsLocationMode);
    options.setRetryPolicyFactory(helper.retryPolicy);

    try {
        table.downloadPermissions(options, helper.operationContext);
    }
    catch (StorageException ex) {
        assertEquals(HttpURLConnection.HTTP_NOT_FOUND, ex.getHttpStatusCode());
    }
    finally {
        helper.close();
    }
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:26,代码来源:SecondaryTests.java


示例7: testCloudStorageAccountClientUriVerify

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
@Test
public void testCloudStorageAccountClientUriVerify() throws URISyntaxException, StorageException {
    StorageCredentialsAccountAndKey cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, ACCOUNT_KEY);
    CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(cred, true);

    CloudBlobClient blobClient = cloudStorageAccount.createCloudBlobClient();
    CloudBlobContainer container = blobClient.getContainerReference("container1");
    assertEquals(cloudStorageAccount.getBlobEndpoint().toString() + "/container1", container.getUri().toString());

    CloudQueueClient queueClient = cloudStorageAccount.createCloudQueueClient();
    CloudQueue queue = queueClient.getQueueReference("queue1");
    assertEquals(cloudStorageAccount.getQueueEndpoint().toString() + "/queue1", queue.getUri().toString());

    CloudTableClient tableClient = cloudStorageAccount.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("table1");
    assertEquals(cloudStorageAccount.getTableEndpoint().toString() + "/table1", table.getUri().toString());

    CloudFileClient fileClient = cloudStorageAccount.createCloudFileClient();
    CloudFileShare share = fileClient.getShareReference("share1");
    assertEquals(cloudStorageAccount.getFileEndpoint().toString() + "/share1", share.getUri().toString());
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:22,代码来源:StorageAccountTests.java


示例8: createCloudTableClient

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
 * Creates a new Table service client.
 * 
 * @return A client object that uses the Table service endpoint.
 */
public CloudTableClient createCloudTableClient() {
    if (this.getTableStorageUri() == null) {
        throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED);
    }

    if (this.credentials == null) {
        throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
    }

    if (!StorageCredentialsHelper.canCredentialsGenerateClient(this.credentials)) {
        
        throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST);
    }
    
    return new CloudTableClient(this.getTableStorageUri(), this.getCredentials());
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:22,代码来源:CloudStorageAccount.java


示例9: create

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
public TableClient create() {
    try {
        final CloudStorageAccount storageAccount =
                new CloudStorageAccount(azureTableConfiguration.getStorageCredentialsAccountAndKey(), true);
        final CloudTableClient cloudTableClient = storageAccount.createCloudTableClient();
        final TableRequestOptions defaultOptions = new TableRequestOptions();
        defaultOptions.setRetryPolicyFactory(new RetryLinearRetry(
                Ints.checkedCast(azureTableConfiguration.getRetryInterval().toMilliseconds()),
                azureTableConfiguration.getRetryAttempts()));
        defaultOptions.setTimeoutIntervalInMs(Ints.checkedCast(azureTableConfiguration.getTimeout().toMilliseconds()));
        cloudTableClient.setDefaultRequestOptions(defaultOptions);
        return new TableClient(cloudTableClient);
    } catch (URISyntaxException err) {
        LOGGER.error("Failed to create a TableClient", err);
        throw new IllegalArgumentException(err);
    }
}
 
开发者ID:yammer,项目名称:breakerbox,代码行数:18,代码来源:TableClientFactory.java


示例10: getLogDataTable

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
 * For the Azure Log Store, the underlying table to use
 *
 * @param storageConnectionString
 *
 * @return
 *
 * @throws URISyntaxException
 * @throws StorageException
 * @throws InvalidKeyException
 */
@Provides
@Named("logdata")
public CloudTable getLogDataTable(@Named("azure.storage-connection-string") String storageConnectionString,
                                  @Named("azure.logging-table")
		                                  String logTableName) throws URISyntaxException, StorageException, InvalidKeyException
{
	// Retrieve storage account from connection-string.
	CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);

	// Create the table client.
	CloudTableClient tableClient = storageAccount.createCloudTableClient();

	// Create the table if it doesn't exist.
	CloudTable table = tableClient.getTableReference(logTableName);
	table.createIfNotExists();

	return table;
}
 
开发者ID:petergeneric,项目名称:stdlib,代码行数:30,代码来源:ServiceManagerGuiceModule.java


示例11: callUploadServiceProps

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
private void callUploadServiceProps(
        ServiceClient client, ServiceProperties props, FileServiceProperties fileProps)
        throws StorageException, InterruptedException {

    if (client.getClass().equals(CloudBlobClient.class)) {
        ((CloudBlobClient) client).uploadServiceProperties(props);
    }
    else if (client.getClass().equals(CloudTableClient.class)) {
        ((CloudTableClient) client).uploadServiceProperties(props);
    }
    else if (client.getClass().equals(CloudQueueClient.class)) {
        ((CloudQueueClient) client).uploadServiceProperties(props);
    }
    else if (client.getClass().equals(CloudFileClient.class)) {
        ((CloudFileClient) client).uploadServiceProperties(fileProps);
    }
    else {
        fail();
    }
    
    // It may take up to 30 seconds for the settings to take effect, but the new properties are immediately
    // visible when querying service properties.
}
 
开发者ID:Azure,项目名称:azure-storage-java,代码行数:24,代码来源:ServicePropertiesTests.java


示例12: runSamples

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
     * Executes the samples.
     *
     * @throws URISyntaxException Uri has invalid syntax
     * @throws InvalidKeyException Invalid key
     */
    void runSamples() throws InvalidKeyException, URISyntaxException, IOException {
        System.out.println();
        System.out.println();
        if (TableClientProvider.isAzureCosmosdbTable()) {
            return;
        }

        PrintHelper.printSampleStartInfo("Table Advanced");
        // Create a table service client
        CloudTableClient tableClient = TableClientProvider.getTableClientReference();

        try {
            System.out.println("Service properties sample");
            serviceProperties(tableClient);
            System.out.println();

            System.out.println("CORS rules sample");
            corsRules(tableClient);
            System.out.println();

            System.out.println("Table Acl sample");
            tableAcl(tableClient);
            System.out.println();

            // This will fail unless the account is RA-GRS enabled.
//            System.out.println("Service stats sample");
//            serviceStats(tableClient);
//            System.out.println();
        } catch (Throwable t) {
            PrintHelper.printException(t);
        }

        PrintHelper.printSampleCompleteInfo("Table Advanced");
    }
 
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:41,代码来源:TableAdvanced.java


示例13: serviceStats

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
 * Retrieve statistics related to replication for the Table service.
 * This operation is only available on the secondary location endpoint
 * when read-access geo-redundant replication is enabled for the storage account.
 * @param tableClient Azure Storage Table Service
 */
private void serviceStats(CloudTableClient tableClient) throws StorageException {
    // Get service stats
    System.out.println("Service Stats:");
    ServiceStats stats = tableClient.getServiceStats();
    System.out.printf("- status: %s%n", stats.getGeoReplication().getStatus());
    System.out.printf("- last sync time: %s%n", stats.getGeoReplication().getLastSyncTime());
}
 
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:14,代码来源:TableAdvanced.java


示例14: createCloudTableClient

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
/**
 * Creates a new Table service client.
 * 
 * @return A client object that uses the Table service endpoint.
 */
public CloudTableClient createCloudTableClient() {
    if (this.getTableStorageUri() == null) {
        throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED);
    }

    if (this.credentials == null) {
        throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
    }

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.credentials)) {
        throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST);
    }
    return new CloudTableClient(this.getTableStorageUri(), this.getCredentials());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:20,代码来源:CloudStorageAccount.java


示例15: testUserAgentString

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
@Test
public void testUserAgentString() throws URISyntaxException, StorageException {
    // Test with a blob request
    CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
    CloudBlobContainer container = blobClient.getContainerReference("container1");
    OperationContext sendingRequestEventContext = new OperationContext();
    sendingRequestEventContext.getSendingRequestEventHandler().addListener(new StorageEvent<SendingRequestEvent>() {

        @Override
        public void eventOccurred(SendingRequestEvent eventArg) {
            assertEquals(
                    Constants.HeaderConstants.USER_AGENT_PREFIX
                            + "/"
                            + Constants.HeaderConstants.USER_AGENT_VERSION
                            + " "
                            + String.format(Utility.LOCALE_US, "(Android %s; %s; %s)",
                            android.os.Build.VERSION.RELEASE, android.os.Build.BRAND,
                            android.os.Build.MODEL), ((HttpURLConnection) eventArg.getConnectionObject())
                            .getRequestProperty(Constants.HeaderConstants.USER_AGENT));
        }
    });
    container.exists(null, null, sendingRequestEventContext);

    // Test with a queue request
    CloudQueueClient queueClient = TestHelper.createCloudQueueClient();
    CloudQueue queue = queueClient.getQueueReference("queue1");
    queue.exists(null, sendingRequestEventContext);

    // Test with a table request
    CloudTableClient tableClient = TestHelper.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("table1");
    table.exists(null, sendingRequestEventContext);
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:34,代码来源:GenericTests.java


示例16: testTableMaximumExecutionTime

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
@Test
@Category({ DevFabricTests.class, DevStoreTests.class, SecondaryTests.class })
public void testTableMaximumExecutionTime() throws URISyntaxException, StorageException {
    OperationContext opContext = new OperationContext();
    setDelay(opContext, 2500);
    
    opContext.getResponseReceivedEventHandler().addListener(new StorageEvent<ResponseReceivedEvent>() {

        @Override
        public void eventOccurred(ResponseReceivedEvent eventArg) {
            // Set status code to 500 to force a retry
            eventArg.getRequestResult().setStatusCode(500);
        }
    });

    // set the maximum execution time
    TableRequestOptions options = new TableRequestOptions();
    options.setMaximumExecutionTimeInMs(2000);
    options.setTimeoutIntervalInMs(1000);

    CloudTableClient tableClient = TestHelper.createCloudTableClient();
    CloudTable table = tableClient.getTableReference(generateRandomName("share"));

    try {
        // 1. insert entity will fail as the table does not exist
        // 2. the executor will attempt to retry as we set the status code to 500
        // 3. maximum execution time should prevent the retry from being made
        DynamicTableEntity ent = new DynamicTableEntity("partition", "row");
        TableOperation insert = TableOperation.insert(ent);
        table.execute(insert, options, opContext);
        fail("Maximum execution time was reached but request did not fail.");
    }
    catch (StorageException e) {
        assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getMessage());
    }
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:37,代码来源:MaximumExecutionTimeTests.java


示例17: createCloudTableClient

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
public static CloudTableClient createCloudTableClient(SharedAccessAccountPolicy policy, boolean useHttps)
        throws StorageException, InvalidKeyException, URISyntaxException {

    CloudStorageAccount sasAccount = getAccount();
    final String token = sasAccount.generateSharedAccessSignature(policy);
    final StorageCredentials creds =
            new StorageCredentialsSharedAccessSignature(token);

    final URI tableUri = new URI(useHttps ? "https" : "http", sasAccount.getTableEndpoint().getAuthority(), 
    		sasAccount.getTableEndpoint().getPath(), sasAccount.getTableEndpoint().getQuery(), null);
    
    sasAccount = new CloudStorageAccount(creds, sasAccount.getBlobEndpoint(), sasAccount.getQueueEndpoint(), 
    		tableUri, sasAccount.getFileEndpoint());
    return sasAccount.createCloudTableClient();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:16,代码来源:TestHelper.java


示例18: testCloudStorageAccountClientMethods

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
@Test
public void testCloudStorageAccountClientMethods() throws URISyntaxException {
    StorageCredentialsAccountAndKey cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, ACCOUNT_KEY);

    CloudStorageAccount account = new CloudStorageAccount(cred, false);
    CloudBlobClient blob = account.createCloudBlobClient();
    CloudQueueClient queue = account.createCloudQueueClient();
    CloudTableClient table = account.createCloudTableClient();
    CloudFileClient file = account.createCloudFileClient();

    // check endpoints
    assertEquals("Blob endpoint doesn't match account", account.getBlobEndpoint(), blob.getEndpoint());
    assertEquals("Queue endpoint doesn't match account", account.getQueueEndpoint(), queue.getEndpoint());
    assertEquals("Table endpoint doesn't match account", account.getTableEndpoint(), table.getEndpoint());
    assertEquals("File endpoint doesn't match account", account.getFileEndpoint(), file.getEndpoint());

    // check storage uris
    assertEquals("Blob endpoint doesn't match account", account.getBlobStorageUri(), blob.getStorageUri());
    assertEquals("Queue endpoint doesn't match account", account.getQueueStorageUri(), queue.getStorageUri());
    assertEquals("Table endpoint doesn't match account", account.getTableStorageUri(), table.getStorageUri());
    assertEquals("File endpoint doesn't match account", account.getFileStorageUri(), file.getStorageUri());

    // check creds
    assertEquals("Blob creds don't match account", account.getCredentials(), blob.getCredentials());
    assertEquals("Queue creds don't match account", account.getCredentials(), queue.getCredentials());
    assertEquals("Table creds don't match account", account.getCredentials(), table.getCredentials());
    assertEquals("File creds don't match account", account.getCredentials(), file.getCredentials());
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:29,代码来源:StorageAccountTests.java


示例19: testCloudStorageAccountEndpointSuffix

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
@Test
public void testCloudStorageAccountEndpointSuffix()
        throws InvalidKeyException, URISyntaxException, StorageException {
    final String mooncake = "core.chinacloudapi.cn";
    final String fairfax = "core.usgovcloudapi.net";

    // Endpoint suffix for mooncake
    CloudStorageAccount accountParse = CloudStorageAccount.parse(
            "DefaultEndpointsProtocol=http;AccountName=test;"
            + "AccountKey=abc=;EndpointSuffix=" + mooncake);
    CloudStorageAccount accountConstruct = new CloudStorageAccount(accountParse.getCredentials(),
            false, accountParse.getEndpointSuffix());
    assertNotNull(accountParse);
    assertNotNull(accountConstruct);
    assertNotNull(accountParse.getBlobEndpoint());
    assertEquals(accountParse.getBlobEndpoint(), accountConstruct.getBlobEndpoint());
    assertTrue(accountParse.getBlobEndpoint().toString().endsWith(mooncake));

    // Endpoint suffix for fairfax
    accountParse = CloudStorageAccount.parse(
            "TableEndpoint=http://tables/;DefaultEndpointsProtocol=http;"
            + "AccountName=test;AccountKey=abc=;EndpointSuffix=" + fairfax);
    accountConstruct = new CloudStorageAccount(accountParse.getCredentials(),
            false, accountParse.getEndpointSuffix());
    assertNotNull(accountParse);
    assertNotNull(accountConstruct);
    assertNotNull(accountParse.getBlobEndpoint());
    assertEquals(accountParse.getBlobEndpoint(), accountConstruct.getBlobEndpoint());
    assertTrue(accountParse.getBlobEndpoint().toString().endsWith(fairfax));

    // Explicit table endpoint should override endpoint suffix for fairfax
    CloudTableClient tableClientParse = accountParse.createCloudTableClient();
    assertNotNull(tableClientParse);
    assertEquals(accountParse.getTableEndpoint(), tableClientParse.getEndpoint());
    assertTrue(tableClientParse.getEndpoint().toString().endsWith("tables/"));
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:37,代码来源:StorageAccountTests.java


示例20: testUserAgentString

import com.microsoft.azure.storage.table.CloudTableClient; //导入依赖的package包/类
@Test
public void testUserAgentString() throws URISyntaxException, StorageException {
    // Test with a blob request
    CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
    CloudBlobContainer container = blobClient.getContainerReference("container1");
    OperationContext sendingRequestEventContext = new OperationContext();
    sendingRequestEventContext.getSendingRequestEventHandler().addListener(new StorageEvent<SendingRequestEvent>() {

        @Override
        public void eventOccurred(SendingRequestEvent eventArg) {
            assertEquals(
                    Constants.HeaderConstants.USER_AGENT_PREFIX
                            + "/"
                            + Constants.HeaderConstants.USER_AGENT_VERSION
                            + " "
                            + String.format(Utility.LOCALE_US, "(JavaJRE %s; %s %s)",
                                    System.getProperty("java.version"),
                                    System.getProperty("os.name").replaceAll(" ", ""),
                                    System.getProperty("os.version")), ((HttpURLConnection) eventArg
                            .getConnectionObject()).getRequestProperty(Constants.HeaderConstants.USER_AGENT));
        }
    });
    container.exists(null, null, sendingRequestEventContext);

    // Test with a queue request
    CloudQueueClient queueClient = TestHelper.createCloudQueueClient();
    CloudQueue queue = queueClient.getQueueReference("queue1");
    queue.exists(null, sendingRequestEventContext);

    // Test with a table request
    CloudTableClient tableClient = TestHelper.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("table1");
    table.exists(null, sendingRequestEventContext);
}
 
开发者ID:Azure,项目名称:azure-storage-java,代码行数:35,代码来源:GenericTests.java



注:本文中的com.microsoft.azure.storage.table.CloudTableClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BasicSAMLMessageContext类代码示例发布时间:2022-05-22
下一篇:
Java MapItemRenderer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap