From 23d9d901d33593fa3ab7f51e599ac1f2cd60de11 Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Fri, 10 May 2013 14:07:00 -0700 Subject: [PATCH] JCLOUDS-25. Remove oprhaned sandbox-* from repo --- sandbox-apis/libvirt/README.txt | 92 --- sandbox-apis/libvirt/TODO | 1 - sandbox-apis/libvirt/pom.xml | 147 ---- .../main/java/org/jclouds/libvirt/Image.java | 55 -- .../org/jclouds/libvirt/LibvirtConstants.java | 32 - .../compute/LibvirtComputeService.java | 121 ---- .../LibvirtComputeServiceContextBuilder.java | 49 -- .../LibvirtComputeServiceContextSpec.java | 42 -- .../compute/LibvirtPropertiesBuilder.java | 72 -- .../LibvirtComputeServiceContextModule.java | 180 ----- .../compute/functions/DomainToHardware.java | 98 --- .../functions/DomainToNodeMetadata.java | 138 ---- .../functions/LibvirtImageToImage.java | 61 -- .../LibvirtComputeServiceAdapter.java | 282 -------- ...bvirtComputeServiceContextBuilderTest.java | 76 -- .../LibvirtComputeServiceLiveTest.java | 73 -- .../compute/LibvirtExperimentLiveTest.java | 95 --- .../libvirt/src/test/resources/log4j.xml | 117 ---- sandbox-apis/nirvanix/README.txt | 25 - sandbox-apis/nirvanix/pom.xml | 126 ---- .../jclouds/nirvanix/sdn/SDNAsyncClient.java | 112 --- .../nirvanix/sdn/SDNAuthAsyncClient.java | 53 -- .../org/jclouds/nirvanix/sdn/SDNClient.java | 67 -- .../nirvanix/sdn/SDNContextBuilder.java | 46 -- .../nirvanix/sdn/SDNPropertiesBuilder.java | 45 -- .../jclouds/nirvanix/sdn/SessionToken.java | 39 -- .../binders/BindMetadataToQueryParams.java | 58 -- .../sdn/config/SDNAuthRestClientModule.java | 97 --- .../sdn/config/SDNRestClientModule.java | 50 -- .../nirvanix/sdn/domain/UploadInfo.java | 40 -- .../sdn/filters/AddSessionTokenToRequest.java | 95 --- .../filters/InsertUserContextIntoPath.java | 71 -- .../ParseMetadataFromJsonResponse.java | 67 -- .../ParseSessionTokenFromJsonResponse.java | 58 -- .../ParseUploadInfoFromJsonResponse.java | 65 -- .../nirvanix/sdn/reference/SDNConstants.java | 30 - .../sdn/reference/SDNQueryParams.java | 38 - .../nirvanix/sdn/SDNAsyncClientTest.java | 188 ----- .../nirvanix/sdn/SDNAuthAsyncClientTest.java | 75 -- .../sdn/SDNAuthenticationLiveTest.java | 84 --- .../nirvanix/sdn/SDNClientLiveTest.java | 101 --- .../BindMetadataToQueryParamsTest.java | 79 --- .../filters/AddSessionTokenToRequestTest.java | 132 ---- .../InsertUserContextIntoPathTest.java | 130 ---- .../ParseMetadataFromJsonResponseTest.java | 53 -- ...ParseSessionTokenFromJsonResponseTest.java | 52 -- .../ParseUploadInfoFromJsonResponseTest.java | 55 -- .../src/test/resources/authtoken.json | 1 - .../nirvanix/src/test/resources/log4j.xml | 90 --- .../nirvanix/src/test/resources/login.json | 1 - .../nirvanix/src/test/resources/metadata.json | 1 - sandbox-apis/pcs/README.txt | 25 - sandbox-apis/pcs/pom.xml | 126 ---- .../org/jclouds/mezeo/pcs/PCSAsyncClient.java | 179 ----- .../java/org/jclouds/mezeo/pcs/PCSClient.java | 70 -- .../mezeo/pcs/PCSCloudAsyncClient.java | 76 -- .../jclouds/mezeo/pcs/PCSContextBuilder.java | 42 -- .../mezeo/pcs/PCSPropertiesBuilder.java | 44 -- .../BindContainerNameToXmlPayload.java | 39 -- .../pcs/binders/BindFileInfoToXmlPayload.java | 50 -- .../binders/BindPCSFileToMultipartForm.java | 52 -- .../blobstore/functions/BlobToFileInfo.java | 46 -- .../blobstore/functions/BlobToPCSFile.java | 49 -- .../functions/FileInfoToBlobMetadata.java | 57 -- .../blobstore/functions/PCSFileToBlob.java | 50 -- .../mezeo/pcs/config/PCSObjectModule.java | 64 -- .../mezeo/pcs/config/PCSRestClientModule.java | 139 ---- .../mezeo/pcs/domain/ContainerInfo.java | 37 - .../mezeo/pcs/domain/ContainerList.java | 37 - .../jclouds/mezeo/pcs/domain/FileInfo.java | 44 -- .../pcs/domain/FileInfoWithMetadata.java | 36 - .../mezeo/pcs/domain/MutableFileInfo.java | 44 -- .../mezeo/pcs/domain/MutableResourceInfo.java | 64 -- .../org/jclouds/mezeo/pcs/domain/PCSFile.java | 44 -- .../mezeo/pcs/domain/ResourceInfo.java | 64 -- .../domain/internal/ContainerInfoImpl.java | 72 -- .../domain/internal/ContainerListImpl.java | 115 --- .../pcs/domain/internal/FileInfoImpl.java | 120 ---- .../internal/FileInfoWithMetadataImpl.java | 72 -- .../domain/internal/MutableFileInfoImpl.java | 135 ---- .../internal/MutableResourceInfoImpl.java | 271 -------- .../pcs/domain/internal/PCSFileImpl.java | 78 --- .../pcs/domain/internal/ResourceInfoImpl.java | 224 ------ .../jclouds/mezeo/pcs/endpoints/Contacts.java | 39 -- .../mezeo/pcs/endpoints/Metacontainers.java | 40 -- .../jclouds/mezeo/pcs/endpoints/Projects.java | 39 -- .../mezeo/pcs/endpoints/Recyclebin.java | 39 -- .../mezeo/pcs/endpoints/RootContainer.java | 39 -- .../jclouds/mezeo/pcs/endpoints/Shares.java | 39 -- .../org/jclouds/mezeo/pcs/endpoints/Tags.java | 39 -- .../jclouds/mezeo/pcs/endpoints/WebDAV.java | 39 -- .../pcs/functions/AddMetadataItemIntoMap.java | 74 -- .../ReturnFalseIfContainerNotFound.java | 43 -- .../ReturnTrueIfContainerAlreadyExists.java | 45 -- .../handlers/PCSClientErrorRetryHandler.java | 54 -- .../mezeo/pcs/options/PutBlockOptions.java | 85 --- .../mezeo/pcs/xml/CloudXlinkHandler.java | 120 ---- .../mezeo/pcs/xml/ContainerHandler.java | 277 -------- .../jclouds/mezeo/pcs/xml/FileHandler.java | 182 ----- .../jclouds/mezeo/pcs/PCSAsyncClientTest.java | 298 -------- .../jclouds/mezeo/pcs/PCSClientLiveTest.java | 279 -------- .../mezeo/pcs/PCSCloudAsyncClientTest.java | 86 --- .../BindContainerNameToXmlPayloadTest.java | 48 -- .../binders/BindFileInfoToXmlPayloadTest.java | 76 -- .../functions/AddMetadataAndReturnIdTest.java | 132 ---- .../AssembleBlobFromBlobMetadataCallTest.java | 48 -- .../pcs/internal/StubPCSAsyncClient.java | 96 --- .../pcs/options/PutBlockOptionsTest.java | 88 --- .../mezeo/pcs/xml/CloudXlinkHanderTest.java | 65 -- .../mezeo/pcs/xml/ContainerHandlerTest.java | 164 ----- .../pcs/xml/FileMetadataHandlerTest.java | 96 --- .../pcs/src/test/resources/discovery.xml | 11 - sandbox-apis/pcs/src/test/resources/log4j.xml | 90 --- .../src/test/resources/test_file_metadata.xml | 22 - .../test/resources/test_root_container.xml | 117 ---- sandbox-apis/scality-rs2/README.txt | 27 - sandbox-apis/scality-rs2/pom.xml | 125 ---- .../scality/rs2/ScalityRS2AsyncClient.java | 39 -- .../scality/rs2/ScalityRS2ContextBuilder.java | 50 -- .../rs2/ScalityRS2PropertiesBuilder.java | 44 -- .../ScalityRS2BlobStoreContextModule.java | 29 - .../config/ScalityRS2RestClientModule.java | 50 -- .../ScalityRS2AsyncClientTestDisabled.java | 47 -- .../scality/rs2/ScalityRS2ClientLiveTest.java | 46 -- .../ScalityRS2BlobIntegrationLiveTest.java | 55 -- .../rs2/blobstore/ScalityRS2BlobLiveTest.java | 37 - .../ScalityRS2BlobMapIntegrationLiveTest.java | 30 - .../ScalityRS2BlobSignerLiveTest.java | 31 - ...calityRS2ContainerIntegrationLiveTest.java | 39 -- .../ScalityRS2ContainerLiveTest.java | 30 - ...yRS2InputStreamMapIntegrationLiveTest.java | 30 - .../ScalityRS2ServiceIntegrationLiveTest.java | 30 - .../blobstore/ScalityRS2TestInitializer.java | 35 - sandbox-apis/simpledb/pom.xml | 101 --- .../jclouds/simpledb/SimpleDBAsyncClient.java | 113 --- .../org/jclouds/simpledb/SimpleDBClient.java | 110 --- .../simpledb/SimpleDBContextBuilder.java | 56 -- .../simpledb/SimpleDBPropertiesBuilder.java | 55 -- .../BindAttributesToIndexedFormParams.java | 76 -- .../config/SimpleDBRestClientModule.java | 41 -- .../simpledb/domain/AttributePair.java | 78 --- .../simpledb/domain/DomainMetadata.java | 190 ----- .../org/jclouds/simpledb/domain/Item.java | 63 -- .../simpledb/domain/ListDomainsResponse.java | 37 - .../simpledb/options/ListDomainsOptions.java | 101 --- .../org/jclouds/simpledb/package-info.java | 25 - .../reference/SimpleDBParameters.java | 74 -- .../simpledb/reference/package-info.java | 23 - .../jclouds/simpledb/xml/ItemsHandler.java | 109 --- .../xml/ListDomainsResponseHandler.java | 82 --- .../simpledb/SimpleDBAsyncClientTest.java | 139 ---- .../simpledb/SimpleDBClientLiveTest.java | 172 ----- .../options/ListDomainsOptionsTest.java | 87 --- .../xml/ListDomainsResponseHandlerTest.java | 51 -- .../src/test/resources/list_domains.xml | 11 - .../simpledb/src/test/resources/log4j.xml | 89 --- sandbox-drivers/asynchttpclient/pom.xml | 76 -- .../ning/NingHttpCommandExecutorService.java | 199 ------ .../NingHttpCommandExecutorServiceModule.java | 67 -- .../NingHttpCommandExecutorServiceTest.java | 59 -- .../src/test/resources/test.jks | Bin 1365 -> 0 bytes sandbox-providers/aws-simpledb/pom.xml | 114 --- .../AWSSimpleDBPropertiesBuilder.java | 74 -- .../simpledb/AWSSimpleDBProviderMetadata.java | 115 --- .../org.jclouds.providers.ProviderMetadata | 1 - .../simpledb/AWSSimpleDBAsyncClientTest.java | 61 -- .../simpledb/AWSSimpleDBClientLiveTest.java | 50 -- .../aws/simpledb/AWSSimpleDBProviderTest.java | 36 - sandbox-providers/azurequeue/pom.xml | 106 --- .../azurequeue/AzureQueueAsyncClient.java | 123 ---- .../jclouds/azurequeue/AzureQueueClient.java | 142 ---- .../AzureQueueProviderMetadata.java | 116 --- .../binders/BindToXmlStringPayload.java | 38 - .../azurequeue/domain/QueueMessage.java | 162 ----- .../azurequeue/domain/QueueMetadata.java | 84 --- .../azurequeue/options/GetOptions.java | 85 --- .../azurequeue/options/PutMessageOptions.java | 63 -- .../AccountNameEnumerationResultsHandler.java | 90 --- .../xml/QueueMessagesListHandler.java | 104 --- .../org.jclouds.providers.ProviderMetadata | 1 - .../azurequeue/AzureQueueAsyncClientTest.java | 240 ------- .../azurequeue/AzureQueueClientLiveTest.java | 162 ----- .../azurequeue/AzureQueueProviderTest.java | 35 - .../azurequeue/options/GetOptionsTest.java | 75 -- ...ountNameEnumerationResultsHandlerTest.java | 67 -- .../xml/QueueMessagesListHandlerTest.java | 69 -- .../azurequeue/src/test/resources/log4j.xml | 88 --- .../src/test/resources/test_get_messages.xml | 21 - .../src/test/resources/test_list_queues.xml | 20 - .../resources/test_list_queues_options.xml | 17 - sandbox-providers/boxdotnet/pom.xml | 117 ---- .../boxdotnet/BoxDotNetAsyncClient.java | 70 -- .../jclouds/boxdotnet/BoxDotNetClient.java | 50 -- .../boxdotnet/BoxDotNetContextBuilder.java | 44 -- .../boxdotnet/BoxDotNetPropertiesBuilder.java | 44 -- .../config/BoxDotNetRestClientModule.java | 60 -- .../handlers/BoxDotNetErrorHandler.java | 89 --- .../boxdotnet/BoxDotNetAsyncClientTest.java | 128 ---- .../boxdotnet/BoxDotNetClientLiveTest.java | 83 --- .../boxdotnet/src/test/resources/log4j.xml | 90 --- sandbox-providers/dunkel-vcd/pom.xml | 126 ---- .../DunkelVCloudDirectorContextBuilder.java | 45 -- ...DunkelVCloudDirectorPropertiesBuilder.java | 40 -- .../DunkelVCloudDirectorProviderMetadata.java | 109 --- ...udDirectorComputeServiceContextModule.java | 38 - .../DunkelVCloudDirectorRestClientModule.java | 29 - .../org.jclouds.providers.ProviderMetadata | 1 - .../vcd/DunkelVCloudDirectorProviderTest.java | 33 - ...lVCloudDirectorComputeServiceLiveTest.java | 33 - ...VCloudDirectorTemplateBuilderLiveTest.java | 63 -- .../dunkel-vcd/src/test/resources/log4j.xml | 151 ---- sandbox-providers/googlestorage/README.txt | 27 - sandbox-providers/googlestorage/pom.xml | 124 ---- .../GoogleStorageAsyncClient.java | 68 -- .../GoogleStorageContextBuilder.java | 44 -- .../GoogleStoragePropertiesBuilder.java | 50 -- .../GoogleStorageProviderMetadata.java | 108 --- ...dGoogleStorageObjectMetadataToRequest.java | 70 -- .../config/GoogleStorageRestClientModule.java | 58 -- .../org.jclouds.providers.ProviderMetadata | 1 - .../GoogleStorageAsyncClientTestDisabled.java | 46 -- .../GoogleStorageClientLiveTest.java | 32 - .../GoogleStorageProviderTest.java | 37 - ...gleStorageObjectMetadataToRequestTest.java | 145 ---- .../GoogleStorageBlobIntegrationLiveTest.java | 45 -- .../blobstore/GoogleStorageBlobLiveTest.java | 30 - ...ogleStorageBlobMapIntegrationLiveTest.java | 30 - .../GoogleStorageBlobSignerLiveTest.java | 31 - ...leStorageContainerIntegrationLiveTest.java | 30 - .../GoogleStorageContainerLiveTest.java | 30 - ...rageInputStreamMapIntegrationLiveTest.java | 30 - ...ogleStorageServiceIntegrationLiveTest.java | 38 - .../GoogleStorageTestInitializer.java | 33 - sandbox-providers/hosteurope-storage/pom.xml | 132 ---- .../HostEuropeStoragePropertiesBuilder.java | 46 -- .../HostEuropeStorageClientLiveTest.java | 32 - ...tEuropeStorageBlobIntegrationLiveTest.java | 32 - .../HostEuropeStorageBlobLiveTest.java | 30 - ...ropeStorageBlobMapIntegrationLiveTest.java | 30 - .../HostEuropeStorageBlobSignerLiveTest.java | 31 - ...peStorageContainerIntegrationLiveTest.java | 30 - .../HostEuropeStorageContainerLiveTest.java | 30 - ...rageInputStreamMapIntegrationLiveTest.java | 30 - ...ropeStorageServiceIntegrationLiveTest.java | 37 - .../HostEuropeStorageTestInitializer.java | 35 - sandbox-providers/ibm-smartcloud/pom.xml | 133 ---- .../smartcloud/IBMSmartCloudAsyncClient.java | 358 ---------- .../ibm/smartcloud/IBMSmartCloudClient.java | 468 ------------- .../IBMSmartCloudContextBuilder.java | 49 -- .../IBMSmartCloudPropertiesBuilder.java | 62 -- ...martCloudBindComputeStrategiesByClass.java | 75 -- ...SmartCloudBindComputeSuppliersByClass.java | 50 -- ...SmartCloudComputeServiceContextModule.java | 50 -- ...CloudComputeServiceDependenciesModule.java | 114 --- .../functions/InstanceToNodeMetadata.java | 112 --- .../options/IBMSmartCloudTemplateOptions.java | 366 ---------- ...sWithGroupEncodedIntoNameThenAddToSet.java | 114 --- ...oudCreateNodeWithGroupEncodedIntoName.java | 62 -- .../IBMSmartCloudDestroyNodeStrategy.java | 74 -- .../IBMSmartCloudGetNodeMetadataStrategy.java | 53 -- .../IBMSmartCloudLifeCycleStrategy.java | 63 -- .../IBMSmartCloudListNodesStrategy.java | 59 -- .../IBMSmartCloudHardwareSupplier.java | 87 --- .../suppliers/IBMSmartCloudImageSupplier.java | 100 --- .../IBMSmartCloudLocationSupplier.java | 80 --- .../config/IBMSmartCloudParserModule.java | 66 -- .../config/IBMSmartCloudRestClientModule.java | 61 -- .../ibm/smartcloud/domain/Address.java | 149 ---- .../org/jclouds/ibm/smartcloud/domain/IP.java | 127 ---- .../jclouds/ibm/smartcloud/domain/Image.java | 221 ------ .../ibm/smartcloud/domain/Instance.java | 449 ------------ .../ibm/smartcloud/domain/InstanceType.java | 103 --- .../jclouds/ibm/smartcloud/domain/Key.java | 151 ---- .../ibm/smartcloud/domain/Location.java | 174 ----- .../ibm/smartcloud/domain/Offering.java | 93 --- .../jclouds/ibm/smartcloud/domain/Price.java | 132 ---- .../smartcloud/domain/StorageOffering.java | 125 ---- .../jclouds/ibm/smartcloud/domain/Vlan.java | 125 ---- .../jclouds/ibm/smartcloud/domain/Volume.java | 250 ------- .../functions/ParseLongFromDate.java | 39 -- .../handlers/IBMSmartCloudErrorHandler.java | 91 --- .../options/CreateInstanceOptions.java | 207 ------ .../options/RestartInstanceOptions.java | 55 -- .../smartcloud/predicates/AddressFree.java | 71 -- .../smartcloud/predicates/InstanceActive.java | 63 -- .../predicates/InstanceActiveOrFailed.java | 58 -- .../predicates/InstanceRemovedOrNotFound.java | 59 -- .../predicates/VolumeUnmounted.java | 58 -- .../smartcloud/reference/Capabilities.java | 33 - .../ibm/smartcloud/xml/LocationHandler.java | 98 --- .../ibm/smartcloud/xml/LocationsHandler.java | 69 -- .../BaseIBMSmartCloudClientLiveTest.java | 91 --- .../IBMSmartCloudAsyncClientTest.java | 658 ------------------ .../IBMSmartCloudClientLiveTest.java | 515 -------------- .../ReadOnlyIBMSmartCloudClientLiveTest.java | 125 ---- .../IBMSmartCloudComputeServiceLiveTest.java | 44 -- .../IBMSmartCloudTemplateBuilderLiveTest.java | 83 --- .../ExtendReservationForInstanceTest.java | 55 -- .../ibm/smartcloud/parse/GetAddressTest.java | 41 -- .../ibm/smartcloud/parse/GetImageTest.java | 76 -- .../ibm/smartcloud/parse/GetInstanceTest.java | 61 -- .../ibm/smartcloud/parse/GetKeyTest.java | 54 -- .../ibm/smartcloud/parse/GetVolumeTest.java | 50 -- .../smartcloud/parse/ListAddressesTest.java | 48 -- .../ibm/smartcloud/parse/ListImagesTest.java | 80 --- .../smartcloud/parse/ListInstancesTest.java | 66 -- .../ibm/smartcloud/parse/ListKeysTest.java | 58 -- .../parse/ListStorageOfferingsTest.java | 66 -- .../ibm/smartcloud/parse/ListVolumesTest.java | 57 -- .../ibm/smartcloud/parse/NewInstanceTest.java | 62 -- .../smartcloud/xml/LocationHandlerTest.java | 53 -- .../smartcloud/xml/LocationsHandlerTest.java | 90 --- .../src/test/resources/address.json | 7 - .../src/test/resources/addresses.json | 16 - .../src/test/resources/image.json | 51 -- .../src/test/resources/images.json | 55 -- .../src/test/resources/instance.json | 29 - .../src/test/resources/instances.json | 31 - .../src/test/resources/key.json | 7 - .../src/test/resources/keys.json | 18 - .../src/test/resources/location.xml | 24 - .../src/test/resources/locations.xml | 124 ---- .../src/test/resources/log4j.xml | 151 ---- .../src/test/resources/new_instance.json | 24 - .../src/test/resources/storage-offerings.json | 56 -- .../src/test/resources/volume.json | 12 - .../src/test/resources/volumes.json | 26 - sandbox-providers/scaleup-storage/README.txt | 27 - sandbox-providers/scaleup-storage/pom.xml | 132 ---- .../ScaleUpStoragePropertiesBuilder.java | 46 -- .../storage/ScaleUpStorageClientLiveTest.java | 32 - ...ScaleUpStorageBlobIntegrationLiveTest.java | 32 - .../blobstore/ScaleUpStorageBlobLiveTest.java | 30 - ...leUpStorageBlobMapIntegrationLiveTest.java | 30 - .../ScaleUpStorageBlobSignerLiveTest.java | 31 - ...UpStorageContainerIntegrationLiveTest.java | 30 - .../ScaleUpStorageContainerLiveTest.java | 30 - ...rageInputStreamMapIntegrationLiveTest.java | 30 - ...leUpStorageServiceIntegrationLiveTest.java | 37 - .../ScaleUpStorageTestInitializer.java | 35 - sandbox-providers/tiscali-storage/pom.xml | 132 ---- .../TiscaliStoragePropertiesBuilder.java | 46 -- .../storage/TiscaliStorageClientLiveTest.java | 34 - ...TiscaliStorageBlobIntegrationLiveTest.java | 32 - .../blobstore/TiscaliStorageBlobLiveTest.java | 32 - ...caliStorageBlobMapIntegrationLiveTest.java | 32 - .../TiscaliStorageBlobSignerLiveTest.java | 33 - ...liStorageContainerIntegrationLiveTest.java | 32 - .../TiscaliStorageContainerLiveTest.java | 32 - ...rageInputStreamMapIntegrationLiveTest.java | 32 - ...caliStorageServiceIntegrationLiveTest.java | 41 -- .../TiscaliStorageTestInitializer.java | 35 - sandbox-providers/twitter/.gitignore | 9 - sandbox-providers/twitter/README.txt | 25 - sandbox-providers/twitter/pom.xml | 117 ---- .../java/org/jclouds/twitter/Twitter.java | 39 -- .../jclouds/twitter/TwitterAsyncClient.java | 53 -- .../org/jclouds/twitter/TwitterClient.java | 40 -- .../twitter/TwitterContextBuilder.java | 44 -- .../twitter/TwitterPropertiesBuilder.java | 46 -- .../config/TwitterRestClientModule.java | 60 -- .../org/jclouds/twitter/domain/Status.java | 197 ------ .../java/org/jclouds/twitter/domain/User.java | 363 ---------- .../twitter/TwitterAsyncClientTest.java | 111 --- .../twitter/TwitterClientLiveTest.java | 106 --- .../twitter/src/test/resources/log4j.xml | 90 --- .../src/test/resources/test_mentions.json | 77 -- .../virtacore-publiccloud-lax/pom.xml | 125 ---- ...VirtacorePublicCloudLAXContextBuilder.java | 51 -- ...tacorePublicCloudLAXPropertiesBuilder.java | 50 -- ...rtacorePublicCloudLAXProviderMetadata.java | 116 --- ...icCloudLAXComputeServiceContextModule.java | 47 -- ...rtacorePublicCloudLAXRestClientModule.java | 38 - .../org.jclouds.providers.ProviderMetadata | 1 - .../VirtacorePublicCloudLAXProviderTest.java | 36 - ...ePublicCloudLAXComputeServiceLiveTest.java | 35 - ...PublicCloudLAXTemplateBuilderLiveTest.java | 83 --- .../src/test/resources/log4j.xml | 151 ---- 378 files changed, 29756 deletions(-) delete mode 100644 sandbox-apis/libvirt/README.txt delete mode 100644 sandbox-apis/libvirt/TODO delete mode 100644 sandbox-apis/libvirt/pom.xml delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/Image.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/LibvirtConstants.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeService.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextSpec.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtPropertiesBuilder.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToHardware.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToNodeMetadata.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/LibvirtImageToImage.java delete mode 100644 sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java delete mode 100644 sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java delete mode 100644 sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java delete mode 100644 sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java delete mode 100644 sandbox-apis/libvirt/src/test/resources/log4j.xml delete mode 100644 sandbox-apis/nirvanix/README.txt delete mode 100644 sandbox-apis/nirvanix/pom.xml delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java delete mode 100644 sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java delete mode 100644 sandbox-apis/nirvanix/src/test/resources/authtoken.json delete mode 100644 sandbox-apis/nirvanix/src/test/resources/log4j.xml delete mode 100644 sandbox-apis/nirvanix/src/test/resources/login.json delete mode 100644 sandbox-apis/nirvanix/src/test/resources/metadata.json delete mode 100644 sandbox-apis/pcs/README.txt delete mode 100644 sandbox-apis/pcs/pom.xml delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableResourceInfo.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/PCSFile.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ResourceInfo.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerInfoImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerListImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoWithMetadataImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableFileInfoImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableResourceInfoImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/PCSFileImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ResourceInfoImpl.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Contacts.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Metacontainers.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Projects.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Recyclebin.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/RootContainer.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Shares.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Tags.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/WebDAV.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/AddMetadataItemIntoMap.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnFalseIfContainerNotFound.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnTrueIfContainerAlreadyExists.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/handlers/PCSClientErrorRetryHandler.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/options/PutBlockOptions.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHandler.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/ContainerHandler.java delete mode 100644 sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/FileHandler.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSAsyncClientTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSClientLiveTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClientTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayloadTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayloadTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AddMetadataAndReturnIdTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AssembleBlobFromBlobMetadataCallTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/internal/StubPCSAsyncClient.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/options/PutBlockOptionsTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHanderTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/ContainerHandlerTest.java delete mode 100644 sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/FileMetadataHandlerTest.java delete mode 100644 sandbox-apis/pcs/src/test/resources/discovery.xml delete mode 100644 sandbox-apis/pcs/src/test/resources/log4j.xml delete mode 100644 sandbox-apis/pcs/src/test/resources/test_file_metadata.xml delete mode 100644 sandbox-apis/pcs/src/test/resources/test_root_container.xml delete mode 100644 sandbox-apis/scality-rs2/README.txt delete mode 100644 sandbox-apis/scality-rs2/pom.xml delete mode 100644 sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2AsyncClient.java delete mode 100644 sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2ContextBuilder.java delete mode 100644 sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2PropertiesBuilder.java delete mode 100644 sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/blobstore/config/ScalityRS2BlobStoreContextModule.java delete mode 100644 sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/config/ScalityRS2RestClientModule.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2AsyncClientTestDisabled.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2ClientLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobIntegrationLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobMapIntegrationLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobSignerLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerIntegrationLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2InputStreamMapIntegrationLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ServiceIntegrationLiveTest.java delete mode 100644 sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2TestInitializer.java delete mode 100644 sandbox-apis/simpledb/pom.xml delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBAsyncClient.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBClient.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBContextBuilder.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBPropertiesBuilder.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/binders/BindAttributesToIndexedFormParams.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/config/SimpleDBRestClientModule.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/AttributePair.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/DomainMetadata.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/Item.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/ListDomainsResponse.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/options/ListDomainsOptions.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/package-info.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/SimpleDBParameters.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/package-info.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ItemsHandler.java delete mode 100644 sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ListDomainsResponseHandler.java delete mode 100644 sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java delete mode 100644 sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBClientLiveTest.java delete mode 100644 sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/options/ListDomainsOptionsTest.java delete mode 100644 sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/xml/ListDomainsResponseHandlerTest.java delete mode 100644 sandbox-apis/simpledb/src/test/resources/list_domains.xml delete mode 100644 sandbox-apis/simpledb/src/test/resources/log4j.xml delete mode 100644 sandbox-drivers/asynchttpclient/pom.xml delete mode 100644 sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/NingHttpCommandExecutorService.java delete mode 100644 sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/config/NingHttpCommandExecutorServiceModule.java delete mode 100644 sandbox-drivers/asynchttpclient/src/test/java/org/jclouds/http/ning/NingHttpCommandExecutorServiceTest.java delete mode 100644 sandbox-drivers/asynchttpclient/src/test/resources/test.jks delete mode 100644 sandbox-providers/aws-simpledb/pom.xml delete mode 100644 sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBPropertiesBuilder.java delete mode 100644 sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderMetadata.java delete mode 100644 sandbox-providers/aws-simpledb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata delete mode 100644 sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java delete mode 100644 sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBClientLiveTest.java delete mode 100644 sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderTest.java delete mode 100644 sandbox-providers/azurequeue/pom.xml delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueAsyncClient.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueClient.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueProviderMetadata.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/binders/BindToXmlStringPayload.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMessage.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMetadata.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/GetOptions.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/PutMessageOptions.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandler.java delete mode 100644 sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/QueueMessagesListHandler.java delete mode 100644 sandbox-providers/azurequeue/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata delete mode 100644 sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueAsyncClientTest.java delete mode 100644 sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueClientLiveTest.java delete mode 100644 sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueProviderTest.java delete mode 100644 sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/options/GetOptionsTest.java delete mode 100644 sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandlerTest.java delete mode 100644 sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/QueueMessagesListHandlerTest.java delete mode 100644 sandbox-providers/azurequeue/src/test/resources/log4j.xml delete mode 100644 sandbox-providers/azurequeue/src/test/resources/test_get_messages.xml delete mode 100644 sandbox-providers/azurequeue/src/test/resources/test_list_queues.xml delete mode 100644 sandbox-providers/azurequeue/src/test/resources/test_list_queues_options.xml delete mode 100644 sandbox-providers/boxdotnet/pom.xml delete mode 100644 sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetAsyncClient.java delete mode 100644 sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetClient.java delete mode 100644 sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetContextBuilder.java delete mode 100644 sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetPropertiesBuilder.java delete mode 100644 sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/config/BoxDotNetRestClientModule.java delete mode 100644 sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/handlers/BoxDotNetErrorHandler.java delete mode 100644 sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetAsyncClientTest.java delete mode 100644 sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetClientLiveTest.java delete mode 100644 sandbox-providers/boxdotnet/src/test/resources/log4j.xml delete mode 100644 sandbox-providers/dunkel-vcd/pom.xml delete mode 100644 sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorContextBuilder.java delete mode 100644 sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorPropertiesBuilder.java delete mode 100644 sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderMetadata.java delete mode 100644 sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorComputeServiceContextModule.java delete mode 100644 sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorRestClientModule.java delete mode 100644 sandbox-providers/dunkel-vcd/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata delete mode 100644 sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderTest.java delete mode 100644 sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorComputeServiceLiveTest.java delete mode 100644 sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorTemplateBuilderLiveTest.java delete mode 100644 sandbox-providers/dunkel-vcd/src/test/resources/log4j.xml delete mode 100644 sandbox-providers/googlestorage/README.txt delete mode 100644 sandbox-providers/googlestorage/pom.xml delete mode 100644 sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageAsyncClient.java delete mode 100644 sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageContextBuilder.java delete mode 100644 sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java delete mode 100644 sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageProviderMetadata.java delete mode 100644 sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequest.java delete mode 100644 sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/config/GoogleStorageRestClientModule.java delete mode 100644 sandbox-providers/googlestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageProviderTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequestTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java delete mode 100644 sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java delete mode 100644 sandbox-providers/hosteurope-storage/pom.xml delete mode 100644 sandbox-providers/hosteurope-storage/src/main/java/org/jclouds/hosteurope/storage/HostEuropeStoragePropertiesBuilder.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/HostEuropeStorageClientLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobIntegrationLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobSignerLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerIntegrationLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageInputStreamMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageServiceIntegrationLiveTest.java delete mode 100644 sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageTestInitializer.java delete mode 100644 sandbox-providers/ibm-smartcloud/pom.xml delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClient.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/CreateInstanceOptions.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/RestartInstanceOptions.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/AddressFree.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActive.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActiveOrFailed.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceRemovedOrNotFound.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/VolumeUnmounted.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/reference/Capabilities.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationHandler.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationsHandler.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/BaseIBMSmartCloudClientLiveTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClientTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClientLiveTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/ReadOnlyIBMSmartCloudClientLiveTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudComputeServiceLiveTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudTemplateBuilderLiveTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ExtendReservationForInstanceTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetAddressTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetImageTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetInstanceTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetKeyTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetVolumeTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListAddressesTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListImagesTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListInstancesTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListKeysTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListStorageOfferingsTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListVolumesTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/NewInstanceTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationHandlerTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationsHandlerTest.java delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/address.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/addresses.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/image.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/images.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/instance.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/instances.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/key.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/keys.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/location.xml delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/locations.xml delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/log4j.xml delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/new_instance.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/storage-offerings.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/volume.json delete mode 100644 sandbox-providers/ibm-smartcloud/src/test/resources/volumes.json delete mode 100644 sandbox-providers/scaleup-storage/README.txt delete mode 100644 sandbox-providers/scaleup-storage/pom.xml delete mode 100644 sandbox-providers/scaleup-storage/src/main/java/org/jclouds/scaleup/storage/ScaleUpStoragePropertiesBuilder.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/ScaleUpStorageClientLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobIntegrationLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobSignerLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerIntegrationLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageInputStreamMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageServiceIntegrationLiveTest.java delete mode 100644 sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageTestInitializer.java delete mode 100644 sandbox-providers/tiscali-storage/pom.xml delete mode 100644 sandbox-providers/tiscali-storage/src/main/java/org/jclouds/tiscali/storage/TiscaliStoragePropertiesBuilder.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/TiscaliStorageClientLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobIntegrationLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobSignerLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerIntegrationLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageInputStreamMapIntegrationLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageServiceIntegrationLiveTest.java delete mode 100644 sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageTestInitializer.java delete mode 100644 sandbox-providers/twitter/.gitignore delete mode 100644 sandbox-providers/twitter/README.txt delete mode 100644 sandbox-providers/twitter/pom.xml delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/Twitter.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterAsyncClient.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterClient.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/Status.java delete mode 100644 sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/User.java delete mode 100644 sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterAsyncClientTest.java delete mode 100644 sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java delete mode 100644 sandbox-providers/twitter/src/test/resources/log4j.xml delete mode 100644 sandbox-providers/twitter/src/test/resources/test_mentions.json delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/pom.xml delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXContextBuilder.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXPropertiesBuilder.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderMetadata.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXComputeServiceContextModule.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXRestClientModule.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderTest.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXComputeServiceLiveTest.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXTemplateBuilderLiveTest.java delete mode 100644 sandbox-providers/virtacore-publiccloud-lax/src/test/resources/log4j.xml diff --git a/sandbox-apis/libvirt/README.txt b/sandbox-apis/libvirt/README.txt deleted file mode 100644 index 10453e5001..0000000000 --- a/sandbox-apis/libvirt/README.txt +++ /dev/null @@ -1,92 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -The libvirt library is used to interface with different virtualization technologies (http://libvirt.org/) - -libvirt supports: -The Xen hypervisor on Linux and Solaris hosts. -The QEMU emulator -The KVM Linux hypervisor -The LXC Linux container system -The OpenVZ Linux container system -The User Mode Linux paravirtualized kernel -The VirtualBox hypervisor -The VMware ESX and GSX hypervisors -Storage on IDE/SCSI/USB disks, FibreChannel, LVM, iSCSI, NFS and filesystems - -Getting Started Guide for jclouds-libvirt - -install libvirt on your os - * if os/x, see http://github.com/justinclift/libvirt - * if you are using Linux, let's suppose you want to use KVM: -- install libvirt and KVM (http://www.linux-kvm.org/page/Main_Page). - -Remember to run - egrep '(vmx|svm)' /proc/cpuinfo - If nothing is printed, it means that your cpu does not support hardware virtualization. - -Verify Installation -$ virsh -c qemu:///system list - Id Name State ----------------------------------- - -(for Ubuntu users: look also at this good turorial https://help.ubuntu.com/community/KVM) - -Create your first guest -- download, for example, an ubuntu 10.04 LTS ISO -- create a libvirt domain by using: - virt-manager: a GUI tool at http://virt-manager.et.redhat.com/ - virt-install, a python script developed by Red Hat (sudo apt-get install python-virtinst) - ubuntu-vm-builder, developed by Canonical. (sudo apt-get install ubuntu-vm-builder) - NB: use Javascript tool that generates the parameters for ubuntu-vm-builder: http://people.ubuntu.com/~kirkland/ubuntu-vm-builder.html - -Now that you have a libvirt domain, your workstation is ready to use jclouds-libvirt. -You can now download jclouds-libvirt and give a try by running - -ComputeServiceContext context = null; - try { - context = new ComputeServiceContextFactory() - .createContext(new StandaloneComputeServiceContextSpec("libvirt", - endpoint, apiversion, identity, credential, new LibvirtComputeServiceContextModule(), ImmutableSet - . of())); - - Template defaultTemplate = context.getComputeService().templateBuilder() - .hardwareId("c7ff2039-a9f1-a659-7f91-e0f82f59d52e").imageId("1").build(); - - - context.getComputeService().runNodesWithTag(domainName, 1, defaultTemplate); - - } catch (RunNodesException e) { - e.printStackTrace(); - } finally { - if (context != null) - context.close(); - } - -where identity=your_name, endpoint=qemu:///system - and domainName equals to the name chosen during the creation of libvirt domain - -NB: apiversion, credential can be null - - - - - - - diff --git a/sandbox-apis/libvirt/TODO b/sandbox-apis/libvirt/TODO deleted file mode 100644 index 81960b3b76..0000000000 --- a/sandbox-apis/libvirt/TODO +++ /dev/null @@ -1 +0,0 @@ -runNodesWithTag: when ask for more than 1 node, cloning step fails cause of concurrent access to the originale virtual disk to be cloned. \ No newline at end of file diff --git a/sandbox-apis/libvirt/pom.xml b/sandbox-apis/libvirt/pom.xml deleted file mode 100644 index f0b355f255..0000000000 --- a/sandbox-apis/libvirt/pom.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.api - libvirt - jclouds example components for a libvirt provider - bundle - - - - trmkrun-ccc,test.trmk-924 - test:///default - 1.0 - - FIXME - FIXME - - - org.jclouds.libvirt*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - org.libvirt - libvirt - 0.4.6 - - - commons-io - commons-io - 2.4 - - - - com.sun.jna - jna - 3.0.9 - provided - - - com.jamesmurty.utils - java-xmlbuilder - 0.3 - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-compute - ${project.version} - - - org.jclouds - jclouds-compute - ${project.version} - test-jar - test - - - log4j - log4j - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - org.jclouds.driver - jclouds-jsch - ${project.version} - test - - - com.jcraft - jsch - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.libvirt.endpoint} - ${test.libvirt.api-version} - ${test.libvirt.build-version} - ${test.libvirt.identity} - ${test.libvirt.credential} - ${test.libvirt.image-id} - - - - - - - - - - - diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/Image.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/Image.java deleted file mode 100644 index 253692494a..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/Image.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt; - -import com.google.common.base.Objects; - -/** - * This would be replaced with the real java object related to the underlying image - * - * @author Adrian Cole - */ -public class Image { - - public int id; - public String name; - - public Image(int id, String name) { - this.id = id; - this.name = name; - } - - @Override - public int hashCode() { - return Objects.hashCode(id, name); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - return Objects.equal(this.toString(), that.toString()); - } - - @Override - public String toString() { - return Objects.toStringHelper(this).add("id", id).add("name", name).toString(); - } - -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/LibvirtConstants.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/LibvirtConstants.java deleted file mode 100644 index 9fe3405b88..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/LibvirtConstants.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt; - -/** - * Configuration properties and constants used in libvirt local connections. - * - * @author Adrian Cole - */ -public interface LibvirtConstants { - public static final String PROPERTY_LIBVIRT_DOMAIN_DIR = "jclouds.libvirt.domain.dir"; -} - - -//public static final String PROPERTY_AUTH_TAG = "jclouds.aws.auth.tag"; -//public static final String PROPERTY_HEADER_TAG = "jclouds.aws.header.tag"; diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeService.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeService.java deleted file mode 100644 index 5feec7c522..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeService.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import java.io.StringReader; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Provider; -import javax.inject.Singleton; - -import org.jclouds.Constants; -import org.jclouds.collect.Memoized; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.ImageExtension; -import org.jclouds.compute.callables.RunScriptOnNode; -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.TemplateBuilder; -import org.jclouds.compute.internal.BaseComputeService; -import org.jclouds.compute.internal.PersistNodeCredentials; -import org.jclouds.compute.options.TemplateOptions; -import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts; -import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet; -import org.jclouds.compute.strategy.DestroyNodeStrategy; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.compute.strategy.InitializeRunScriptOnNodeOrPlaceInBadMap; -import org.jclouds.compute.strategy.ListNodesStrategy; -import org.jclouds.compute.strategy.RebootNodeStrategy; -import org.jclouds.compute.strategy.ResumeNodeStrategy; -import org.jclouds.compute.strategy.SuspendNodeStrategy; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.Location; -import org.jclouds.scriptbuilder.functions.InitAdminAccess; -import org.libvirt.Connect; -import org.libvirt.StorageVol; -import org.xml.sax.InputSource; - -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.base.Supplier; -import com.google.common.base.Throwables; -import com.jamesmurty.utils.XMLBuilder; - -/** - * - * @author andrea turli - * - */ -@Singleton -public class LibvirtComputeService extends BaseComputeService { - - private final Connect client; - - @Inject - protected LibvirtComputeService(ComputeServiceContext context, Map credentialStore, - @Memoized Supplier> images, - @Memoized Supplier> hardwareProfiles, - @Memoized Supplier> locations, ListNodesStrategy listNodesStrategy, - GetNodeMetadataStrategy getNodeMetadataStrategy, - CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy, - DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy resumeNodeStrategy, - SuspendNodeStrategy suspendNodeStrategy, Provider templateBuilderProvider, - Provider templateOptionsProvider, - @Named("NODE_RUNNING") Predicate nodeRunning, - @Named("NODE_TERMINATED") Predicate nodeTerminated, - @Named("NODE_SUSPENDED") Predicate nodeSuspended, - InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory, InitAdminAccess initAdminAccess, - RunScriptOnNode.Factory runScriptOnNodeFactory, PersistNodeCredentials persistNodeCredentials, - Timeouts timeouts, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, Connect client, - Optional imageExtension) { - super(context, credentialStore, images, hardwareProfiles, locations, listNodesStrategy, getNodeMetadataStrategy, - runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy, resumeNodeStrategy, - suspendNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning, nodeTerminated, - nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory, persistNodeCredentials, - timeouts, executor, imageExtension); - this.client = client; - } - - @Override - protected void cleanUpIncidentalResourcesOfDeadNodes(Set deadNodes) { - // TODO Was previously commented out in overridden destroyNode; refactored to here but left commented out -// for (NodeMetadata deadNode : deadNodes) { -// eliminateDomain(deadNode.getId()); -// } - } - - private void eliminateDomain(String id) { - try { - XMLBuilder builder = XMLBuilder.parse(new InputSource(new StringReader(client.domainLookupByUUIDString(id) - .getXMLDesc(0)))); - String diskFileName = builder.xpathFind("//devices/disk[@device='disk']/source").getElement().getAttribute( - "file"); - StorageVol storageVol = client.storageVolLookupByPath(diskFileName); - storageVol.delete(0); - client.domainLookupByUUIDString(id).undefine(); - } catch (Exception e) { - Throwables.propagate(e); - } - } -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java deleted file mode 100644 index dd9e1de836..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.compute.StandaloneComputeServiceContextBuilder; -import org.jclouds.libvirt.compute.domain.LibvirtComputeServiceContextModule; -import org.libvirt.Connect; - -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class LibvirtComputeServiceContextBuilder extends StandaloneComputeServiceContextBuilder { - - public LibvirtComputeServiceContextBuilder(Properties props) { - super(Connect.class, props); - - if (!properties.containsKey(PROPERTY_LIBVIRT_DOMAIN_DIR)) - properties.setProperty(PROPERTY_LIBVIRT_DOMAIN_DIR, "/etc/libvirt/qemu"); - } - - @Override - protected void addContextModule(List modules) { - modules.add(new LibvirtComputeServiceContextModule()); - } -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextSpec.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextSpec.java deleted file mode 100644 index 73d8641d5e..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextSpec.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import org.jclouds.PropertiesBuilder; -import org.jclouds.compute.ComputeService; -import org.jclouds.rest.RestContextSpec; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * @author Adrian Cole - */ -public class LibvirtComputeServiceContextSpec extends RestContextSpec { - - @SuppressWarnings("unchecked") - public LibvirtComputeServiceContextSpec(String endpoint, String identity, String credential, Iterable modules) { - super("libvirt", endpoint, "1", "", identity, credential, ComputeService.class, ComputeService.class, - PropertiesBuilder.class, (Class) LibvirtComputeServiceContextBuilder.class, modules); - } - - public LibvirtComputeServiceContextSpec(String endpoint, String identity, String credential) { - this(endpoint, identity, credential, ImmutableSet. of()); - } -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtPropertiesBuilder.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtPropertiesBuilder.java deleted file mode 100644 index e86ac8a83d..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtPropertiesBuilder.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import static org.jclouds.Constants.PROPERTY_API_VERSION; -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; -import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_SUSPENDED; - -import java.util.Properties; - -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in Libvirt Clients - * - * @author Andrea Turli - */ -public class LibvirtPropertiesBuilder extends PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_LIBVIRT_DOMAIN_DIR, "/etc/libvirt/qemu"); - - /* - properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); - properties.setProperty(PROPERTY_HEADER_TAG, "amz"); - properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com"); - properties.setProperty(PROPERTY_API_VERSION, EC2AsyncClient.VERSION); - properties.setProperty(PROPERTY_ELB_ENDPOINT, "https://elasticloadbalancing.us-east-1.amazonaws.com"); - // amazon, alestic, canonical, and rightscale - properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317"); - // amis that work with the cluster instances - properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-7ea24a17"); - */ - - // sometimes, like in ec2, stop takes a very long time, perhaps - // due to volume management. one example spent 2 minutes moving - // from stopping->stopped state on an ec2 micro - properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + ""); - // auth fail sometimes happens in EC2, as the rc.local script that injects the - // authorized key executes after ssh has started - properties.setProperty("jclouds.ssh.max_retries", "7"); - properties.setProperty("jclouds.ssh.retryable_messages", - "Auth fail,invalid data,End of IO Stream Read,Connection reset,socket is not established"); - return properties; - } - - public LibvirtPropertiesBuilder(Properties properties) { - super(properties); - } - - public LibvirtPropertiesBuilder() { - super(); - } -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java deleted file mode 100644 index a33ea581c6..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java +++ /dev/null @@ -1,180 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute.domain; - -import static com.google.common.base.Predicates.notNull; -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.transform; -import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.net.URI; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.filefilter.WildcardFileFilter; -import org.jclouds.Constants; -import org.jclouds.compute.ComputeServiceAdapter; -import org.jclouds.compute.config.ComputeServiceAdapterContextModule; -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.TemplateBuilder; -import org.jclouds.domain.Location; -import org.jclouds.functions.IdentityFunction; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.libvirt.Image; -import org.jclouds.libvirt.compute.functions.DomainToHardware; -import org.jclouds.libvirt.compute.functions.DomainToNodeMetadata; -import org.jclouds.libvirt.compute.functions.LibvirtImageToImage; -import org.jclouds.libvirt.compute.strategy.LibvirtComputeServiceAdapter; -import org.jclouds.location.Provider; -import org.jclouds.location.suppliers.OnlyLocationOrFirstZone; -import org.libvirt.Connect; -import org.libvirt.Domain; -import org.libvirt.LibvirtException; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import com.google.common.collect.Iterables; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.Provides; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; - -/** - * - * @author Adrian Cole - */ -public class LibvirtComputeServiceContextModule extends - ComputeServiceAdapterContextModule { - - public LibvirtComputeServiceContextModule() { - super(Connect.class, Connect.class); - } - - @SuppressWarnings("unchecked") - @Override - protected void configure() { - super.configure(); - bind(new TypeLiteral>() { - }).to(LibvirtComputeServiceAdapter.class); - bind(new TypeLiteral>() { - }).to(OnlyLocationOrFirstZone.class); - bind(new TypeLiteral>() { - }).to(DomainToNodeMetadata.class); - bind(new TypeLiteral>() { - }).to(LibvirtImageToImage.class); - bind(new TypeLiteral>() { - }).to(DomainToHardware.class); - bind(new TypeLiteral>() { - }).to((Class) IdentityFunction.class); - - // bind(ComputeService.class).to(LibvirtComputeService.class); - } - - @Provides - @Singleton - protected Connect createConnection(@Provider URI endpoint, @Named(Constants.PROPERTY_IDENTITY) String identity, - @Named(Constants.PROPERTY_CREDENTIAL) String credential) throws LibvirtException { - // ConnectAuth connectAuth = null; - return new Connect(endpoint.toASCIIString()); - } - - @Override - protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { - String domainDir = injector.getInstance(Key.get(String.class, Names.named(PROPERTY_LIBVIRT_DOMAIN_DIR))); - String hardwareId = searchForHardwareIdInDomainDir(domainDir, injector.getInstance(ParseSax.Factory.class), - injector.getProvider(UUIDHandler.class)); - String image = searchForImageIdInDomainDir(domainDir); - return template.hardwareId(hardwareId).imageId(image); - } - - private String searchForImageIdInDomainDir(String domainDir) { - // TODO - return "1"; - } - - @SuppressWarnings("unchecked") - private String searchForHardwareIdInDomainDir(String domainDir, final ParseSax.Factory factory, - final javax.inject.Provider provider) { - - // TODO: remove commons-io dependency - return Iterables. getLast(filter(transform(FileUtils.listFiles(new File(domainDir), - new WildcardFileFilter("*.xml"), null), new Function() { - - @Override - public String apply(File input) { - try { - return factory.create(provider.get()).parse(new FileInputStream(input)); - } catch (FileNotFoundException e) { - // log error. - return null; - } - } - - }), notNull())); - } - - public static class UUIDHandler extends ParseSax.HandlerWithResult { - private StringBuilder currentText = new StringBuilder(); - - private boolean inDomain; - private String uuid; - - public String getResult() { - return uuid; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { - if (qName.equals("domain")) { - inDomain = true; - } - } - - @Override - public void endElement(String uri, String localName, String qName) { - if (qName.equalsIgnoreCase("uuid") && inDomain) { - this.uuid = currentText.toString(); - } else if (qName.equalsIgnoreCase("domain")) { - inDomain = false; - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } - } - - /* - * Map regions = newLinkedHashMap(); for (String region : - * Splitter.on(',').split(regionString)) { regions.put( region, - * URI.create(injector.getInstance(Key.get(String.class, Names.named(Constants.PROPERTY_ENDPOINT - * + "." + region))))); } return regions; - */ - -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToHardware.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToHardware.java deleted file mode 100644 index 7044321941..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToHardware.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute.functions; - -import java.io.IOException; -import java.io.StringReader; -import java.util.List; - -import javax.inject.Singleton; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.HardwareBuilder; -import org.jclouds.compute.domain.Processor; -import org.jclouds.compute.domain.Volume; -import org.jclouds.compute.domain.internal.VolumeImpl; -import org.libvirt.Domain; -import org.libvirt.LibvirtException; -import org.libvirt.StorageVol; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import com.google.common.base.Function; -import com.google.common.base.Throwables; -import com.google.common.collect.Lists; - -import com.jamesmurty.utils.XMLBuilder; - -/** - * @author Adrian Cole - */ -@Singleton -public class DomainToHardware implements Function { - - @Override - public Hardware apply(Domain from) { - HardwareBuilder builder = new HardwareBuilder(); - - try { - builder.id(from.getUUIDString()); - builder.providerId(from.getID() + ""); - builder.name(from.getName()); - List processors = Lists.newArrayList(); - for (int i = 0; i < from.getInfo().nrVirtCpu; i++) { - processors.add(new Processor(i + 1, 1)); - } - builder.processors(processors); - - builder.ram((int) from.getInfo().maxMem); - List volumes = Lists.newArrayList(); - XMLBuilder xmlBuilder = XMLBuilder.parse(new InputSource(new StringReader(from.getXMLDesc(0)))); - Document doc = xmlBuilder.getDocument(); - XPathExpression expr = XPathFactory.newInstance().newXPath().compile("//devices/disk[@device='disk']/source/@file"); - NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); - String diskFileName = nodes.item(0).getNodeValue(); - for (int i = 0; i < nodes.getLength(); i++) { - StorageVol storageVol = from.getConnect().storageVolLookupByPath(diskFileName); - String id = storageVol.getKey(); - float size = Long.valueOf(storageVol.getInfo().capacity).floatValue(); - volumes.add(new VolumeImpl(id, Volume.Type.LOCAL, size, null, true, false)); - } - builder.volumes((List) volumes); - } catch (LibvirtException e) { - Throwables.propagate(e); - } catch (XPathExpressionException e) { - Throwables.propagate(e); - } catch (ParserConfigurationException e) { - Throwables.propagate(e); - } catch (SAXException e) { - Throwables.propagate(e); - } catch (IOException e) { - Throwables.propagate(e); - } - return builder.build(); - } -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToNodeMetadata.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToNodeMetadata.java deleted file mode 100644 index 03a4c241b3..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/DomainToNodeMetadata.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute.functions; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName; - -import java.util.Map; -import java.util.Set; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.collect.FindResourceInSet; -import org.jclouds.collect.Memoized; -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.NodeMetadataBuilder; -import org.jclouds.compute.domain.NodeState; -import org.jclouds.compute.domain.OperatingSystemBuilder; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.Location; -import org.libvirt.Domain; -import org.libvirt.DomainInfo; -import org.libvirt.LibvirtException; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; - -/** - * @author Adrian Cole - */ -@Singleton -public class DomainToNodeMetadata implements Function { - - public static final Map domainStateToNodeState = ImmutableMap - . builder().put(DomainInfo.DomainState.VIR_DOMAIN_RUNNING, - NodeState.RUNNING)// - .put(DomainInfo.DomainState.VIR_DOMAIN_BLOCKED, NodeState.PENDING)// - .put(DomainInfo.DomainState.VIR_DOMAIN_PAUSED, NodeState.SUSPENDED)// - .put(DomainInfo.DomainState.VIR_DOMAIN_SHUTDOWN, NodeState.SUSPENDED)// - .put(DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF, NodeState.SUSPENDED)// - .put(DomainInfo.DomainState.VIR_DOMAIN_CRASHED, NodeState.ERROR)// - - .put(DomainInfo.DomainState.VIR_DOMAIN_NOSTATE, NodeState.UNRECOGNIZED)// - .build(); - - private final Function findHardwareForDomain; - private final FindLocationForDomain findLocationForDomain; - private final FindImageForDomain findImageForDomain; - private final Map credentialStore; - - @Inject - DomainToNodeMetadata(Map credentialStore, Function findHardwareForDomain, - FindLocationForDomain findLocationForDomain, FindImageForDomain findImageForDomain) { - this.credentialStore = checkNotNull(credentialStore, "credentialStore"); - this.findHardwareForDomain = checkNotNull(findHardwareForDomain, "findHardwareForDomain"); - this.findLocationForDomain = checkNotNull(findLocationForDomain, "findLocationForDomain"); - this.findImageForDomain = checkNotNull(findImageForDomain, "findImageForDomain"); - } - - @Override - public NodeMetadata apply(Domain from) { - - // convert the result object to a jclouds NodeMetadata - NodeMetadataBuilder builder = new NodeMetadataBuilder(); - try { - builder.id(from.getUUIDString()); - builder.providerId(from.getID() + ""); - builder.name(from.getName()); - builder.location(findLocationForDomain.apply(from)); - builder.group(parseGroupFromName(from.getName())); - - builder.operatingSystem(new OperatingSystemBuilder().description(from.getOSType()).build()); - builder.hardware(findHardwareForDomain.apply(from)); - - builder.state(domainStateToNodeState.get(from.getInfo().state)); - // builder.publicAddresses(ImmutableSet. of(from.publicAddress)); - // builder.privateAddresses(ImmutableSet. of(from.privateAddress)); - builder.credentials(credentialStore.get("node#" + from.getUUIDString())); - - } catch (LibvirtException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return builder.build(); - } - - @Singleton - public static class FindImageForDomain extends FindResourceInSet { - - @Inject - public FindImageForDomain(@Memoized Supplier> hardware) { - super(hardware); - } - - @Override - public boolean matches(Domain from, Image input) { - // TODO - // return input.getProviderId().equals(from.imageId + ""); - return true; - } - } - - @Singleton - public static class FindLocationForDomain extends FindResourceInSet { - - @Inject - public FindLocationForDomain(@Memoized Supplier> hardware) { - super(hardware); - } - - @Override - public boolean matches(Domain from, Location input) { - // TODO - // return input.getId().equals(from.datacenter + ""); - return true; - } - } -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/LibvirtImageToImage.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/LibvirtImageToImage.java deleted file mode 100644 index fe208e133e..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/functions/LibvirtImageToImage.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute.functions; - -import javax.annotation.Resource; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.ImageBuilder; -import org.jclouds.compute.domain.OperatingSystemBuilder; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.logging.Logger; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class LibvirtImageToImage implements Function { - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - - @Override - public Image apply(org.jclouds.libvirt.Image from) { - - ImageBuilder builder = new ImageBuilder(); - builder.ids(from.id + ""); - builder.name(from.name); - builder.description(from.name); - - OsFamily family = null; - try { - family = OsFamily.fromValue(from.name); - builder.operatingSystem(new OperatingSystemBuilder().name(from.name).family(family).description(from.name).build()); - } catch (IllegalArgumentException e) { - logger.debug("<< didn't match os(%s)", from); - } - return builder.build(); - } - -} diff --git a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java b/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java deleted file mode 100644 index f1de6a9813..0000000000 --- a/sandbox-apis/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java +++ /dev/null @@ -1,282 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; - -import java.io.IOException; -import java.io.StringReader; -import java.security.SecureRandom; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; - -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.jclouds.compute.ComputeService; -import org.jclouds.compute.ComputeServiceAdapter; -import org.jclouds.compute.domain.Template; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.Location; -import org.jclouds.libvirt.Image; -import org.libvirt.Connect; -import org.libvirt.Domain; -import org.libvirt.LibvirtException; -import org.libvirt.StoragePool; -import org.libvirt.StorageVol; -import org.libvirt.jna.Libvirt; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.inject.name.Named; -import com.jamesmurty.utils.XMLBuilder; - -/** - * defines the connection between the {@link Libvirt} implementation and the jclouds - * {@link ComputeService} - * - */ -@Singleton -public class LibvirtComputeServiceAdapter implements ComputeServiceAdapter { - - private final Connect client; - - @Inject - public LibvirtComputeServiceAdapter(Connect client, @Named(PROPERTY_LIBVIRT_DOMAIN_DIR) String domainDir) { - this.client = checkNotNull(client, "client"); - System.out.println(domainDir); - } - - @Override - public Domain createNodeWithGroupEncodedIntoNameThenStoreCredentials(String tag, String name, Template template, - Map credentialStore) { - try { - String domainName = tag; - Domain domain = client.domainLookupByName(domainName); - XMLBuilder builder = XMLBuilder.parse(new InputSource(new StringReader(domain.getXMLDesc(0)))); - Document doc = builder.getDocument(); - String xpathString = "//devices/disk[@device='disk']/source/@file"; - XPathExpression expr = XPathFactory.newInstance().newXPath().compile(xpathString); - NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); - String diskFileName = nodes.item(0).getNodeValue(); - StorageVol storageVol = client.storageVolLookupByPath(diskFileName); - - // cloning volume - String poolName = storageVol.storagePoolLookupByVolume().getName(); - StoragePool storagePool = client.storagePoolLookupByName(poolName); - StorageVol clonedVol = null; - boolean cloned = false; - int retry = 0; - while (!cloned && retry < 10) { - try { - clonedVol = cloneVolume(storagePool, storageVol); - cloned = true; - } catch (LibvirtException e) { - retry++; - Thread.sleep(1000); - } - } - // define Domain - String xmlFinal = generateClonedDomainXML(domain.getXMLDesc(0), clonedVol); - Domain newDomain = client.domainDefineXML(xmlFinal); - newDomain.create(); - // store the credentials so that later functions can use them - credentialStore.put(domain.getUUIDString() + "", new Credentials("identity", "credential")); - return newDomain; - } catch (LibvirtException e) { - throw Throwables.propagate(e); - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - @Override - public Iterable listHardwareProfiles() { - return listNodes(); - } - - @Override - public Iterable listImages() { - int i = 1; - try { - String[] domains = client.listDefinedDomains(); - List images = Lists.newArrayList(); - for (String domainName : domains) { - images.add(new Image(i++, domainName)); - } - return images; - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - @Override - public Iterable listNodes() { - try { - List domains = Lists.newArrayList(); - for (String domain : client.listDefinedDomains()) { - domains.add(client.domainLookupByName(domain)); - } - return domains; - } catch (LibvirtException e) { - throw Throwables.propagate(e); - } - } - - @Override - public Iterable listLocations() { - return ImmutableSet.of(); - } - - @Override - public Domain getNode(String id) { - Domain d = null; - try { - d = client.domainLookupByUUIDString(id); - } catch (LibvirtException e) { - if (e.getMessage().indexOf("Domain not found: no domain with matching uuid") != -1) - return null; - Throwables.propagate(e); - } - return d; - } - - @Override - public void destroyNode(String id) { - try { - client.domainLookupByUUIDString(id).destroy(); - - XMLBuilder builder = XMLBuilder.parse(new InputSource(new StringReader(client.domainLookupByUUIDString(id) - .getXMLDesc(0)))); - String diskFileName = builder.xpathFind("//devices/disk[@device='disk']/source").getElement().getAttribute( - "file"); - StorageVol storageVol = client.storageVolLookupByPath(diskFileName); - storageVol.delete(0); - client.domainLookupByUUIDString(id).undefine(); - - } catch (LibvirtException e) { - Throwables.propagate(e); - } catch (Exception e) { - Throwables.propagate(e); - } - } - - @Override - public void rebootNode(String id) { - try { - client.domainLookupByUUIDString(id).reboot(0); - } catch (LibvirtException e) { - Throwables.propagate(e); - } - } - - private static StorageVol cloneVolume(StoragePool storagePool, StorageVol from) throws LibvirtException, - XPathExpressionException, ParserConfigurationException, SAXException, IOException, TransformerException { - return storagePool.storageVolCreateXMLFrom(generateClonedVolumeXML(from.getXMLDesc(0)), from, 0); - } - - @Override - public void resumeNode(String id) { - try { - client.domainLookupByUUIDString(id).resume(); - } catch (LibvirtException e) { - Throwables.propagate(e); - } - } - - @Override - public void suspendNode(String id) { - try { - client.domainLookupByUUIDString(id).suspend(); - } catch (LibvirtException e) { - Throwables.propagate(e); - } - } - - private static String generateClonedVolumeXML(String fromXML) throws ParserConfigurationException, SAXException, - IOException, XPathExpressionException, TransformerException { - - Properties outputProperties = generateOutputXMLProperties(); - XMLBuilder builder = XMLBuilder.parse(new InputSource(new StringReader(fromXML))); - String nodeNamingConvention = "%s-%s"; - String tag = "-clone"; - String suffix = String.format(nodeNamingConvention, tag, Integer.toHexString(new SecureRandom().nextInt(4095))); - builder.xpathFind("//volume/name").t(suffix); - builder.xpathFind("//volume/key").t(suffix); - builder.xpathFind("//volume/target/path").t(suffix); - - return builder.asString(outputProperties); - } - - private static String generateClonedDomainXML(String fromXML, StorageVol clonedVol) - throws ParserConfigurationException, SAXException, IOException, XPathExpressionException, - TransformerException, LibvirtException { - - Properties outputProperties = generateOutputXMLProperties(); - - XMLBuilder builder = XMLBuilder.parse(new InputSource(new StringReader(fromXML))); - - String nodeNamingConvention = "%s-%s"; - String tag = "-clone"; - String suffix = String.format(nodeNamingConvention, tag, Integer.toHexString(new SecureRandom().nextInt(4095))); - builder.xpathFind("//domain/name").t(suffix); - // change uuid domain - Element oldChild = builder.xpathFind("//domain/uuid").getElement(); - Node newNode = oldChild.cloneNode(true); - newNode.getFirstChild().setNodeValue(UUID.randomUUID().toString()); - builder.getDocument().getDocumentElement().replaceChild(newNode, oldChild); - - // String fromVolPath = - // builder.xpathFind("//domain/devices/disk/source").getElement().getAttribute("file"); - builder.xpathFind("//domain/devices/disk/source").a("file", clonedVol.getPath()); - // generate valid MAC address - String fromMACaddress = builder.xpathFind("//domain/devices/interface/mac").getElement().getAttribute("address"); - String lastMACoctet = Integer.toHexString(new SecureRandom().nextInt(255)); - builder.xpathFind("//domain/devices/interface/mac").a("address", - fromMACaddress.substring(0, fromMACaddress.lastIndexOf(":") + 1) + lastMACoctet); - return builder.asString(outputProperties); - } - - private static Properties generateOutputXMLProperties() { - Properties outputProperties = new Properties(); - // Explicitly identify the output as an XML document - outputProperties.put(javax.xml.transform.OutputKeys.METHOD, "xml"); - // Pretty-print the XML output (doesn't work in all cases) - outputProperties.put(javax.xml.transform.OutputKeys.INDENT, "yes"); - // Get 2-space indenting when using the Apache transformer - outputProperties.put("{http://xml.apache.org/xslt}indent-amount", "2"); - return outputProperties; - } -} diff --git a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java b/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java deleted file mode 100644 index f586c2d0e1..0000000000 --- a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import static org.testng.Assert.assertEquals; - -import java.util.Properties; - -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.ComputeServiceContextFactory; -import org.jclouds.rest.RestContext; -import org.libvirt.Connect; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - * - */ -@Test(groups = "unit") -public class LibvirtComputeServiceContextBuilderTest { - - @Test - public void testCanBuildWithComputeService() { - ComputeServiceContext context = new ComputeServiceContextFactory() - .createContext(new LibvirtComputeServiceContextSpec("test:///default", "identity", "credential")); - // System.err.println(context.getComputeService(). - context.close(); - } - - @Test - public void testCanBuildWithRestProperties() { - Properties restProperties = new Properties(); - restProperties.setProperty("libvirt.contextbuilder", LibvirtComputeServiceContextBuilder.class.getName()); - restProperties.setProperty("libvirt.propertiesbuilder", LibvirtPropertiesBuilder.class.getName()); - restProperties.setProperty("libvirt.endpoint", "test:///default"); - - ComputeServiceContext context = new ComputeServiceContextFactory(restProperties).createContext("libvirt", - "identity", "credential"); - - context.close(); - } - - @Test - public void testProviderSpecificContextIsCorrectType() { - Properties restProperties = new Properties(); - restProperties.setProperty("libvirt.contextbuilder", LibvirtComputeServiceContextBuilder.class.getName()); - restProperties.setProperty("libvirt.propertiesbuilder", LibvirtPropertiesBuilder.class.getName()); - restProperties.setProperty("libvirt.endpoint", "test:///default"); - - ComputeServiceContext context = new ComputeServiceContextFactory(restProperties).createContext("libvirt", - "identity", "credential"); - - RestContext providerContext = context.getProviderSpecificContext(); - - assertEquals(providerContext.getApi().getClass(), Connect.class); - - context.close(); - } -} diff --git a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java b/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java deleted file mode 100644 index 72e7a2b758..0000000000 --- a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceLiveTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import static org.jclouds.compute.util.ComputeServiceUtils.getCores; -import static org.testng.Assert.assertEquals; - -import java.util.Properties; - -import org.jclouds.compute.BaseComputeServiceLiveTest; -import org.jclouds.compute.ComputeServiceContextFactory; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.domain.Template; -import org.jclouds.rest.RestContext; -import org.jclouds.ssh.jsch.config.JschSshClientModule; -import org.libvirt.Connect; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, sequential = true) -public class LibvirtComputeServiceLiveTest extends BaseComputeServiceLiveTest { - public LibvirtComputeServiceLiveTest() { - provider = "libvirt"; - } - - @Override - protected Properties setupRestProperties() { - Properties restProperties = new Properties(); - restProperties.setProperty("libvirt.contextbuilder", LibvirtComputeServiceContextBuilder.class.getName()); - restProperties.setProperty("libvirt.propertiesbuilder", LibvirtPropertiesBuilder.class.getName()); - restProperties.setProperty("libvirt.endpoint", "test:///default"); - return restProperties; - } - - @Test - public void testTemplateBuilder() { - Template defaultTemplate = client.templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); - assertEquals(defaultTemplate.getLocation().getId(), "1"); - assertEquals(getCores(defaultTemplate.getHardware()), 0.5d); - } - - @Override - protected JschSshClientModule getSshModule() { - return new JschSshClientModule(); - } - - public void testAssignability() throws Exception { - @SuppressWarnings("unused") - RestContext goGridContext = new ComputeServiceContextFactory().createContext(provider, - identity, credential).getProviderSpecificContext(); - } -} diff --git a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java b/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java deleted file mode 100644 index 38208116f7..0000000000 --- a/sandbox-apis/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.libvirt.compute; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.ComputeServiceContextFactory; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.Template; -import org.jclouds.libvirt.compute.LibvirtComputeServiceContextSpec; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live") -public class LibvirtExperimentLiveTest { - protected String provider = "libvirt"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; - - @BeforeClass - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); - credential = System.getProperty("test." + provider + ".credential"); - endpoint = System.getProperty("test." + provider + ".endpoint"); - apiVersion = System.getProperty("test." + provider + ".api-version"); - } - - @Test - public void testAndExperiment() { - ComputeServiceContext context = null; - try { - context = new ComputeServiceContextFactory().createContext(new LibvirtComputeServiceContextSpec( - "qemu:///system", "identity", "credential")); - - - /* - * /* System.out.println("images " + context.getComputeService().listImages()); - * System.out.println("nodes " + context.getComputeService().listNodes()); - * System.out.println("hardware profiles " + - * context.getComputeService().listHardwareProfiles()); - */ - - -/* Template defaultTemplate = context.getComputeService().templateBuilder() - .hardwareId("d106ae67-5a1b-8f91-b311-83c93bcb0a1f").imageId("1") //.locationId("") - .build();*/ - - - /* - * We will probably make a default template out of properties at some point You can control - * the default template via overriding a method in standalonecomputeservicexontextmodule - */ - - Set nodeMetadataSet = context.getComputeService().createNodesInGroup("tty", 1); - for (NodeMetadata nodeMetadata : nodeMetadataSet) { - /* - * context.getComputeService().suspendNode(nodeMetadata.getId()); - * context.getComputeService().resumeNode(nodeMetadata.getId()); - */ - context.getComputeService().destroyNode(nodeMetadata.getId()); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (context != null) - context.close(); - } - } - -} diff --git a/sandbox-apis/libvirt/src/test/resources/log4j.xml b/sandbox-apis/libvirt/src/test/resources/log4j.xml deleted file mode 100644 index 9620794be8..0000000000 --- a/sandbox-apis/libvirt/src/test/resources/log4j.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-apis/nirvanix/README.txt b/sandbox-apis/nirvanix/README.txt deleted file mode 100644 index a5e68dcb8b..0000000000 --- a/sandbox-apis/nirvanix/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -# -# The jclouds provider for the Nirvanix Storage Delivery Network (http://www.nirvanix.com/products-services/storage-delivery-network/index.aspx). -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. \ No newline at end of file diff --git a/sandbox-apis/nirvanix/pom.xml b/sandbox-apis/nirvanix/pom.xml deleted file mode 100644 index 11b6481a60..0000000000 --- a/sandbox-apis/nirvanix/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - nirvanix - jclouds nirvanix storage delivery network core - jclouds Core components to access nirvanix nirvanix - bundle - - - - - jclouds-sona-snapshots-nexus - https://oss.sonatype.org/content/repositories/snapshots - - true - - - - - - http://services.nirvanix.com - 2.5.6 - - FIXME - FIXME - - org.jclouds.nirvanix.sdn*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - org.jclouds - jclouds-core - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - log4j - log4j - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.nirvanix.endpoint} - ${test.nirvanix.api-version} - ${test.nirvanix.build-version} - ${test.nirvanix.identity} - ${test.nirvanix.credential} - - - - - - - - - - - diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java deleted file mode 100644 index 985654a82a..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAsyncClient.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import java.net.URI; -import java.util.Map; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; - -import org.jclouds.blobstore.binders.BindBlobToMultipartForm; -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.nirvanix.sdn.binders.BindMetadataToQueryParams; -import org.jclouds.nirvanix.sdn.domain.UploadInfo; -import org.jclouds.nirvanix.sdn.filters.AddSessionTokenToRequest; -import org.jclouds.nirvanix.sdn.filters.InsertUserContextIntoPath; -import org.jclouds.nirvanix.sdn.functions.ParseMetadataFromJsonResponse; -import org.jclouds.nirvanix.sdn.functions.ParseUploadInfoFromJsonResponse; -import org.jclouds.nirvanix.sdn.reference.SDNQueryParams; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.OverrideRequestFilters; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SkipEncoding; - -import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.Provides; - -/** - * Provides asynchronous access to Nirvanix SDN resources via their REST API. - *

- * - * @see SDNClient - * @see - * @author Adrian Cole - */ -@RequestFilters(AddSessionTokenToRequest.class) -@SkipEncoding( { '/', ':' }) -@QueryParams(keys = SDNQueryParams.OUTPUT, values = "json") -public interface SDNAsyncClient { - @Provides - public Blob newBlob(); - - /** - * @see SDNClient#getStorageNode - */ - @GET - @Path("/ws/IMFS/GetStorageNode.ashx") - @ResponseParser(ParseUploadInfoFromJsonResponse.class) - ListenableFuture getStorageNode( - @QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath, - @QueryParam(SDNQueryParams.SIZEBYTES) long size); - - /** - * @see SDNClient#upload - */ - @POST - @Path("/Upload.ashx") - ListenableFuture upload(@EndpointParam URI endpoint, - @QueryParam(SDNQueryParams.UPLOADTOKEN) String uploadToken, - @QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath, - @BinderParam(BindBlobToMultipartForm.class) Blob blob); - - /** - * @see SDNClient#setMetadata - */ - @GET - @Path("/ws/Metadata/SetMetadata.ashx") - @QueryParams(keys = SDNQueryParams.PATH, values = "{path}") - ListenableFuture setMetadata(@PathParam("path") String path, - @BinderParam(BindMetadataToQueryParams.class) Map metadata); - - /** - * @see SDNClient#getMetadata - */ - @GET - @Path("/ws/Metadata/GetMetadata.ashx") - @ResponseParser(ParseMetadataFromJsonResponse.class) - @QueryParams(keys = SDNQueryParams.PATH, values = "{path}") - ListenableFuture> getMetadata(@PathParam("path") String path); - - /** - * @see SDNClient#getFile - */ - @GET - @Path("/{path}") - @OverrideRequestFilters - @RequestFilters(InsertUserContextIntoPath.class) - ListenableFuture getFile(@PathParam("path") String path); - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java deleted file mode 100644 index 33d771016b..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClient.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; - -import org.jclouds.nirvanix.sdn.functions.ParseSessionTokenFromJsonResponse; -import org.jclouds.nirvanix.sdn.reference.SDNQueryParams; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.ResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Nirvanix SDN resources via their REST API. - *

- * - * @see - * @author Adrian Cole - */ -@QueryParams(keys = SDNQueryParams.OUTPUT, values = "json") -public interface SDNAuthAsyncClient { - - public interface AuthenticationResponse { - @SessionToken - String getSessionToken(); - } - - @GET - @ResponseParser(ParseSessionTokenFromJsonResponse.class) - @Path("/ws/Authentication/Login.ashx") - ListenableFuture authenticate(@QueryParam(SDNQueryParams.APPKEY) String appKey, - @QueryParam(SDNQueryParams.USERNAME) String user, - @QueryParam(SDNQueryParams.PASSWORD) String password); -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java deleted file mode 100644 index 8315ccd98d..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.concurrent.Timeout; -import org.jclouds.nirvanix.sdn.domain.UploadInfo; - -import com.google.inject.Provides; - -/** - * Provides access to Nirvanix SDN resources via their REST API. - *

- * - * @see - * @see SDNAsyncClient - * @author Adrian Cole - */ -@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) -public interface SDNClient { - @Provides - public Blob newBlob(); - - /** - * The GetStorageNode method is used to determine which storage node a file should be uploaded - * to. It returns the host to upload to and an Upload Token that will be used to authenticate. - */ - UploadInfo getStorageNode(String folderPath, long size); - - void upload(URI endpoint, String uploadToken, String folderPath, Blob blob); - - /** - * The SetMetadata method is used to set specified metadata for a file or folder. - */ - void setMetadata(String path, Map metadata); - - /** - * The GetMetadata method is used to retrieve all metadata from a file or folder. - */ - Map getMetadata(String path); - - /** - * Get the contents of a file - */ - String getFile(String path); - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java deleted file mode 100644 index 726880e456..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNContextBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.nirvanix.sdn.config.SDNAuthRestClientModule; -import org.jclouds.nirvanix.sdn.config.SDNRestClientModule; -import org.jclouds.rest.RestContextBuilder; - -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class SDNContextBuilder extends RestContextBuilder { - - public SDNContextBuilder(Properties props) { - super(SDNClient.class, SDNAsyncClient.class, props); - } - - @Override - protected void addClientModule(List modules) { - modules.add(new SDNAuthRestClientModule()); - modules.add(new SDNRestClientModule()); - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java deleted file mode 100644 index 8825e7b901..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SDNPropertiesBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import java.util.Properties; - -import org.jclouds.Constants; -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in SDN Clients - * - * @author Adrian Cole - */ -public class SDNPropertiesBuilder extends PropertiesBuilder { - - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(Constants.PROPERTY_API_VERSION, "2.5.6"); - properties.setProperty(Constants.PROPERTY_ENDPOINT, "http://services.nirvanix.com"); - return properties; - } - - public SDNPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java deleted file mode 100644 index e8fc11968f..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/SessionToken.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a SDN resource. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface SessionToken { - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java deleted file mode 100644 index 6de711a332..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParams.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.binders; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.inject.Inject; -import javax.inject.Provider; -import javax.inject.Singleton; -import javax.ws.rs.core.UriBuilder; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.utils.ModifyRequest; -import org.jclouds.rest.Binder; - -import com.google.common.collect.Lists; - -@Singleton -public class BindMetadataToQueryParams implements Binder { - private final Provider builder; - - @Inject - BindMetadataToQueryParams(Provider builder) { - this.builder = builder; - } - - @SuppressWarnings("unchecked") - public R bindToRequest(R request, Object input) { - checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Maps!"); - Map userMetadata = (Map) input; - List metadata = Lists.newArrayList(); - for (Entry entry : userMetadata.entrySet()) { - metadata.add(String.format("%s:%s", entry.getKey().toLowerCase(), entry.getValue())); - } - return ModifyRequest.addQueryParam(request, "metadata", metadata, builder.get()); - } -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java deleted file mode 100644 index 38d7499a0d..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNAuthRestClientModule.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.config; - -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.Constants; -import org.jclouds.http.RequiresHttp; -import org.jclouds.nirvanix.sdn.SDNAuthAsyncClient; -import org.jclouds.nirvanix.sdn.SessionToken; -import org.jclouds.nirvanix.sdn.reference.SDNConstants; -import org.jclouds.rest.AsyncClientFactory; - -import com.google.common.base.Splitter; -import com.google.common.collect.Lists; -import com.google.inject.AbstractModule; -import com.google.inject.Provides; - -/** - * Configures the SDN authentication service connection, including logging and http transport. - * - * @author Adrian Cole - */ -@RequiresHttp -public class SDNAuthRestClientModule extends AbstractModule { - - @Override - protected void configure() { - } - - @Provides - @Singleton - @Named(SDNConstants.PROPERTY_SDN_APPKEY) - public String credentials1(@Named(Constants.PROPERTY_IDENTITY) String identity) { - List parts = Lists.newArrayList(Splitter.on('/').split(identity)); - if (parts.size() != 3) { - throw new IllegalArgumentException("identity syntax is appkey/appname/username"); - } - return parts.get(0); - } - - @Provides - @Singleton - @Named(SDNConstants.PROPERTY_SDN_APPNAME) - public String credentials2(@Named(Constants.PROPERTY_IDENTITY) String identity) { - List parts = Lists.newArrayList(Splitter.on('/').split(identity)); - if (parts.size() != 3) { - throw new IllegalArgumentException("identity syntax is appkey/appname/username"); - } - return parts.get(1); - } - - @Provides - @Singleton - @Named(SDNConstants.PROPERTY_SDN_USERNAME) - public String credentials3(@Named(Constants.PROPERTY_IDENTITY) String identity) { - List parts = Lists.newArrayList(Splitter.on('/').split(identity)); - if (parts.size() != 3) { - throw new IllegalArgumentException("identity syntax is appkey/appname/username"); - } - return parts.get(2); - } - - @Provides - @SessionToken - protected String provideSessionToken(AsyncClientFactory factory, - @Named(SDNConstants.PROPERTY_SDN_APPKEY) String appKey, - @Named(SDNConstants.PROPERTY_SDN_USERNAME) String username, - @Named(Constants.PROPERTY_CREDENTIAL) String password) throws InterruptedException, - ExecutionException, TimeoutException { - return factory.create(SDNAuthAsyncClient.class).authenticate(appKey, username, password).get( - 20, TimeUnit.SECONDS); - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java deleted file mode 100644 index 8582ae8ce8..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/config/SDNRestClientModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.config; - -import org.jclouds.blobstore.config.BlobStoreObjectModule; -import org.jclouds.http.RequiresHttp; -import org.jclouds.nirvanix.sdn.SDNAsyncClient; -import org.jclouds.nirvanix.sdn.SDNClient; -import org.jclouds.rest.config.RestClientModule; - -/** - * Configures the SDN authentication service connection, including logging and http transport. - * - * @author Adrian Cole - */ -@RequiresHttp -public class SDNRestClientModule extends RestClientModule { - - public SDNRestClientModule() { - super(SDNClient.class, SDNAsyncClient.class); - } - - @Override - protected void configure() { - install(new BlobStoreObjectModule()); - super.configure(); - } - - @Override - protected void bindRetryHandlers() { - // TODO retry on 401 by AuthenticateRequest.update() - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java deleted file mode 100644 index 8b6a1f0325..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/domain/UploadInfo.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.domain; - -import java.net.URI; - -public class UploadInfo { - private final String token; - private final URI host; - - public UploadInfo(String token, URI host) { - this.token = token; - this.host = host; - } - - public String getToken() { - return token; - } - - public URI getHost() { - return host; - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java deleted file mode 100644 index b0d7cdea4f..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequest.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.filters; - -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; - -import javax.inject.Inject; -import javax.inject.Provider; -import javax.inject.Singleton; -import javax.ws.rs.core.UriBuilder; - -import com.google.commons.util.concurrent.Atomitcs; - -import org.jclouds.http.HttpException; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpRequestFilter; -import org.jclouds.http.utils.ModifyRequest; -import org.jclouds.nirvanix.sdn.SessionToken; -import org.jclouds.nirvanix.sdn.reference.SDNQueryParams; - -/** - * Adds the Session Token to the request. This will update the Session Token before 20 minutes is - * up. - * - * @author Adrian Cole - * - */ -@Singleton -public class AddSessionTokenToRequest implements HttpRequestFilter { - - private final Provider authTokenProvider; - private final Provider builder; - - public final long BILLION = 1000000000; - public final long MINUTES = 60 * BILLION; - - private final AtomicReference authToken; - private final AtomicLong trigger = new AtomicLong(0); - - /** - * Start the time update service. Nirvanix clocks need to be 20 minutes of the session token. - * This is not performed per-request, as creation of the token is a slow, synchronized command. - */ - synchronized void updateIfTimeOut() { - - if (trigger.get() - System.nanoTime() <= 0) { - createNewToken(); - } - - } - - // this is a hotspot when submitted concurrently, so be lazy. - // session tokens expire in 20 minutes of no use, but let's be a little paranoid and go 19 - public String createNewToken() { - authToken.set(authTokenProvider.get()); - trigger.set(System.nanoTime() + System.nanoTime() + 19 * MINUTES); - return authToken.get(); - - } - - public String getSessionToken() { - updateIfTimeOut(); - return authToken.get(); - } - - @Inject - public AddSessionTokenToRequest(@SessionToken Provider authTokenProvider, Provider builder) { - this.builder = builder; - this.authTokenProvider = authTokenProvider; - authToken = Atomics.newReference(); - } - - @Override - public HttpRequest filter(HttpRequest request) throws HttpException { - return ModifyRequest.addQueryParam(request, SDNQueryParams.SESSIONTOKEN, getSessionToken(), builder.get()); - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java deleted file mode 100644 index ae083546fb..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPath.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.filters; - -import java.net.URI; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Provider; -import javax.inject.Singleton; -import javax.ws.rs.core.UriBuilder; - -import org.jclouds.http.HttpException; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpRequestFilter; -import org.jclouds.nirvanix.sdn.reference.SDNConstants; - -/** - * Adds the Session Token to the request. This will update the Session Token before 20 minutes is - * up. - * - * @author Adrian Cole - * - */ -@Singleton -public class InsertUserContextIntoPath implements HttpRequestFilter { - - private final AddSessionTokenToRequest sessionManager; - private final String pathPrefix; - private final Provider builder; - - @Inject - public InsertUserContextIntoPath(AddSessionTokenToRequest sessionManager, - @Named(SDNConstants.PROPERTY_SDN_APPNAME) String appname, - @Named(SDNConstants.PROPERTY_SDN_USERNAME) String username, Provider builder) { - this.builder = builder; - this.sessionManager = sessionManager; - this.pathPrefix = String.format("/%s/%s/", appname, username); - } - - @Override - public HttpRequest filter(HttpRequest request) throws HttpException { - String sessionToken = sessionManager.getSessionToken(); - int prefixIndex = request.getEndpoint().getPath().indexOf(pathPrefix); - String path; - if (prefixIndex == -1) { // addToken - path = "/" + sessionToken + pathPrefix + request.getEndpoint().getPath().substring(1); - } else { // replace token - path = "/" + sessionToken + request.getEndpoint().getPath().substring(prefixIndex); - } - URI newEndpoint = builder.get().uri(request.getEndpoint()).replacePath(path).build(); - return request.toBuilder().endpoint(newEndpoint).build(); - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java deleted file mode 100644 index 5186fff2da..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponse.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.functions; - -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.ParseJson; - -import com.google.common.base.Function; -import com.google.common.collect.Maps; - -/** - * This parses a Map of Metadata from a Nirvanix response - * - * @author Adrian Cole - */ -@Singleton -public class ParseMetadataFromJsonResponse implements - Function> { - - private final ParseJson json; - - @Inject - ParseMetadataFromJsonResponse(ParseJson json) { - this.json = json; - } - - @Override - public Map apply(HttpResponse arg0) { - Response response = json.apply(arg0); - if (response.ResponseCode == null || response.ResponseCode != 0) - throw new RuntimeException("bad response code: " - + response.ResponseCode); - Map metadata = Maps.newHashMap(); - for (Map keyValue : response.Metadata) { - metadata.put(keyValue.get("Type"), keyValue.get("Value")); - } - return metadata; - } - - private static class Response { - Integer ResponseCode; - List> Metadata; - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java deleted file mode 100644 index 09316bb9a3..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponse.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.ParseJson; - -import com.google.common.base.Function; - -/** - * This parses the Nirvanix SessionToken from a gson string. - * - * @author Adrian Cole - */ -@Singleton -public class ParseSessionTokenFromJsonResponse implements - Function { - - private final ParseJson json; - - @Inject - ParseSessionTokenFromJsonResponse(ParseJson json) { - this.json = json; - } - - @Override - public String apply(HttpResponse arg0) { - Response response = json.apply(arg0); - if (response.ResponseCode == null || response.ResponseCode != 0) - throw new RuntimeException("bad response code: " - + response.ResponseCode); - return response.SessionToken; - } - - private static class Response { - Integer ResponseCode; - String SessionToken; - } -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java deleted file mode 100644 index adf1b70a61..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.functions; - -import java.net.URI; -import java.util.Map; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.nirvanix.sdn.domain.UploadInfo; - -import com.google.common.base.Function; - -/** - * This parses the Nirvanix Upload host and token from a gson string. - * - * @see UploadInfo - * @author Adrian Cole - */ -@Singleton -public class ParseUploadInfoFromJsonResponse implements - Function { - - private final ParseJson json; - - @Inject - ParseUploadInfoFromJsonResponse(ParseJson json) { - this.json = json; - } - - @Override - public UploadInfo apply(HttpResponse arg0) { - Response response = json.apply(arg0); - if (response.ResponseCode == null || response.ResponseCode != 0) - throw new RuntimeException("bad response code: " - + response.ResponseCode); - return new UploadInfo(response.GetStorageNode.get("UploadToken"), URI - .create("https://" + response.GetStorageNode.get("UploadHost"))); - } - - private static class Response { - Integer ResponseCode; - Map GetStorageNode; - } - -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java deleted file mode 100644 index 4830f0c298..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNConstants.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.reference; - -/** - * Configuration properties and constants used in SDN connections. - * - * @author Adrian Cole - */ -public interface SDNConstants { - public static final String PROPERTY_SDN_USERNAME = "jclouds.nirvanix.sdn.username"; - public static final String PROPERTY_SDN_APPKEY = "jclouds.nirvanix.sdn.appkey"; - public static final String PROPERTY_SDN_APPNAME = "jclouds.nirvanix.sdn.appname"; -} diff --git a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java b/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java deleted file mode 100644 index c348a685ef..0000000000 --- a/sandbox-apis/nirvanix/src/main/java/org/jclouds/nirvanix/sdn/reference/SDNQueryParams.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.reference; - -/** - * Query parameters common to SDN apis. - * - * @see - * @author Adrian Cole - * - */ -public interface SDNQueryParams { - public static final String USERNAME = "username"; - public static final String PASSWORD = "password"; - public static final String APPKEY = "appKey"; - public static final String OUTPUT = "output"; - public static final String SESSIONTOKEN = "sessionToken"; - public static final String DESTFOLDERPATH = "destFolderPath"; - public static final String PATH = "path"; - public static final String SIZEBYTES = "sizeBytes"; - public static final String UPLOADTOKEN = "uploadToken"; -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java deleted file mode 100644 index b4620aebd6..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAsyncClientTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URI; -import java.util.Map; -import java.util.Properties; - -import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest; -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.http.functions.ReturnStringIf2xx; -import org.jclouds.nirvanix.sdn.config.SDNRestClientModule; -import org.jclouds.nirvanix.sdn.filters.AddSessionTokenToRequest; -import org.jclouds.nirvanix.sdn.filters.InsertUserContextIntoPath; -import org.jclouds.nirvanix.sdn.functions.ParseMetadataFromJsonResponse; -import org.jclouds.nirvanix.sdn.functions.ParseUploadInfoFromJsonResponse; -import org.jclouds.nirvanix.sdn.reference.SDNConstants; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; - -/** - * Tests behavior of {@code JaxrsAnnotationProcessor} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "sdn.SDNClient") -public class SDNAsyncClientTest extends RestClientTest { - - public void testGetStorageNode() throws SecurityException, NoSuchMethodException, IOException { - Method method = SDNAsyncClient.class.getMethod("getStorageNode", String.class, long.class); - GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies", 734859264); - - assertRequestLineEquals( - request, - "GET http://services.nirvanix.com/ws/IMFS/GetStorageNode.ashx?output=json&destFolderPath=adriansmovies&sizeBytes=734859264 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseUploadInfoFromJsonResponse.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testUpload() throws SecurityException, NoSuchMethodException, IOException { - Method method = SDNAsyncClient.class.getMethod("upload", URI.class, String.class, String.class, Blob.class); - Blob blob = BindBlobToMultipartFormTest.TEST_BLOB; - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://uploader"), "token", "adriansmovies", - blob); - - assertRequestLineEquals(request, - "POST http://uploader/Upload.ashx?output=json&destFolderPath=adriansmovies&uploadToken=token HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - StringBuilder expects = new StringBuilder(); - expects.append("----JCLOUDS--\r\n"); - expects.append("Content-Disposition: form-data; name=\"hello\"\r\n"); - expects.append("Content-Type: text/plain\r\n\r\n"); - expects.append("hello\r\n"); - expects.append("----JCLOUDS----\r\n"); - - assertPayloadEquals(request, expects.toString(), "multipart/form-data; boundary=--JCLOUDS--", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testSetMetadata() throws SecurityException, NoSuchMethodException, IOException { - Method method = SDNAsyncClient.class.getMethod("setMetadata", String.class, Map.class); - GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies/sushi.avi", ImmutableMap.of("Chef", - "Kawasaki")); - - assertRequestLineEquals( - request, - "GET http://services.nirvanix.com/ws/Metadata/SetMetadata.ashx?output=json&path=adriansmovies/sushi.avi&metadata=chef:Kawasaki HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testGetMetadata() throws SecurityException, NoSuchMethodException, IOException { - Method method = SDNAsyncClient.class.getMethod("getMetadata", String.class); - GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies/sushi.avi"); - - assertRequestLineEquals(request, - "GET http://services.nirvanix.com/ws/Metadata/GetMetadata.ashx?output=json&path=adriansmovies/sushi.avi HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseMetadataFromJsonResponse.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testGetFile() throws SecurityException, NoSuchMethodException, IOException { - Method method = SDNAsyncClient.class.getMethod("getFile", String.class); - GeneratedHttpRequest request = processor.createRequest(method, "adriansmovies/sushi.avi"); - - assertRequestLineEquals(request, "GET http://services.nirvanix.com/adriansmovies/sushi.avi?output=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReturnStringIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), InsertUserContextIntoPath.class); - - } - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), AddSessionTokenToRequest.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - protected Module createModule() { - return new TestSDNRestClientModule(); - } - - @RequiresHttp - @ConfiguresRestClient - static class TestSDNRestClientModule extends SDNRestClientModule { - @Override - public void configure() { - bind(String.class).annotatedWith(SessionToken.class).toInstance("sessiontoken"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPKEY)).toInstance("appKey"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPNAME)).toInstance("appname"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_USERNAME)).toInstance("username"); - } - - } - - @Override - public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec("sdn", "user", "password", new Properties()); - } -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java deleted file mode 100644 index 3243ffd95f..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthAsyncClientTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import static org.jclouds.rest.RestContextFactory.contextSpec; - -import java.io.IOException; -import java.lang.reflect.Method; - -import org.jclouds.http.HttpRequest; -import org.jclouds.nirvanix.sdn.SDNAuthenticationLiveTest.SDNAuthClient; -import org.jclouds.nirvanix.sdn.functions.ParseSessionTokenFromJsonResponse; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; - -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code JaxrsAnnotationProcessor} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "sdn.SDNAuthentication") -public class SDNAuthAsyncClientTest extends RestClientTest { - - public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException { - Method method = SDNAuthAsyncClient.class.getMethod("authenticate", String.class, String.class, String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "apple", "foo", "bar"); - assertRequestLineEquals(httpRequest, - "GET http://localhost:8080/ws/Authentication/Login.ashx?output=json&appKey=apple&password=bar&username=foo HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseSessionTokenFromJsonResponse.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); - } - - @Override - protected void checkFilters(HttpRequest request) { - - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - public RestContextSpec createContextSpec() { - return contextSpec("test", "http://localhost:8080", "1", "", "identity", "credential", SDNAuthClient.class, - SDNAuthAsyncClient.class); - } - -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java deleted file mode 100644 index 849e8b44c1..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNAuthenticationLiveTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.rest.RestContextFactory.contextSpec; -import static org.jclouds.rest.RestContextFactory.createContextBuilder; -import static org.testng.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.MoreExecutors; -import org.jclouds.concurrent.Timeout; -import org.jclouds.concurrent.config.ExecutorServiceModule; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextSpec; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.inject.Module; - -/** - * Tests behavior of {@code SDNAuthentication} - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "sdn.SDNAuthenticationLiveTest") -public class SDNAuthenticationLiveTest { - - private RestContext context; - - @Timeout(duration = 10, timeUnit = TimeUnit.SECONDS) - public interface SDNAuthClient { - - String authenticate(String appKey, String user, String password); - } - - private String credential; - private String identity; - - @Test - public void testAuthentication() throws Exception { - ArrayList list = Lists.newArrayList(Splitter.on('/').split(credential)); - String response = context.getApi().authenticate(list.get(0), list.get(1), identity); - assertNotNull(response); - } - - @BeforeClass - void setupFactory() { - - String endpoint = "http://services.nirvanix.com"; - identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); - credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); - - RestContextSpec contextSpec = contextSpec("test", endpoint, "1", "", identity, - credential, SDNAuthClient.class, SDNAuthAsyncClient.class); - - context = createContextBuilder( - contextSpec, - ImmutableSet. of(new Log4JLoggingModule(), new ExecutorServiceModule(MoreExecutors - .sameThreadExecutor(), MoreExecutors.sameThreadExecutor()))).buildContext(); - } -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java deleted file mode 100644 index 3daa9fb8b2..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; - -import java.io.IOException; -import java.net.URI; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; -import org.jclouds.encryption.internal.Base64; -import org.jclouds.io.Payloads; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.nirvanix.sdn.domain.UploadInfo; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Tests behavior of {@code SDNClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "sdn.SDNClientLiveTest") -public class SDNClientLiveTest { - - protected SDNClient connection; - private String containerPrefix = BaseBlobStoreIntegrationTest.CONTAINER_PREFIX; - - URI container1; - URI container2; - private RestContext context; - - @BeforeGroups(groups = { "live" }) - public void setupClient() { - - String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); - String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); - - this.context = new RestContextFactory().createContext("sdn", identity, credential, ImmutableSet - . of(new Log4JLoggingModule())); - this.connection = context.getApi(); - } - - public void testUploadToken() throws InterruptedException, ExecutionException, TimeoutException, IOException { - String containerName = containerPrefix + ".testObjectOperations"; - long size = 1024; - - UploadInfo uploadInfo = connection.getStorageNode(containerName, size); - assertNotNull(uploadInfo.getHost()); - assertNotNull(uploadInfo.getToken()); - - Blob blob = connection.newBlob(); - blob.getMetadata().setName("test.txt"); - blob.setPayload("value"); - Payloads.calculateMD5(blob); - - byte[] md5 = blob.getMetadata().getContentMetadata().getContentMD5(); - connection.upload(uploadInfo.getHost(), uploadInfo.getToken(), containerName, blob); - - Map metadata = connection.getMetadata(containerName + "/test.txt"); - assertEquals(metadata.get("MD5"), Base64.encodeBytes(md5)); - - String content = connection.getFile(containerName + "/test.txt"); - assertEquals(content, "value"); - - metadata = ImmutableMap.of("chef", "sushi", "foo", "bar"); - connection.setMetadata(containerName + "/test.txt", metadata); - - metadata = connection.getMetadata(containerName + "/test.txt"); - assertEquals(metadata.get("MD5"), Base64.encodeBytes(md5)); - - } -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java deleted file mode 100644 index 6fa5ff494e..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.binders; - -import static org.easymock.classextension.EasyMock.createMock; -import static org.testng.Assert.assertEquals; - -import java.io.File; -import java.net.URI; - -import javax.inject.Provider; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.UriBuilder; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.sun.jersey.api.uri.UriBuilderImpl; - -/** - * Tests behavior of {@code BindMetadataToQueryParams} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "sdn.BindMetadataToQueryParamsTest") -public class BindMetadataToQueryParamsTest { - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testMustBeMap() { - BindMetadataToQueryParams binder = new BindMetadataToQueryParams(null); - HttpRequest request = new HttpRequest(HttpMethod.POST, URI.create("http://localhost"), new char[] { '/', ':' }); - binder.bindToRequest(request, new File("foo")); - } - - @Test - public void testCorrect() throws SecurityException, NoSuchMethodException { - - HttpRequest request = new HttpRequest("GET", URI.create("http://momma/"), new char[] { '/', ':' }); - - BindMetadataToQueryParams binder = new BindMetadataToQueryParams(new Provider() { - - @Override - public UriBuilder get() { - return new UriBuilderImpl(); - } - - }); - - request = binder.bindToRequest(request, ImmutableMap.of("imageName", "foo", "serverId", "2")); - - assertEquals(request.getRequestLine(), "GET http://momma/?metadata=imagename:foo&metadata=serverid:2 HTTP/1.1"); - - } - - @Test(expectedExceptions = { NullPointerException.class, IllegalStateException.class }) - public void testNullIsBad() { - BindMetadataToQueryParams binder = new BindMetadataToQueryParams(null); - GeneratedHttpRequest request = createMock(GeneratedHttpRequest.class); - binder.bindToRequest(request, null); - } -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java deleted file mode 100644 index fc02deceb9..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.filters; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URI; -import java.util.Properties; - -import javax.ws.rs.POST; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.nirvanix.sdn.SDNAsyncClient; -import org.jclouds.nirvanix.sdn.SDNClient; -import org.jclouds.nirvanix.sdn.SessionToken; -import org.jclouds.nirvanix.sdn.config.SDNRestClientModule; -import org.jclouds.nirvanix.sdn.reference.SDNConstants; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.google.inject.Key; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; - -@Test(groups = "unit", testName = "AddSessionTokenToRequestTest") -public class AddSessionTokenToRequestTest extends RestClientTest { - - private static interface TestService { - @POST - public void foo(@EndpointParam URI endpoint); - } - - @DataProvider - public Object[][] dataProvider() throws SecurityException, NoSuchMethodException { - - RestAnnotationProcessor factory = injector.getInstance(Key - .get(new TypeLiteral>() { - })); - - Method method = TestService.class.getMethod("foo", URI.class); - return new Object[][] { { factory.createRequest(method, new Object[] { URI.create("https://host:443") }) }, - { factory.createRequest(method, new Object[] { URI.create("https://host/path") }) }, - { factory.createRequest(method, new Object[] { URI.create("https://host/?query") }) - - } }; - } - - @Test(dataProvider = "dataProvider") - public void testRequests(HttpRequest request) { - String token = filter.getSessionToken(); - String query = request.getEndpoint().getQuery(); - request = filter.filter(request); - assertEquals(request.getEndpoint().getQuery(), query == null ? "sessionToken=" + token : query + "&sessionToken=" - + token); - } - - @Test - void testUpdatesOnlyOncePerSecond() throws NoSuchMethodException, InterruptedException { - String token = filter.getSessionToken(); - for (int i = 0; i < 10; i++) - filter.updateIfTimeOut(); - assert token.equals(filter.getSessionToken()); - } - - @Override - protected void checkFilters(HttpRequest request) { - } - - private AddSessionTokenToRequest filter; - - @BeforeClass - @Override - protected void setupFactory() throws IOException { - super.setupFactory(); - filter = injector.getInstance(AddSessionTokenToRequest.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - protected Module createModule() { - return new TestSDNRestClientModule(); - } - - @RequiresHttp - @ConfiguresRestClient - static class TestSDNRestClientModule extends SDNRestClientModule { - @Override - public void configure() { - bind(String.class).annotatedWith(SessionToken.class).toInstance("sessiontoken"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPKEY)).toInstance("appKey"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPNAME)).toInstance("appname"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_USERNAME)).toInstance("username"); - } - - } - - @Override - public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec("sdn", "user", "password", new Properties()); - } -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java deleted file mode 100644 index 3d278d6a85..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.filters; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URI; -import java.util.Properties; - -import javax.ws.rs.POST; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.nirvanix.sdn.SDNAsyncClient; -import org.jclouds.nirvanix.sdn.SDNClient; -import org.jclouds.nirvanix.sdn.SessionToken; -import org.jclouds.nirvanix.sdn.config.SDNRestClientModule; -import org.jclouds.nirvanix.sdn.reference.SDNConstants; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.base.Throwables; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; - -@Test(groups = "unit", singleThreaded = true, testName = "sdn.InsertUserContextIntoPathTest") -// sequential as easymock isn't threadsafe -public class InsertUserContextIntoPathTest extends RestClientTest { - - private Method method; - - public void testRequestInvalid() { - GeneratedHttpRequest request = processor.createRequest(method, URI.create("https://host/path")); - request = filter.filter(request); - request = filter.filter(request); - assertEquals(request.getEndpoint().getPath(), "/sessiontoken/appname/username/path"); - assertEquals(request.getEndpoint().getHost(), "host"); - } - - public void testRequestNoSession() { - GeneratedHttpRequest request = processor.createRequest(method, URI.create("https://host/path")); - request = filter.filter(request); - assertEquals(request.getEndpoint().getPath(), "/sessiontoken/appname/username/path"); - assertEquals(request.getEndpoint().getHost(), "host"); - } - - public void testRequestAlreadyHasSession() { - GeneratedHttpRequest request = processor.createRequest(method, URI.create("https://host/sessiontoken/appname/username/path")); - request = filter.filter(request); - assertEquals(request.getEndpoint().getPath(), "/sessiontoken/appname/username/path"); - assertEquals(request.getEndpoint().getHost(), "host"); - } - - private InsertUserContextIntoPath filter; - - @BeforeClass - @Override - protected void setupFactory() throws IOException { - super.setupFactory(); - filter = injector.getInstance(InsertUserContextIntoPath.class); - try { - method = TestService.class.getMethod("foo", URI.class); - } catch (Exception e) { - Throwables.propagate(e); - } - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - protected Module createModule() { - return new TestSDNRestClientModule(); - } - - @RequiresHttp - @ConfiguresRestClient - static class TestSDNRestClientModule extends SDNRestClientModule { - @Override - public void configure() { - bind(String.class).annotatedWith(SessionToken.class).toInstance("sessiontoken"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPKEY)).toInstance("appKey"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPNAME)).toInstance("appname"); - bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_USERNAME)).toInstance("username"); - } - - } - - @Override - public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec("sdn", "user", "password", new Properties()); - } - - @Override - protected void checkFilters(HttpRequest request) { - - } -} - -interface TestService { - @POST - public void foo(@EndpointParam URI endpoint); -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java deleted file mode 100644 index 844c050f44..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.UnknownHostException; -import java.util.Map; - -import org.jclouds.http.HttpResponse; -import org.jclouds.io.Payloads; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * Tests behavior of {@code ParseMetadataFromJsonResponse} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "sdn.ParseMetadataFromJsonResponseTest") -public class ParseMetadataFromJsonResponseTest { - - Injector i = Guice.createInjector(new GsonModule()); - - public void testApplyInputStreamDetails() throws UnknownHostException { - InputStream is = getClass().getResourceAsStream("/metadata.json"); - - ParseMetadataFromJsonResponse parser = i.getInstance(ParseMetadataFromJsonResponse.class); - Map response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - assertEquals(response, ImmutableMap.of("MD5", "IGPBYI1uC6+AJJxC4r5YBA==", "test", "1")); - } -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java deleted file mode 100644 index 0126459c19..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.UnknownHostException; - -import org.jclouds.http.HttpResponse; -import org.jclouds.io.Payloads; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * Tests behavior of {@code ParseSessionTokenFromJsonResponse} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "sdn.ParseSessionTokenFromJsonResponseTest") -public class ParseSessionTokenFromJsonResponseTest { - - Injector i = Guice.createInjector(new GsonModule()); - - public void testApplyInputStreamDetails() throws UnknownHostException { - InputStream is = getClass().getResourceAsStream("/login.json"); - - ParseSessionTokenFromJsonResponse parser = i.getInstance(ParseSessionTokenFromJsonResponse.class); - String response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - assertEquals(response, "e4b08449-4501-4b7a-af6a-d4e1e1bd7919"); - } - -} diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java deleted file mode 100644 index 3205bbbd61..0000000000 --- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.nirvanix.sdn.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.URI; -import java.net.UnknownHostException; - -import org.jclouds.http.HttpResponse; -import org.jclouds.io.Payloads; -import org.jclouds.json.config.GsonModule; -import org.jclouds.nirvanix.sdn.domain.UploadInfo; -import org.testng.annotations.Test; - -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * Tests behavior of {@code ParseUploadInfoFromJsonResponse} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "sdn.ParseUploadInfoFromJsonResponse") -public class ParseUploadInfoFromJsonResponseTest { - - Injector i = Guice.createInjector(new GsonModule()); - - public void testApplyInputStreamDetails() throws UnknownHostException { - InputStream is = getClass().getResourceAsStream("/authtoken.json"); - - ParseUploadInfoFromJsonResponse parser = i.getInstance(ParseUploadInfoFromJsonResponse.class); - UploadInfo response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - assertEquals(response.getHost(), URI.create("https://node1.nirvanix.com")); - assertEquals(response.getToken(), "siR-ALYd~BEcJ8GR2tE~oX3SEHO8~2WXKT5xjFk~YLS5OvJyHI21TN34rQ"); - } - -} diff --git a/sandbox-apis/nirvanix/src/test/resources/authtoken.json b/sandbox-apis/nirvanix/src/test/resources/authtoken.json deleted file mode 100644 index 7e258890b7..0000000000 --- a/sandbox-apis/nirvanix/src/test/resources/authtoken.json +++ /dev/null @@ -1 +0,0 @@ -{"ResponseCode":0,"GetStorageNode":{"UploadHost":"node1.nirvanix.com","UploadToken":"siR-ALYd~BEcJ8GR2tE~oX3SEHO8~2WXKT5xjFk~YLS5OvJyHI21TN34rQ"}} \ No newline at end of file diff --git a/sandbox-apis/nirvanix/src/test/resources/log4j.xml b/sandbox-apis/nirvanix/src/test/resources/log4j.xml deleted file mode 100644 index 0e2c1b2868..0000000000 --- a/sandbox-apis/nirvanix/src/test/resources/log4j.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-apis/nirvanix/src/test/resources/login.json b/sandbox-apis/nirvanix/src/test/resources/login.json deleted file mode 100644 index 33f4833ec3..0000000000 --- a/sandbox-apis/nirvanix/src/test/resources/login.json +++ /dev/null @@ -1 +0,0 @@ -{"ResponseCode":0,"SessionToken":"e4b08449-4501-4b7a-af6a-d4e1e1bd7919"} \ No newline at end of file diff --git a/sandbox-apis/nirvanix/src/test/resources/metadata.json b/sandbox-apis/nirvanix/src/test/resources/metadata.json deleted file mode 100644 index c3a66ae20d..0000000000 --- a/sandbox-apis/nirvanix/src/test/resources/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"ResponseCode":0,"Metadata":[{"Type":"MD5","Value":"IGPBYI1uC6+AJJxC4r5YBA=="},{"Type":"test","Value":"1"}]} \ No newline at end of file diff --git a/sandbox-apis/pcs/README.txt b/sandbox-apis/pcs/README.txt deleted file mode 100644 index 4bc91fa29b..0000000000 --- a/sandbox-apis/pcs/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -# -# The jclouds provider for Mezeo Cloud Storage (http://www.mezeo.com/the-platform). -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. \ No newline at end of file diff --git a/sandbox-apis/pcs/pom.xml b/sandbox-apis/pcs/pom.xml deleted file mode 100644 index a12bfb6888..0000000000 --- a/sandbox-apis/pcs/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.api - pcs - jclouds mezeo cloud storage platform core - jclouds Core components to access mezeo pcs2 - bundle - - - - - jclouds-sona-snapshots-nexus - https://oss.sonatype.org/content/repositories/snapshots - - true - - - - - - FIXME - 2 - - FIXME - FIXME - - org.jclouds.mezeo.pcs*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - org.jclouds - jclouds-core - ${project.version} - - - org.jclouds - jclouds-blobstore - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - log4j - log4j - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.pcs.endpoint} - ${test.pcs.api-version} - ${test.pcs.build-version} - ${test.pcs.identity} - ${test.pcs.credential} - - - - - - - - - - - diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java deleted file mode 100644 index 85931d05b1..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import java.io.InputStream; -import java.net.URI; -import java.util.Map; - -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; - -import org.jclouds.blobstore.functions.ReturnNullOnKeyNotFound; -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.mezeo.pcs.binders.BindContainerNameToXmlPayload; -import org.jclouds.mezeo.pcs.binders.BindFileInfoToXmlPayload; -import org.jclouds.mezeo.pcs.binders.BindPCSFileToMultipartForm; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.mezeo.pcs.endpoints.RootContainer; -import org.jclouds.mezeo.pcs.functions.AddMetadataItemIntoMap; -import org.jclouds.mezeo.pcs.options.PutBlockOptions; -import org.jclouds.mezeo.pcs.xml.ContainerHandler; -import org.jclouds.mezeo.pcs.xml.FileHandler; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Endpoint; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.ExceptionParser; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.rest.binders.BindToStringPayload; -import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Mezeo PCS via their REST API. - *

- * - * @see PCSClient - * @see - * @author Adrian Cole - */ -@SkipEncoding('/') -@RequestFilters(BasicAuthentication.class) -public interface PCSAsyncClient { - PCSFile newFile(); - - /** - * @see PCSAsyncClient#list() - */ - @GET - @XMLResponseParser(ContainerHandler.class) - @Headers(keys = "X-Cloud-Depth", values = "2") - @Endpoint(RootContainer.class) - ListenableFuture list(); - - /** - * @see PCSAsyncClient#list(URI) - */ - @GET - @XMLResponseParser(ContainerHandler.class) - @Headers(keys = "X-Cloud-Depth", values = "2") - ListenableFuture list(@EndpointParam URI container); - - /** - * @see PCSAsyncClient#createContainer - */ - @POST - @Path("/contents") - @Endpoint(RootContainer.class) - @Produces("application/vnd.csp.container-info+xml") - ListenableFuture createContainer(@BinderParam(BindContainerNameToXmlPayload.class) String container); - - /** - * @see PCSAsyncClient#createContainer - */ - @POST - @Path("/contents") - ListenableFuture createContainer(@EndpointParam URI parent, - @BinderParam(BindContainerNameToXmlPayload.class) String container); - - /** - * @see PCSAsyncClient#deleteContainer - */ - @DELETE - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture deleteContainer(@EndpointParam URI container); - - /** - * @see PCSAsyncClient#uploadFile - */ - @POST - @Path("/contents") - ListenableFuture uploadFile(@EndpointParam URI container, - @BinderParam(BindPCSFileToMultipartForm.class) PCSFile object); - - /** - * @see PCSAsyncClient#createFile - */ - @POST - @Path("/contents") - ListenableFuture createFile(@EndpointParam URI container, - @BinderParam(BindFileInfoToXmlPayload.class) PCSFile object); - - /** - * @see PCSAsyncClient#uploadBlock - */ - @PUT - @Path("/content") - ListenableFuture uploadBlock(@EndpointParam URI file, PCSFile object, PutBlockOptions... options); - - /** - * @see PCSAsyncClient#deleteFile - */ - @DELETE - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture deleteFile(@EndpointParam URI file); - - /** - * @see PCSAsyncClient#downloadFile - */ - @GET - @ExceptionParser(ReturnNullOnKeyNotFound.class) - @Path("/content") - ListenableFuture downloadFile(@EndpointParam URI file); - - /** - * @see PCSAsyncClient#getFileInfo - */ - @GET - @ExceptionParser(ReturnNullOnKeyNotFound.class) - @XMLResponseParser(FileHandler.class) - @Headers(keys = "X-Cloud-Depth", values = "2") - ListenableFuture getFileInfo(@EndpointParam URI file); - - /** - * @see PCSAsyncClient#putMetadataItem - */ - @PUT - @Path("/metadata/{key}") - ListenableFuture putMetadataItem(@EndpointParam URI resource, @PathParam("key") String key, - @BinderParam(BindToStringPayload.class) String value); - - /** - * @see PCSAsyncClient#addMetadataItemToMap - */ - @GET - @ResponseParser(AddMetadataItemIntoMap.class) - @Path("/metadata/{key}") - ListenableFuture addMetadataItemToMap(@EndpointParam URI resource, @PathParam("key") String key, - Map map); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java deleted file mode 100644 index 5087d814dc..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.Timeout; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.mezeo.pcs.options.PutBlockOptions; - -/** - * Provides access to Mezeo PCS via their REST API. - *

- * - * @see - * @author Adrian Cole - */ -@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) -public interface PCSClient { - PCSFile newFile(); - - ContainerList list(); - - ContainerList list(URI container); - - URI createContainer(String container); - - URI createContainer(URI parent, String container); - - void deleteContainer(URI container); - - URI uploadFile(URI container, PCSFile object); - - URI createFile(URI container, PCSFile object); - - void uploadBlock(URI file, PCSFile object, PutBlockOptions... options); - - void deleteFile(URI file); - - InputStream downloadFile(URI file); - - FileInfoWithMetadata getFileInfo(URI file); - - void putMetadataItem(URI resource, String key, String value); - - void addMetadataItemToMap(URI resource, String key, Map map); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java deleted file mode 100644 index 1da8fdae6a..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import java.net.URI; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; - -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.mezeo.pcs.endpoints.Contacts; -import org.jclouds.mezeo.pcs.endpoints.Metacontainers; -import org.jclouds.mezeo.pcs.endpoints.Projects; -import org.jclouds.mezeo.pcs.endpoints.Recyclebin; -import org.jclouds.mezeo.pcs.endpoints.RootContainer; -import org.jclouds.mezeo.pcs.endpoints.Shares; -import org.jclouds.mezeo.pcs.endpoints.Tags; -import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides URIs to PCS services via their REST API. - *

- * - * @author Adrian Cole - */ -@RequestFilters(BasicAuthentication.class) -public interface PCSCloudAsyncClient { - - public interface Response { - @RootContainer - URI getRootContainerUrl(); - - @Contacts - URI getContactsUrl(); - - @Shares - URI getSharesUrl(); - - @Projects - URI getProjectsUrl(); - - @Metacontainers - URI getMetacontainersUrl(); - - @Recyclebin - URI getRecyclebinUrl(); - - @Tags - URI getTagsUrl(); - } - - @GET - @XMLResponseParser(CloudXlinkHandler.class) - @Path("/v{jclouds.api-version}") - ListenableFuture authenticate(); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java deleted file mode 100644 index 878104e726..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.mezeo.pcs.config.PCSRestClientModule; -import org.jclouds.rest.RestContextBuilder; - -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class PCSContextBuilder extends RestContextBuilder { - - public PCSContextBuilder(Properties props) { - super(PCSClient.class, PCSAsyncClient.class, props); - } - - protected void addClientModule(List modules) { - modules.add(new PCSRestClientModule()); - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java deleted file mode 100644 index c90698adf2..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import static org.jclouds.Constants.PROPERTY_API_VERSION; - -import java.util.Properties; - -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in PCS Connections - * - * @author Adrian Cole - */ -public class PCSPropertiesBuilder extends PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_API_VERSION, "2"); - return properties; - } - - public PCSPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java deleted file mode 100644 index fe00cf4c26..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.binders; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.Binder; - -/** - * - * @author Adrian Cole - * - */ -@Singleton -public class BindContainerNameToXmlPayload implements Binder { - @Override - public R bindToRequest(R request, Object input) { - String container = String.format("%s", input); - request.setPayload(container); - return request; - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java deleted file mode 100644 index 9373b049f4..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.binders; - -import java.io.File; - -import javax.inject.Singleton; -import javax.ws.rs.core.HttpHeaders; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.utils.ModifyRequest; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.rest.Binder; - -import com.google.common.collect.ImmutableMultimap; - -/** - * - * @author Adrian Cole - * - */ -@Singleton -public class BindFileInfoToXmlPayload implements Binder { - - @Override - public R bindToRequest(R request, Object input) { - PCSFile blob = (PCSFile) input; - String file = String.format("%s%sfalse", - new File(blob.getMetadata().getName()).getName(), blob.getMetadata().getMimeType()); - request.setPayload(file); - return ModifyRequest.replaceHeaders(request, ImmutableMultimap. of(HttpHeaders.CONTENT_LENGTH, - file.getBytes().length + "", HttpHeaders.CONTENT_TYPE, "application/vnd.csp.file-info+xml")); - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java deleted file mode 100644 index 4b379db22e..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.binders; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.blobstore.binders.BindBlobToMultipartForm; -import org.jclouds.http.HttpRequest; -import org.jclouds.mezeo.pcs.blobstore.functions.PCSFileToBlob; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.rest.Binder; - -@Singleton -public class BindPCSFileToMultipartForm implements Binder { - private final BindBlobToMultipartForm blobBinder; - private final PCSFileToBlob file2Blob; - - @Inject - public BindPCSFileToMultipartForm(PCSFileToBlob file2Blob, BindBlobToMultipartForm blobBinder) { - this.blobBinder = blobBinder; - this.file2Blob = file2Blob; - } - - @Override - public R bindToRequest(R request, Object input) { - PCSFile file = (PCSFile) input; - checkNotNull(file.getPayload().getContentMetadata().getContentLength(), "contentLength"); - checkArgument(file.getPayload().getContentMetadata().getContentLength() <= 2l * 1024 * 1024 * 1024, - "maximum size for POST request is 2GB"); - return blobBinder.bindToRequest(request, file2Blob.apply(file)); - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java deleted file mode 100644 index bf91521beb..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.blobstore.functions; - -import javax.inject.Singleton; - -import org.jclouds.blobstore.domain.BlobMetadata; -import org.jclouds.mezeo.pcs.domain.MutableFileInfo; -import org.jclouds.mezeo.pcs.domain.internal.MutableFileInfoImpl; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class BlobToFileInfo implements Function { - @Override - public MutableFileInfo apply(BlobMetadata base) { - MutableFileInfo to = new MutableFileInfoImpl(); - to.setUrl(base.getUri()); - to.setMimeType(base.getContentMetadata().getContentType()); - to.setName(base.getName()); - to.setModified(base.getLastModified()); - if (base.getContentMetadata().getContentLength() != null) - to.setBytes(base.getContentMetadata().getContentLength()); - return to; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java deleted file mode 100644 index 556ce495a8..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.blobstore.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.mezeo.pcs.domain.PCSFile; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class BlobToPCSFile implements Function { - private final BlobToFileInfo blob2ObjectMd; - private final PCSFile.Factory objectProvider; - - @Inject - BlobToPCSFile(BlobToFileInfo blob2ObjectMd, PCSFile.Factory objectProvider) { - this.blob2ObjectMd = blob2ObjectMd; - this.objectProvider = objectProvider; - } - - public PCSFile apply(Blob from) { - PCSFile object = objectProvider.create(blob2ObjectMd.apply(from.getMetadata())); - object.setPayload(from.getPayload()); - object.setAllHeaders(from.getAllHeaders()); - return object; - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java deleted file mode 100644 index 800bf1b473..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.blobstore.functions; - -import java.util.regex.Pattern; - -import javax.inject.Singleton; - -import org.jclouds.blobstore.domain.MutableBlobMetadata; -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl; -import org.jclouds.mezeo.pcs.domain.FileInfo; -import org.jclouds.util.Strings2; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class FileInfoToBlobMetadata implements Function { - public static final Pattern OBJECTS_PATTERN = Pattern.compile(".*objects/"); - - @Override - public MutableBlobMetadata apply(FileInfo from) { - MutableBlobMetadata to = new MutableBlobMetadataImpl(); - if (from.getUrl() != null) { - to.setId(Strings2.replaceAll(from.getUrl().getPath(), OBJECTS_PATTERN, "")); - } - to.setUri(from.getUrl()); - to.setName(from.getName()); - if (from.getMimeType() != null) - to.getContentMetadata().setContentType(from.getMimeType()); - if (from.getModified() != null) - to.setLastModified(from.getModified()); - if (from.getBytes() != null) - to.getContentMetadata().setContentLength(from.getBytes()); - to.setType(StorageType.BLOB); - return to; - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java deleted file mode 100644 index 48779c65b7..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.blobstore.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.blobstore.domain.Blob.Factory; -import org.jclouds.mezeo.pcs.domain.PCSFile; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class PCSFileToBlob implements Function { - private final Blob.Factory blobFactory; - private final FileInfoToBlobMetadata info2BlobMd; - - @Inject - PCSFileToBlob(Factory blobFactory, FileInfoToBlobMetadata info2BlobMd) { - this.blobFactory = blobFactory; - this.info2BlobMd = info2BlobMd; - } - - public Blob apply(PCSFile from) { - Blob blob = blobFactory.create(info2BlobMd.apply(from.getMetadata())); - blob.setPayload(from.getPayload()); - blob.setAllHeaders(from.getAllHeaders()); - return blob; - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java deleted file mode 100644 index 6a5c3d0b99..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.config; - -import javax.inject.Inject; -import javax.inject.Provider; - -import org.jclouds.blobstore.config.BlobStoreObjectModule; -import org.jclouds.mezeo.pcs.domain.MutableFileInfo; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.mezeo.pcs.domain.internal.PCSFileImpl; - -import com.google.inject.AbstractModule; -import com.google.inject.Provides; -import com.google.inject.Scopes; - -/** - * Configures the domain object mappings needed for all PCS implementations - * - * @author Adrian Cole - */ -public class PCSObjectModule extends AbstractModule { - - /** - * explicit factories are created here as it has been shown that Assisted Inject is extremely - * inefficient. http://code.google.com/p/google-guice/issues/detail?id=435 - */ - @Override - protected void configure() { - // for adapters - install(new BlobStoreObjectModule()); - bind(PCSFile.Factory.class).to(PCSFileFactory.class).in(Scopes.SINGLETON); - } - - private static class PCSFileFactory implements PCSFile.Factory { - @Inject - Provider metadataProvider; - - public PCSFile create(MutableFileInfo metadata) { - return new PCSFileImpl(metadata != null ? metadata : metadataProvider.get()); - } - } - - @Provides - PCSFile providePCSFile(PCSFile.Factory factory) { - return factory.create(null); - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java deleted file mode 100644 index 63cb875322..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.config; - -import java.net.URI; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.Constants; -import org.jclouds.http.HttpRetryHandler; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.mezeo.pcs.PCSAsyncClient; -import org.jclouds.mezeo.pcs.PCSClient; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response; -import org.jclouds.mezeo.pcs.endpoints.Contacts; -import org.jclouds.mezeo.pcs.endpoints.Metacontainers; -import org.jclouds.mezeo.pcs.endpoints.Projects; -import org.jclouds.mezeo.pcs.endpoints.Recyclebin; -import org.jclouds.mezeo.pcs.endpoints.RootContainer; -import org.jclouds.mezeo.pcs.endpoints.Shares; -import org.jclouds.mezeo.pcs.endpoints.Tags; -import org.jclouds.mezeo.pcs.endpoints.WebDAV; -import org.jclouds.mezeo.pcs.handlers.PCSClientErrorRetryHandler; -import org.jclouds.rest.AsyncClientFactory; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; - -import com.google.inject.Provides; - -/** - * Configures the PCSCloudModule authentication service connection. - * - * @author Adrian Cole - */ -@RequiresHttp -@ConfiguresRestClient -public class PCSRestClientModule extends RestClientModule { - - @Override - protected void configure() { - install(new PCSObjectModule()); - super.configure(); - } - - public PCSRestClientModule() { - super(PCSClient.class, PCSAsyncClient.class); - } - - @Provides - @Singleton - protected Response provideCloudResponse(AsyncClientFactory factory) throws InterruptedException, ExecutionException, - TimeoutException { - return factory.create(PCSCloudAsyncClient.class).authenticate().get(10, TimeUnit.SECONDS); - } - - @Provides - @Singleton - @WebDAV - protected URI provideWebDAVURI(@Named(Constants.PROPERTY_ENDPOINT) String endpoint) { - return URI.create(endpoint + "/dav"); - } - - @Provides - @Singleton - @Contacts - protected URI provideContactsUrl(Response response) { - return response.getContactsUrl(); - } - - @Provides - @Singleton - @Metacontainers - protected URI provideMetacontainersUrl(Response response) { - return response.getMetacontainersUrl(); - } - - @Provides - @Singleton - @Projects - protected URI provideProjectsUrl(Response response) { - return response.getProjectsUrl(); - } - - @Provides - @Singleton - @Recyclebin - protected URI provideRecyclebinUrl(Response response) { - return response.getRecyclebinUrl(); - } - - @Provides - @Singleton - @RootContainer - protected URI provideRootContainerUrl(Response response) { - return response.getRootContainerUrl(); - } - - @Provides - @Singleton - @Shares - protected URI provideSharesUrl(Response response) { - return response.getSharesUrl(); - } - - @Provides - @Singleton - @Tags - protected URI provideTagsUrl(Response response) { - return response.getTagsUrl(); - } - - @Override - protected void bindRetryHandlers() { - bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(PCSClientErrorRetryHandler.class); - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java deleted file mode 100644 index 2feac3f146..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; - -import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(ContainerInfoImpl.class) -public interface ContainerInfo extends ResourceInfo { - - URI getContents(); - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java deleted file mode 100644 index 759db0b969..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; -import java.util.Map; -import java.util.SortedSet; - -import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(ContainerListImpl.class) -public interface ContainerList extends ResourceInfo, SortedSet { - Map getMetadataItems(); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java deleted file mode 100644 index c77d656a26..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; - -import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(FileInfoImpl.class) -public interface FileInfo extends ResourceInfo { - - Boolean isPublic(); - - String getMimeType(); - - URI getContent(); - - URI getPermissions(); - - URI getThumbnail(); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java deleted file mode 100644 index 8015fa4547..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; -import java.util.Map; - -import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(FileInfoWithMetadataImpl.class) -public interface FileInfoWithMetadata extends FileInfo { - Map getMetadataItems(); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java deleted file mode 100644 index c71cf4bd54..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; - -import org.jclouds.mezeo.pcs.domain.internal.MutableFileInfoImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(MutableFileInfoImpl.class) -public interface MutableFileInfo extends FileInfo, MutableResourceInfo { - - void setPublic(Boolean isPublic); - - void setMimeType(String value); - - void setContent(URI value); - - void setPermissions(URI value); - - void setThumbnail(URI value); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableResourceInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableResourceInfo.java deleted file mode 100644 index ddd9899bd9..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableResourceInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; -import java.util.Date; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.internal.MutableResourceInfoImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(MutableResourceInfoImpl.class) -public interface MutableResourceInfo extends ResourceInfo { - void setType(StorageType value); - - void setUrl(URI value); - - void setName(String value); - - void setCreated(Date value); - - void setInProject(Boolean value); - - void setModified(Date value); - - void setOwner(String value); - - void setVersion(Integer value); - - void setShared(Boolean value); - - void setAccessed(Date value); - - void setBytes(Long value); - - void setMetadata(URI value); - - void setParent(URI value); - - void setTags(URI value); - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/PCSFile.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/PCSFile.java deleted file mode 100644 index 2e37a4c474..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/PCSFile.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import javax.annotation.Nullable; - -import org.jclouds.io.PayloadEnclosing; - -import com.google.common.collect.Multimap; - -/** - * - * @author Adrian Cole - */ -public interface PCSFile extends PayloadEnclosing, Comparable { - public interface Factory { - PCSFile create(@Nullable MutableFileInfo metadata); - } - - /** - * @return System and User metadata relevant to this object. - */ - MutableFileInfo getMetadata(); - - Multimap getAllHeaders(); - - void setAllHeaders(Multimap allHeaders); -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ResourceInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ResourceInfo.java deleted file mode 100644 index a7ba781f32..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ResourceInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain; - -import java.net.URI; -import java.util.Date; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.internal.ResourceInfoImpl; - -import com.google.inject.ImplementedBy; - -/** - * - * @author Adrian Cole - * - */ -@ImplementedBy(ResourceInfoImpl.class) -public interface ResourceInfo extends Comparable { - StorageType getType(); - - URI getUrl(); - - String getName(); - - Date getCreated(); - - Boolean isInProject(); - - Date getModified(); - - String getOwner(); - - Integer getVersion(); - - Boolean isShared(); - - Date getAccessed(); - - Long getBytes(); - - URI getMetadata(); - - URI getParent(); - - URI getTags(); - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerInfoImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerInfoImpl.java deleted file mode 100644 index 019e82a1aa..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerInfoImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; -import java.util.Date; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.ContainerInfo; - -/** - * - * @author Adrian Cole - * - */ -public class ContainerInfoImpl extends ResourceInfoImpl implements ContainerInfo { - private final URI contents; - - public ContainerInfoImpl(URI url, String name, Date created, boolean inProject, Date modified, - String owner, int version, boolean shared, Date accessed, long bytes, URI contents, - URI tags, URI metadata, URI parent) { - super(StorageType.FOLDER, url, name, created, inProject, modified, owner, version, shared, - accessed, bytes, tags, metadata, parent); - this.contents = contents; - } - - public URI getContents() { - return contents; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((contents == null) ? 0 : contents.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - ContainerInfoImpl other = (ContainerInfoImpl) obj; - if (contents == null) { - if (other.contents != null) - return false; - } else if (!contents.equals(other.contents)) - return false; - return true; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerListImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerListImpl.java deleted file mode 100644 index fa9ae65dfd..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ContainerListImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; -import java.util.Date; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.ResourceInfo; - -/** - * - * @author Adrian Cole - * - */ -public class ContainerListImpl extends TreeSet implements ContainerList { - - private final ResourceInfo info; - private final Map metadataItems; - - public ContainerListImpl(URI url, String name, Date created, boolean inProject, Date modified, - String owner, int version, boolean shared, Date accessed, long bytes, - SortedSet contents, URI tags, URI metadata, - Map metadataItems, URI parent) { - this.info = new ResourceInfoImpl(StorageType.FOLDER, url, name, created, inProject, - modified, owner, version, shared, accessed, bytes, tags, metadata, parent); - addAll(contents); - this.metadataItems = metadataItems; - } - - public Map getMetadataItems() { - return metadataItems; - } - - public Date getAccessed() { - return info.getAccessed(); - } - - public Long getBytes() { - return info.getBytes(); - } - - public Date getCreated() { - return info.getCreated(); - } - - public URI getMetadata() { - return info.getMetadata(); - } - - public Date getModified() { - return info.getModified(); - } - - public String getName() { - return info.getName(); - } - - public String getOwner() { - return info.getOwner(); - } - - public URI getParent() { - return info.getParent(); - } - - public URI getTags() { - return info.getTags(); - } - - public StorageType getType() { - return info.getType(); - } - - public URI getUrl() { - return info.getUrl(); - } - - public Integer getVersion() { - return info.getVersion(); - } - - public Boolean isInProject() { - return info.isInProject(); - } - - public Boolean isShared() { - return info.isShared(); - } - - public int compareTo(ResourceInfo o) { - return info.compareTo(o); - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoImpl.java deleted file mode 100644 index 5018df1741..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; -import java.util.Date; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.FileInfo; - -/** - * - * @author Adrian Cole - * - */ -public class FileInfoImpl extends ResourceInfoImpl implements FileInfo { - - private final Boolean isPublic; - private final String mimeType; - private final URI content; - private final URI permissions; - private final URI thumbnail; - - public FileInfoImpl(URI url, String name, Date created, boolean inProject, - Date modified, - String owner, int version, boolean shared, Date accessed, - boolean isPublic, String mimeType, long bytes, URI content, URI parent, - URI permissions, URI tags, URI metadata, URI thumbnail) { - super(StorageType.BLOB, url, name, created, inProject, modified, owner, version, shared, - accessed, bytes, tags, metadata, parent); - this.isPublic = isPublic; - this.mimeType = mimeType; - this.content=content; - this.permissions = permissions; - this.thumbnail = thumbnail; - } - - public Boolean isPublic() { - return isPublic; - } - - public String getMimeType() { - return mimeType; - } - - public URI getContent() { - return content; - } - - public URI getPermissions() { - return permissions; - } - - public URI getThumbnail() { - return thumbnail; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((content == null) ? 0 : content.hashCode()); - result = prime * result + (isPublic ? 1231 : 1237); - result = prime * result + ((mimeType == null) ? 0 : mimeType.hashCode()); - result = prime * result + ((permissions == null) ? 0 : permissions.hashCode()); - result = prime * result + ((thumbnail == null) ? 0 : thumbnail.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - FileInfoImpl other = (FileInfoImpl) obj; - if (content == null) { - if (other.content != null) - return false; - } else if (!content.equals(other.content)) - return false; - if (isPublic != other.isPublic) - return false; - if (mimeType == null) { - if (other.mimeType != null) - return false; - } else if (!mimeType.equals(other.mimeType)) - return false; - if (permissions == null) { - if (other.permissions != null) - return false; - } else if (!permissions.equals(other.permissions)) - return false; - if (thumbnail == null) { - if (other.thumbnail != null) - return false; - } else if (!thumbnail.equals(other.thumbnail)) - return false; - return true; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoWithMetadataImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoWithMetadataImpl.java deleted file mode 100644 index 50945a4c49..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/FileInfoWithMetadataImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; -import java.util.Date; -import java.util.Map; - -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; - -/** - * - * @author Adrian Cole - * - */ -public class FileInfoWithMetadataImpl extends FileInfoImpl implements FileInfoWithMetadata { - private final Map metadataItems; - - public FileInfoWithMetadataImpl(URI url, String name, Date created, boolean inProject, - Date modified, String owner, int version, boolean shared, Date accessed, - boolean isPublic, String mimeType, long bytes, URI content, URI parent, - URI permissions, URI tags, URI metadata, Map metadataItems, URI thumbnail) { - super(url, name, created, inProject, modified, owner, version, shared, accessed, isPublic, - mimeType, bytes, content, parent, permissions, tags, metadata, thumbnail); - this.metadataItems = metadataItems; - } - - public Map getMetadataItems() { - return metadataItems; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((metadataItems == null) ? 0 : metadataItems.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - FileInfoWithMetadataImpl other = (FileInfoWithMetadataImpl) obj; - if (metadataItems == null) { - if (other.metadataItems != null) - return false; - } else if (!metadataItems.equals(other.metadataItems)) - return false; - return true; - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableFileInfoImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableFileInfoImpl.java deleted file mode 100644 index bfc03a5686..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableFileInfoImpl.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; - -import javax.ws.rs.core.MediaType; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.MutableFileInfo; - -/** - * - * @author Adrian Cole - * - */ -public class MutableFileInfoImpl extends MutableResourceInfoImpl implements - MutableFileInfo { - - private Boolean isPublic; - private String mimeType; - private URI content; - private URI permissions; - private URI thumbnail; - - public MutableFileInfoImpl() { - setType(StorageType.BLOB); - setMimeType(MediaType.APPLICATION_OCTET_STREAM); - } - - public String getMimeType() { - return mimeType; - } - - public URI getContent() { - return content; - } - - public URI getPermissions() { - return permissions; - } - - public URI getThumbnail() { - return thumbnail; - } - - public void setPublic(Boolean isPublic) { - this.isPublic = isPublic; - } - - public Boolean isPublic() { - return isPublic; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; - } - - public void setContent(URI content) { - this.content = content; - } - - public void setPermissions(URI permissions) { - this.permissions = permissions; - } - - public void setThumbnail(URI thumbnail) { - this.thumbnail = thumbnail; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((content == null) ? 0 : content.hashCode()); - result = prime * result + ((isPublic == null) ? 0 : isPublic.hashCode()); - result = prime * result + ((mimeType == null) ? 0 : mimeType.hashCode()); - result = prime * result + ((permissions == null) ? 0 : permissions.hashCode()); - result = prime * result + ((thumbnail == null) ? 0 : thumbnail.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - MutableFileInfoImpl other = (MutableFileInfoImpl) obj; - if (content == null) { - if (other.content != null) - return false; - } else if (!content.equals(other.content)) - return false; - if (isPublic == null) { - if (other.isPublic != null) - return false; - } else if (!isPublic.equals(other.isPublic)) - return false; - if (mimeType == null) { - if (other.mimeType != null) - return false; - } else if (!mimeType.equals(other.mimeType)) - return false; - if (permissions == null) { - if (other.permissions != null) - return false; - } else if (!permissions.equals(other.permissions)) - return false; - if (thumbnail == null) { - if (other.thumbnail != null) - return false; - } else if (!thumbnail.equals(other.thumbnail)) - return false; - return true; - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableResourceInfoImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableResourceInfoImpl.java deleted file mode 100644 index 89887b3a4f..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/MutableResourceInfoImpl.java +++ /dev/null @@ -1,271 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; -import java.util.Date; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.MutableResourceInfo; -import org.jclouds.mezeo.pcs.domain.ResourceInfo; - -/** - * - * @author Adrian Cole - * - */ -public class MutableResourceInfoImpl implements MutableResourceInfo { - - private StorageType type; - private URI url; - private String name; - private Date created; - private Boolean inProject; - private Date modified; - private String owner; - private Integer version; - private Boolean shared; - private Date accessed; - private Long bytes; - private URI tags; - private URI metadata; - private URI parent; - - public int compareTo(ResourceInfo o) { - if (getName() == null) - return -1; - return (this == o) ? 0 : getName().compareTo(o.getName()); - } - - public StorageType getType() { - return type; - } - - public void setType(StorageType type) { - this.type = type; - } - - public URI getUrl() { - return url; - } - - public void setUrl(URI url) { - this.url = url; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Boolean isInProject() { - return inProject; - } - - public void setInProject(Boolean inProject) { - this.inProject = inProject; - } - - public Date getModified() { - return modified; - } - - public void setModified(Date modified) { - this.modified = modified; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public Integer getVersion() { - return version; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public Boolean isShared() { - return shared; - } - - public void setShared(Boolean shared) { - this.shared = shared; - } - - public Date getAccessed() { - return accessed; - } - - public void setAccessed(Date accessed) { - this.accessed = accessed; - } - - public Long getBytes() { - return bytes; - } - - public void setBytes(Long bytes) { - this.bytes = bytes; - } - - public URI getTags() { - return tags; - } - - public void setTags(URI tags) { - this.tags = tags; - } - - public URI getMetadata() { - return metadata; - } - - public void setMetadata(URI metadata) { - this.metadata = metadata; - } - - public URI getParent() { - return parent; - } - - public void setParent(URI parent) { - this.parent = parent; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((accessed == null) ? 0 : accessed.hashCode()); - result = prime * result + ((bytes == null) ? 0 : bytes.hashCode()); - result = prime * result + ((created == null) ? 0 : created.hashCode()); - result = prime * result + ((inProject == null) ? 0 : inProject.hashCode()); - result = prime * result + ((metadata == null) ? 0 : metadata.hashCode()); - result = prime * result + ((modified == null) ? 0 : modified.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((owner == null) ? 0 : owner.hashCode()); - result = prime * result + ((parent == null) ? 0 : parent.hashCode()); - result = prime * result + ((shared == null) ? 0 : shared.hashCode()); - result = prime * result + ((tags == null) ? 0 : tags.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((url == null) ? 0 : url.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - MutableResourceInfoImpl other = (MutableResourceInfoImpl) obj; - if (accessed == null) { - if (other.accessed != null) - return false; - } else if (!accessed.equals(other.accessed)) - return false; - if (bytes == null) { - if (other.bytes != null) - return false; - } else if (!bytes.equals(other.bytes)) - return false; - if (created == null) { - if (other.created != null) - return false; - } else if (!created.equals(other.created)) - return false; - if (inProject == null) { - if (other.inProject != null) - return false; - } else if (!inProject.equals(other.inProject)) - return false; - if (metadata == null) { - if (other.metadata != null) - return false; - } else if (!metadata.equals(other.metadata)) - return false; - if (modified == null) { - if (other.modified != null) - return false; - } else if (!modified.equals(other.modified)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (owner == null) { - if (other.owner != null) - return false; - } else if (!owner.equals(other.owner)) - return false; - if (parent == null) { - if (other.parent != null) - return false; - } else if (!parent.equals(other.parent)) - return false; - if (shared == null) { - if (other.shared != null) - return false; - } else if (!shared.equals(other.shared)) - return false; - if (tags == null) { - if (other.tags != null) - return false; - } else if (!tags.equals(other.tags)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - if (url == null) { - if (other.url != null) - return false; - } else if (!url.equals(other.url)) - return false; - if (version == null) { - if (other.version != null) - return false; - } else if (!version.equals(other.version)) - return false; - return true; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/PCSFileImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/PCSFileImpl.java deleted file mode 100644 index 9152eefc14..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/PCSFileImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; - -import org.jclouds.http.internal.PayloadEnclosingImpl; -import org.jclouds.mezeo.pcs.domain.MutableFileInfo; -import org.jclouds.mezeo.pcs.domain.PCSFile; - -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Multimap; - -/** - * Default Implementation of {@link PCSFile}. - * - * @author Adrian Cole - */ -public class PCSFileImpl extends PayloadEnclosingImpl implements PCSFile, Comparable { - - private final MutableFileInfo metadata; - private Multimap allHeaders = LinkedHashMultimap.create(); - - @Inject - public PCSFileImpl(MutableFileInfo metadata) { - super();// no MD5 support - this.metadata = metadata; - } - - /** - * {@inheritDoc} - */ - public MutableFileInfo getMetadata() { - return metadata; - } - - /** - * {@inheritDoc} - */ - public Multimap getAllHeaders() { - return allHeaders; - } - - /** - * {@inheritDoc} - */ - public void setAllHeaders(Multimap allHeaders) { - this.allHeaders = checkNotNull(allHeaders, "allHeaders"); - } - - /** - * {@inheritDoc} - */ - public int compareTo(PCSFile o) { - if (getMetadata().getName() == null) - return -1; - return (this == o) ? 0 : getMetadata().getName().compareTo(o.getMetadata().getName()); - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ResourceInfoImpl.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ResourceInfoImpl.java deleted file mode 100644 index 52810aebc1..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/internal/ResourceInfoImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.domain.internal; - -import java.net.URI; -import java.util.Date; - -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.mezeo.pcs.domain.ResourceInfo; - -/** - * - * @author Adrian Cole - * - */ -public class ResourceInfoImpl implements ResourceInfo { - - private final StorageType type; - private final URI url; - private final String name; - private final Date created; - private final boolean inProject; - private final Date modified; - private final String owner; - private final int version; - private final boolean shared; - private final Date accessed; - private final long bytes; - private final URI tags; - private final URI metadata; - private final URI parent; - - protected ResourceInfoImpl(StorageType type, URI url, String name, Date created, - boolean inProject, Date modified, String owner, int version, boolean shared, - Date accessed, long bytes, URI tags, URI metadata, URI parent) { - super(); - this.type = type; - this.url = url; - this.name = name; - this.created = created; - this.inProject = inProject; - this.modified = modified; - this.owner = owner; - this.version = version; - this.shared = shared; - this.accessed = accessed; - this.bytes = bytes; - this.tags = tags; - this.metadata = metadata; - this.parent = parent; - } - - public int compareTo(ResourceInfo o) { - if (getName() == null) - return -1; - if (o.getName() == null) - return 1; - return (this == o) ? 0 : getName().compareTo(o.getName()); - } - - public StorageType getType() { - return type; - } - - public URI getUrl() { - return url; - } - - public String getName() { - return name; - } - - public Date getCreated() { - return created; - } - - public Boolean isInProject() { - return inProject; - } - - public Date getModified() { - return modified; - } - - public String getOwner() { - return owner; - } - - public Integer getVersion() { - return version; - } - - public Boolean isShared() { - return shared; - } - - public Date getAccessed() { - return accessed; - } - - public Long getBytes() { - return bytes; - } - - public URI getTags() { - return tags; - } - - public URI getMetadata() { - return metadata; - } - - public URI getParent() { - return parent; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((accessed == null) ? 0 : accessed.hashCode()); - result = prime * result + (int) (bytes ^ (bytes >>> 32)); - result = prime * result + ((created == null) ? 0 : created.hashCode()); - result = prime * result + (inProject ? 1231 : 1237); - result = prime * result + ((metadata == null) ? 0 : metadata.hashCode()); - result = prime * result + ((modified == null) ? 0 : modified.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((owner == null) ? 0 : owner.hashCode()); - result = prime * result + ((parent == null) ? 0 : parent.hashCode()); - result = prime * result + (shared ? 1231 : 1237); - result = prime * result + ((tags == null) ? 0 : tags.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((url == null) ? 0 : url.hashCode()); - result = prime * result + version; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ResourceInfoImpl other = (ResourceInfoImpl) obj; - if (accessed == null) { - if (other.accessed != null) - return false; - } else if (!accessed.equals(other.accessed)) - return false; - if (bytes != other.bytes) - return false; - if (created == null) { - if (other.created != null) - return false; - } else if (!created.equals(other.created)) - return false; - if (inProject != other.inProject) - return false; - if (metadata == null) { - if (other.metadata != null) - return false; - } else if (!metadata.equals(other.metadata)) - return false; - if (modified == null) { - if (other.modified != null) - return false; - } else if (!modified.equals(other.modified)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (owner == null) { - if (other.owner != null) - return false; - } else if (!owner.equals(other.owner)) - return false; - if (parent == null) { - if (other.parent != null) - return false; - } else if (!parent.equals(other.parent)) - return false; - if (shared != other.shared) - return false; - if (tags == null) { - if (other.tags != null) - return false; - } else if (!tags.equals(other.tags)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - if (url == null) { - if (other.url != null) - return false; - } else if (!url.equals(other.url)) - return false; - if (version != other.version) - return false; - return true; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Contacts.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Contacts.java deleted file mode 100644 index f707949f68..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Contacts.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type Contacts, which represents the user's contact list. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Contacts { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Metacontainers.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Metacontainers.java deleted file mode 100644 index e1ab417bd8..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Metacontainers.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type MetaContainers, which lists the metacontainers available to the - * user. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Metacontainers { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Projects.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Projects.java deleted file mode 100644 index dcd827072b..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Projects.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type Projects, which lists the projects available to the user. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Projects { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Recyclebin.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Recyclebin.java deleted file mode 100644 index 5505337bdb..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Recyclebin.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type RecycleBin, which contains the user's deleted files. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Recyclebin { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/RootContainer.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/RootContainer.java deleted file mode 100644 index 9da2fb7e3f..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/RootContainer.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type Container, which is the user's root Container - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface RootContainer { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Shares.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Shares.java deleted file mode 100644 index 735877ac0d..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Shares.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type Shares, which lists the items shared to and by the user. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Shares { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Tags.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Tags.java deleted file mode 100644 index e172734b96..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/Tags.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type Tags, which lists all the tags applied to the user's files. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Tags { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/WebDAV.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/WebDAV.java deleted file mode 100644 index 029edd5e55..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/endpoints/WebDAV.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.endpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a resource of type WebDAV - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface WebDAV { - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/AddMetadataItemIntoMap.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/AddMetadataItemIntoMap.java deleted file mode 100644 index e6364a6542..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/AddMetadataItemIntoMap.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.functions; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; - -import java.util.Map; - -import javax.inject.Inject; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.ReturnStringIf2xx; -import org.jclouds.rest.InvocationContext; -import org.jclouds.rest.internal.GeneratedHttpRequest; - -import com.google.common.base.Function; - -/** - * - * @author Adrian Cole - */ -public class AddMetadataItemIntoMap implements Function, InvocationContext { - ReturnStringIf2xx returnIf200; - private GeneratedHttpRequest request; - - @Inject - private AddMetadataItemIntoMap(ReturnStringIf2xx returnIf200) { - this.returnIf200 = returnIf200; - } - - @SuppressWarnings("unchecked") - public Void apply(HttpResponse from) { - checkState(request.getArgs() != null, "args should be initialized at this point"); - Map map = null; - String key = null; - for (Object arg : request.getArgs()) { - if (arg instanceof Map) - map = (Map) arg; - else if (arg instanceof String) - key = arg.toString(); - } - checkState(map != null, "No Map found in args, improper method declarations"); - checkState(key != null, "No String found in args, improper method declarations"); - - map.put(key, returnIf200.apply(from).trim()); - return null; - } - - @Override - public AddMetadataItemIntoMap setContext(HttpRequest request) { - checkArgument(request instanceof GeneratedHttpRequest, "note this handler requires a GeneratedHttpRequest"); - this.request = (GeneratedHttpRequest) request; - return this; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnFalseIfContainerNotFound.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnFalseIfContainerNotFound.java deleted file mode 100644 index 7f8aca5ca4..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnFalseIfContainerNotFound.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.functions; - -import javax.inject.Singleton; - -import org.jclouds.blobstore.ContainerNotFoundException; - -import com.google.common.base.Function; -import com.google.common.base.Throwables; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class ReturnFalseIfContainerNotFound implements Function { - - @Override - public Boolean apply(Exception from) { - if (from instanceof ContainerNotFoundException) { - return false; - } - throw Throwables.propagate(from); - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnTrueIfContainerAlreadyExists.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnTrueIfContainerAlreadyExists.java deleted file mode 100644 index f1ce032d31..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/functions/ReturnTrueIfContainerAlreadyExists.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.functions; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpResponseException; - -import com.google.common.base.Function; -import com.google.common.base.Throwables; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class ReturnTrueIfContainerAlreadyExists implements Function { - @Override - public Boolean apply(Exception from) { - if (from instanceof HttpResponseException) { - HttpResponseException responseException = (HttpResponseException) from; - if ("The directory already exists.".equals(responseException.getContent())) { - return true; - } - } - throw Throwables.propagate(from); - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/handlers/PCSClientErrorRetryHandler.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/handlers/PCSClientErrorRetryHandler.java deleted file mode 100644 index c103079681..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/handlers/PCSClientErrorRetryHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.handlers; - -import javax.annotation.Resource; -import javax.inject.Inject; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpRetryHandler; -import org.jclouds.http.handlers.BackoffLimitedRetryHandler; -import org.jclouds.logging.Logger; - -/** - * Handles Retryable responses with error codes in the 4xx range - * - * @author Adrian Cole - */ -public class PCSClientErrorRetryHandler implements HttpRetryHandler { - - private final BackoffLimitedRetryHandler backoffHandler; - - @Inject - public PCSClientErrorRetryHandler(BackoffLimitedRetryHandler backoffHandler) { - this.backoffHandler = backoffHandler; - } - - @Resource - protected Logger logger = Logger.NULL; - - public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { - if (response.getStatusCode() == 400) { - return backoffHandler.shouldRetryRequest(command, response); - } - return false; - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/options/PutBlockOptions.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/options/PutBlockOptions.java deleted file mode 100644 index e4489f1e54..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/options/PutBlockOptions.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.options; - -import static com.google.common.base.Preconditions.checkArgument; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -import com.google.common.collect.Multimap; - -/** - * Contains options supported in the REST API for the PUT file operation.

- * Usage

The recommended way to instantiate a PutFileOptions object is to statically import - * PutFileOptions.Builder.* and invoke a static creation method followed by an instance mutator (if - * needed): - *

- * - * import static org.jclouds.mezeo.pcs2.options.PutFileOptions.Builder.* - * import org.jclouds.mezeo.pcs2.PCSClient; - *

- * PCSClient connection = // get connection - * Future added = connection.appendFile("container",range(0,3)); - * - * - * @author Adrian Cole - */ -public class PutBlockOptions extends BaseHttpRequestOptions { - public static final PutBlockOptions NONE = new PutBlockOptions(); - private String range; - - @Override - public Multimap buildRequestHeaders() { - Multimap headers = super.buildRequestHeaders(); - String range = getRange(); - if (range != null) - headers.put("Content-Range", this.getRange()); - return headers; - } - - /** - * For use in the header Content-Range - *

- * - * @see PutBlockOptions#range(long, long) - */ - public String getRange() { - return range; - } - - /** - * download the specified range of the object. - */ - public PutBlockOptions range(long start, long end) { - checkArgument(start >= 0, "start must be >= 0"); - checkArgument(end >= 0, "end must be >= 0"); - range = String.format("bytes %d-%d/*", start, end); - return this; - } - - public static class Builder { - /** - * @see PutBlockOptions#range(long, long) - */ - public static PutBlockOptions range(long start, long end) { - PutBlockOptions options = new PutBlockOptions(); - return options.range(start, end); - } - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHandler.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHandler.java deleted file mode 100644 index a8f0a75e07..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHandler.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.xml; - -import java.net.URI; -import java.util.Map; - -import org.jclouds.http.functions.ParseSax; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.collect.Maps; - -/** - * Parses the discovery response from xlink refs. - * - * @author Adrian Cole - */ -public class CloudXlinkHandler extends ParseSax.HandlerWithResult { - - private Map map = Maps.newHashMap(); - - public static class PCSCloudResponseImpl implements PCSCloudAsyncClient.Response { - private final Map map; - - public PCSCloudResponseImpl(Map map) { - this.map = map; - } - - public URI getContactsUrl() { - return map.get("contacts"); - } - - public URI getMetacontainersUrl() { - return map.get("metacontainers"); - } - - public URI getProjectsUrl() { - return map.get("projects"); - } - - public URI getRecyclebinUrl() { - return map.get("recyclebin"); - } - - public URI getRootContainerUrl() { - return map.get("rootContainer"); - } - - public URI getSharesUrl() { - return map.get("shares"); - } - - public URI getTagsUrl() { - return map.get("tags"); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((map == null) ? 0 : map.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - PCSCloudResponseImpl other = (PCSCloudResponseImpl) obj; - if (map == null) { - if (other.map != null) - return false; - } else if (!map.equals(other.map)) - return false; - return true; - } - - @Override - public String toString() { - return "PCSDiscoveryResponseImpl [map=" + map + "]"; - } - - } - - public PCSCloudAsyncClient.Response getResult() { - return new PCSCloudResponseImpl(map); - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - map.put(qName, URI.create(attributes.getValue(index))); - } - } - -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/ContainerHandler.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/ContainerHandler.java deleted file mode 100644 index 1d4fa401b4..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/ContainerHandler.java +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.xml; - -import java.net.URI; -import java.util.Date; -import java.util.Map; -import java.util.SortedSet; -import java.util.regex.Pattern; - -import javax.annotation.Resource; -import javax.inject.Inject; - -import org.jclouds.date.DateService; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.logging.Logger; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.ResourceInfo; -import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl; -import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl; -import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl; -import org.jclouds.util.Strings2; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -/** - * @author Adrian Cole - */ -public class ContainerHandler extends ParseSax.HandlerWithResult { - - @Resource - protected Logger logger = Logger.NULL; - - private SortedSet containerMetadata = Sets.newTreeSet(); - protected Map metadataItems = Maps.newHashMap(); - - private URI rootUrl; - private String rootName; - private Date rootCreated; - private boolean rootInproject; - private Date rootModified; - private String rootOwner; - private int rootVersion; - private boolean rootShared; - private Date rootAccessed; - private long rootBytes; - private URI rootParent; - private URI rootTags; - private URI rootMetadata; - - private URI currentUrl; - private String currentName; - private Date currentCreated; - private boolean currentInproject; - private Date currentModified; - private String currentOwner; - private int currentVersion; - private boolean currentShared; - private Date currentAccessed; - private long currentBytes; - private URI currentParent; - private URI currentTags; - private URI currentMetadata; - private URI currentContents; - - private boolean currentPublic; - private String currentMimeType; - private URI currentContent; - private URI currentPermissions; - - private URI currentThumbnail; - - private StringBuilder currentText = new StringBuilder(); - - private final DateService dateParser; - - boolean inContainer = false; - boolean inContents = false; - - private ContainerListImpl rootContainer; - - @Inject - public ContainerHandler(DateService dateParser) { - this.dateParser = dateParser; - } - - public ContainerList getResult() { - return rootContainer; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - if (qName.equals("contents") && attributes.getIndex("count") != -1) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - rootUrl = URI.create(attributes.getValue(index).replace("/contents", "")); - } - inContents = true; - return; - } else if (qName.equals("container")) { - if (inContents) - inContainer = true; - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentUrl = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("parent")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentParent = URI.create(attributes.getValue(index)); - if (!inContents) - rootParent = currentParent; - } - } else if (qName.equals("file")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentUrl = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("content")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentContent = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("contents")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentContents = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("permissions")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentPermissions = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("tags")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentTags = URI.create(attributes.getValue(index)); - if (!inContents) - rootTags = currentTags; - } - } else if (qName.equals("thumbnail")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentThumbnail = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("metadata")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentMetadata = URI.create(attributes.getValue(index)); - if (!inContents) - rootMetadata = currentMetadata; - } - } else if (qName.equals("metadata-item")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - String key = Strings2.replaceAll(attributes.getValue(index), METADATA_PATTERN, ""); - metadataItems.put(key.toLowerCase(), URI.create(attributes.getValue(index))); - } - } - } - - public final Pattern METADATA_PATTERN = Pattern.compile(".*/metadata/"); - - @Override - public void endElement(String uri, String name, String qName) { - if (qName.equals("contents")) { - if (!inContainer) - inContents = false; - currentText = new StringBuilder(); - return; - } - if (qName.equals("container") && !inContents) { - rootContainer = new ContainerListImpl(rootUrl, rootName, rootCreated, rootInproject, - rootModified, rootOwner, rootVersion, rootShared, rootAccessed, rootBytes, - containerMetadata, rootTags, rootMetadata, metadataItems, rootParent); - } else if (qName.equals("container") || qName.equals("file")) { - if (qName.equals("container")) { - inContainer = false; - containerMetadata.add(new ContainerInfoImpl(currentUrl, currentName, currentCreated, - currentInproject, currentModified, currentOwner, currentVersion, - currentShared, currentAccessed, currentBytes, currentContents, currentTags, - currentMetadata, currentParent)); - } else { - containerMetadata.add(new FileInfoImpl(currentUrl, currentName, currentCreated, - currentInproject, currentModified, currentOwner, currentVersion, - currentShared, currentAccessed, currentPublic, currentMimeType, currentBytes, - currentContent, currentParent, currentPermissions, currentTags, - currentMetadata, currentThumbnail)); - } - currentUrl = null; - currentName = null; - currentCreated = null; - currentInproject = false; - currentModified = null; - currentOwner = null; - currentVersion = 0; - currentShared = false; - currentAccessed = null; - currentBytes = 0; - currentPublic = false; - currentMimeType = null; - currentParent = null; - currentContents = null; - currentContent = null; - currentPermissions = null; - currentTags = null; - currentMetadata = null; - currentThumbnail = null; - - } else if (qName.equals("name")) { - currentName = currentText.toString().trim(); - if (!inContents) - rootName = currentName; - } else if (qName.equals("created")) { - currentCreated = dateParser.fromSeconds(Long.parseLong(currentText.toString().trim())); - if (!inContents) - rootCreated = currentCreated; - } else if (qName.equals("inproject")) { - currentInproject = Boolean.parseBoolean(currentText.toString().trim()); - if (!inContents) - rootInproject = currentInproject; - } else if (qName.equals("modified")) { - currentModified = dateParser.fromSeconds(Long.parseLong(currentText.toString().trim())); - if (!inContents) - rootModified = currentModified; - } else if (qName.equals("owner")) { - currentOwner = currentText.toString().trim(); - if (!inContents) - rootOwner = currentOwner; - } else if (qName.equals("version")) { - currentVersion = Integer.parseInt(currentText.toString().trim()); - if (!inContents) - rootVersion = currentVersion; - } else if (qName.equals("shared")) { - currentShared = Boolean.parseBoolean(currentText.toString().trim()); - if (!inContents) - rootShared = currentShared; - } else if (qName.equals("accessed")) { - currentAccessed = dateParser.fromSeconds(Long.parseLong(currentText.toString().trim())); - if (!inContents) - rootAccessed = currentAccessed; - } else if (qName.equals("bytes")) { - currentBytes = Long.parseLong(currentText.toString().trim()); - if (!inContents) - rootBytes = currentBytes; - } else if (qName.equals("public")) { - currentPublic = Boolean.parseBoolean(currentText.toString().trim()); - } else if (qName.equals("mime_type")) { - currentMimeType = currentText.toString().trim(); - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } -} diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/FileHandler.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/FileHandler.java deleted file mode 100644 index cd765e78b6..0000000000 --- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/xml/FileHandler.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.xml; - -import java.net.URI; -import java.util.Date; -import java.util.Map; -import java.util.regex.Pattern; - -import javax.inject.Inject; - -import org.jclouds.date.DateService; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; -import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl; -import org.jclouds.util.Strings2; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.collect.Maps; - -/** - * @author Adrian Cole - */ -public class FileHandler extends ParseSax.HandlerWithResult { - private static final Pattern CONTENT_PATTERN = Pattern.compile("/content"); - private static final Pattern METADATA_PATTERN = Pattern.compile(".*/metadata/"); - - protected Map metadataItems = Maps.newHashMap(); - - protected URI currentUrl; - private String currentName; - private Date currentCreated; - private boolean currentInproject; - private Date currentModified; - private String currentOwner; - private int currentVersion; - private boolean currentShared; - private Date currentAccessed; - private long currentBytes; - private String currentMimeType; - private boolean currentPublic; - - protected StringBuilder currentText = new StringBuilder(); - - private final DateService dateParser; - - private FileInfoWithMetadata fileMetadataList; - - private URI currentPermissions; - - private URI currentTags; - - private URI currentThumbnail; - - private URI currentMetadata; - - private URI currentContent; - - private URI currentParent; - - @Inject - public FileHandler(DateService dateParser) { - this.dateParser = dateParser; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - if (qName.equals("content")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentContent = URI.create(attributes.getValue(index)); - currentUrl = URI.create(Strings2.replaceAll(attributes.getValue(index), CONTENT_PATTERN, - "")); - } - } else if (qName.equals("permissions")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentPermissions = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("tags")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentTags = URI.create(attributes.getValue(index)); - - } - } else if (qName.equals("parent")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentParent = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("thumbnail")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentThumbnail = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("metadata")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - currentMetadata = URI.create(attributes.getValue(index)); - } - } else if (qName.equals("metadata-item")) { - int index = attributes.getIndex("xlink:href"); - if (index != -1) { - String key = Strings2.replaceAll(attributes.getValue(index), METADATA_PATTERN, ""); - metadataItems.put(key.toLowerCase(), URI.create(attributes.getValue(index))); - } - } - } - - @Override - public void endElement(String uri, String name, String qName) { - if (qName.equals("name")) { - currentName = currentText.toString().trim(); - } else if (qName.equals("created")) { - currentCreated = dateParser.fromSeconds(Long.parseLong(currentText.toString().trim())); - } else if (qName.equals("inproject")) { - currentInproject = Boolean.parseBoolean(currentText.toString().trim()); - } else if (qName.equals("modified")) { - currentModified = dateParser.fromSeconds(Long.parseLong(currentText.toString().trim())); - } else if (qName.equals("owner")) { - currentOwner = currentText.toString().trim(); - } else if (qName.equals("version")) { - currentVersion = Integer.parseInt(currentText.toString().trim()); - } else if (qName.equals("shared")) { - currentShared = Boolean.parseBoolean(currentText.toString().trim()); - } else if (qName.equals("accessed")) { - currentAccessed = dateParser.fromSeconds(Long.parseLong(currentText.toString().trim())); - } else if (qName.equals("bytes")) { - currentBytes = Long.parseLong(currentText.toString().trim()); - } else if (qName.equals("mime_type")) { - currentMimeType = currentText.toString().trim(); - } else if (qName.equals("public")) { - currentPublic = Boolean.parseBoolean(currentText.toString().trim()); - } else if (qName.equals("file")) { - fileMetadataList = new FileInfoWithMetadataImpl(currentUrl, currentName, currentCreated, - currentInproject, currentModified, currentOwner, currentVersion, currentShared, - currentAccessed, currentPublic, currentMimeType, currentBytes, currentContent, - currentParent, currentPermissions, currentTags, currentMetadata, metadataItems, - currentThumbnail); - currentUrl = null; - currentName = null; - currentCreated = null; - currentInproject = false; - currentModified = null; - currentOwner = null; - currentVersion = 0; - currentShared = false; - currentAccessed = null; - currentBytes = 0; - currentMimeType = null; - currentPublic = false; - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } - - @Override - public FileInfoWithMetadata getResult() { - return fileMetadataList; - } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSAsyncClientTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSAsyncClientTest.java deleted file mode 100644 index 3e4614e569..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSAsyncClientTest.java +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Array; -import java.lang.reflect.Method; -import java.net.URI; -import java.util.Map; -import java.util.Properties; - -import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest; -import org.jclouds.blobstore.functions.ReturnNullOnKeyNotFound; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x; -import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.http.functions.ReturnInputStream; -import org.jclouds.mezeo.pcs.PCSAsyncClient; -import org.jclouds.mezeo.pcs.PCSClient; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response; -import org.jclouds.mezeo.pcs.blobstore.functions.BlobToPCSFile; -import org.jclouds.mezeo.pcs.config.PCSRestClientModule; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.mezeo.pcs.functions.AddMetadataItemIntoMap; -import org.jclouds.mezeo.pcs.options.PutBlockOptions; -import org.jclouds.mezeo.pcs.xml.ContainerHandler; -import org.jclouds.mezeo.pcs.xml.FileHandler; -import org.jclouds.rest.AsyncClientFactory; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code PCSClient} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.PCSClientTest") -public class PCSAsyncClientTest extends RestClientTest { - - public void testList() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("list"); - GeneratedHttpRequest request = processor.createRequest(method); - - assertRequestLineEquals(request, "GET http://root HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "X-Cloud-Depth: 2\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, ContainerHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testCreateContainer() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("createContainer", String.class); - GeneratedHttpRequest request = processor.createRequest(method, "container"); - - assertRequestLineEquals(request, "POST http://root/contents HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, "container", - "application/vnd.csp.container-info+xml", false); - - assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testDeleteContainer() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("deleteContainer", URI.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/container/1234")); - - assertRequestLineEquals(request, "DELETE http://localhost/container/1234 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(request); - } - - public void testListURI() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("list", URI.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/mycontainer")); - - assertRequestLineEquals(request, "GET http://localhost/mycontainer HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "X-Cloud-Depth: 2\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, ContainerHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testGetFileInfo() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("getFileInfo", URI.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/myfile")); - - assertRequestLineEquals(request, "GET http://localhost/myfile HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "X-Cloud-Depth: 2\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, FileHandler.class); - assertExceptionParserClassEquals(method, ReturnNullOnKeyNotFound.class); - - checkFilters(request); - } - - public void testUploadFile() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("uploadFile", URI.class, PCSFile.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/mycontainer"), blobToPCSFile - .apply(BindBlobToMultipartFormTest.TEST_BLOB)); - - assertRequestLineEquals(request, "POST http://localhost/mycontainer/contents HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, BindBlobToMultipartFormTest.EXPECTS, "multipart/form-data; boundary=--JCLOUDS--", - false); - - assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testUploadBlock() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("uploadBlock", URI.class, PCSFile.class, Array.newInstance( - PutBlockOptions.class, 0).getClass()); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/mycontainer"), blobToPCSFile - .apply(BindBlobToMultipartFormTest.TEST_BLOB)); - - assertRequestLineEquals(request, "PUT http://localhost/mycontainer/content HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, "hello", "text/plain", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testDownloadFile() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("downloadFile", URI.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/container")); - - assertRequestLineEquals(request, "GET http://localhost/container/content HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReturnInputStream.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnKeyNotFound.class); - - checkFilters(request); - - } - - public void testDeleteFile() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("deleteFile", URI.class); - GeneratedHttpRequest request = processor.createRequest(method, - new Object[] { URI.create("http://localhost/contents/file") }); - - assertRequestLineEquals(request, "DELETE http://localhost/contents/file HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(request); - } - - public void testPutMetadata() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("putMetadataItem", URI.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/contents/file"), "pow", "bar"); - - assertRequestLineEquals(request, "PUT http://localhost/contents/file/metadata/pow HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, "bar", "application/unknown", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testAddEntryToMap() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSAsyncClient.class.getMethod("addMetadataItemToMap", URI.class, String.class, Map.class); - GeneratedHttpRequest request = processor.createRequest(method, URI.create("http://localhost/pow"), "newkey", ImmutableMap - .of("key", "value")); - - assertRequestLineEquals(request, "GET http://localhost/pow/metadata/newkey HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, AddMetadataItemIntoMap.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - private BlobToPCSFile blobToPCSFile; - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), BasicAuthentication.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @BeforeClass - @Override - protected void setupFactory() throws IOException { - super.setupFactory(); - blobToPCSFile = injector.getInstance(BlobToPCSFile.class); - } - - @Override - protected Module createModule() { - return new TestPCSRestClientModule(); - } - - @RequiresHttp - @ConfiguresRestClient - private static final class TestPCSRestClientModule extends PCSRestClientModule { - @Override - protected void configure() { - super.configure(); - } - - @Override - protected Response provideCloudResponse(AsyncClientFactory factory) { - return null; - } - - @Override - protected URI provideRootContainerUrl(Response response) { - return URI.create("http://root"); - } - } - - @Override - public RestContextSpec createContextSpec() { - Properties properties = new Properties(); - properties.setProperty("pcs.endpoint", "http://goo"); - return new RestContextFactory().createContextSpec("pcs", "identity", "credential", properties); - } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSClientLiveTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSClientLiveTest.java deleted file mode 100644 index d6baafbf9f..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSClientLiveTest.java +++ /dev/null @@ -1,279 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.mezeo.pcs.options.PutBlockOptions.Builder.range; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -import javax.inject.Provider; -import javax.ws.rs.core.UriBuilder; - -import org.jclouds.Constants; -import org.jclouds.blobstore.KeyNotFoundException; -import org.jclouds.blobstore.domain.StorageType; -import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; -import org.jclouds.http.HttpResponseException; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.mezeo.pcs.PCSAsyncClient; -import org.jclouds.mezeo.pcs.PCSClient; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.mezeo.pcs.domain.ResourceInfo; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.util.Strings2; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.inject.Module; -import com.sun.jersey.api.uri.UriBuilderImpl; - -/** - * Tests behavior of {@code PCSDiscovery} - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "pcs2.PCSClientLiveTest") -public class PCSClientLiveTest { - - Provider uriBuilderProvider = new Provider() { - - @Override - public UriBuilder get() { - return new UriBuilderImpl(); - } - - }; - - private RestContext context; - private PCSClient connection; - - protected String provider = "pcs"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; - - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); - credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider - + ".credential"); - endpoint = System.getProperty("test." + provider + ".endpoint"); - apiVersion = System.getProperty("test." + provider + ".api-version"); - } - - protected Properties setupProperties() { - Properties overrides = new Properties(); - overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); - overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); - overrides.setProperty(provider + ".identity", identity); - overrides.setProperty(provider + ".credential", credential); - if (endpoint != null) - overrides.setProperty(provider + ".endpoint", endpoint); - if (apiVersion != null) - overrides.setProperty(provider + ".api-version", apiVersion); - return overrides; - } - - @BeforeGroups(groups = { "live" }) - public void setupClient() { - setupCredentials(); - Properties overrides = setupProperties(); - - context = new RestContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule()), - overrides); - - connection = context.getApi(); - ContainerList response = connection.list(); - for (ResourceInfo resource : response) { - if (resource.getType() == StorageType.FOLDER && resource.getName().startsWith(containerPrefix)) { - System.err.printf("*** deleting container %s...%n", resource.getName()); - connection.deleteContainer(resource.getUrl()); - } - } - - } - - private String containerPrefix = BaseBlobStoreIntegrationTest.CONTAINER_PREFIX; - - @Test - public void testListContainers() throws Exception { - ContainerList response = connection.list(); - URI rootUrl = response.getUrl(); - String name = "/"; - validateContainerList(response, rootUrl, name); - - long initialContainerCount = response.size(); - assertTrue(initialContainerCount >= 0); - - // Create test containers - for (String container : new String[] { containerPrefix + ".testListOwnedContainers1", - containerPrefix + ".testListOwnedContainers2" }) { - URI containerURI = connection.createContainer(container); - connection.putMetadataItem(containerURI, "name", container); - response = connection.list(containerURI); - validateContainerList(response, rootUrl, container); - - assertEquals(response.getMetadataItems().get("name"), - URI.create(containerURI.toASCIIString() + "/metadata/name")); - - validateMetadataItemNameEquals(containerURI, container); - - connection.deleteContainer(containerURI); - } - } - - private void validateMetadataItemNameEquals(URI resource, String name) throws InterruptedException, - ExecutionException, TimeoutException { - Map metadata = Maps.newHashMap(); - connection.addMetadataItemToMap(resource, "name", metadata); - assertEquals(metadata.get("name"), name); - } - - private void validateContainerList(ContainerList response, URI parent, String name) { - assertNotNull(response.getMetadataItems()); - validateResource(response, parent, name); - } - - private void validateFileInfo(FileInfoWithMetadata response, URI parent, String name, Long size, String mimeType) { - assertNotNull(response.getMetadataItems()); - assertFalse(response.isPublic()); - assertEquals(response.getBytes(), size); - assertEquals(response.getMimeType(), mimeType); - assertNotNull(response.getContent()); - assertNotNull(response.getPermissions()); - assertNotNull(response.getThumbnail()); - validateResource(response, parent, name); - } - - private void validateResource(ResourceInfo response, URI parent, String name) { - assertNotNull(response); - assertNotNull(response.getAccessed()); - assertNotNull(response.getBytes()); - assertNotNull(response.getCreated()); - assertNotNull(response.getMetadata()); - assertNotNull(response.getModified()); - assertEquals(response.getName(), name); - assertEquals(response.getOwner(), identity); - assertEquals(response.getParent(), parent); - assertNotNull(response.getTags()); - assertNotNull(response.getType()); - assertNotNull(response.getUrl()); - assertNotNull(response.getVersion()); - } - - @Test - public void testObjectOperations() throws Exception { - String containerName = containerPrefix + ".testObjectOperations"; - String data = "Here is my data"; - - URI container = connection.createContainer(containerName); - - // Test PUT with string data, ETag hash, and a piece of metadata - PCSFile object = connection.newFile(); - object.getMetadata().setName("object"); - object.getMetadata().setMimeType("text/plain"); - object.setPayload(data); - URI objectURI = connection.uploadFile(container, object); - connection.putMetadataItem(objectURI, "name", "object"); - - try { - connection.downloadFile(uriBuilderProvider.get().uri(objectURI).path("sad").build()); - fail("Expected KeyNotFoundException"); - } catch (KeyNotFoundException e) { - } - // Test GET of object (including updated metadata) - InputStream file = connection.downloadFile(objectURI); - assertEquals(Strings2.toStringAndClose(file), data); - validateFileInfoAndNameIsInMetadata(container, objectURI, "object", Long.valueOf(data.length())); - - try { - connection.uploadFile(container, object); - } catch (Throwable e) { - assertEquals(e.getCause().getClass(), HttpResponseException.class); - assertEquals(((HttpResponseException) e.getCause()).getResponse().getStatusCode(), 422); - } - - connection.deleteFile(objectURI); - try { - connection.getFileInfo(objectURI); - } catch (Throwable e) { - assertEquals(e.getClass(), KeyNotFoundException.class); - } - - String name = "sad"; - // try sending it in 2 parts - object.getMetadata().setName(name); - objectURI = connection.createFile(container, object); - validateFileInfoAndNameIsInMetadata(container, objectURI, name, Long.valueOf(0)); - - object.setPayload(data.substring(0, 2)); - connection.uploadBlock(objectURI, object, range(0, 2)); - validateFileInfoAndNameIsInMetadata(container, objectURI, name, Long.valueOf(2)); - - object.setPayload(data.substring(2)); - connection.uploadBlock(objectURI, object, range(2, data.getBytes().length)); - validateFileInfoAndNameIsInMetadata(container, objectURI, name, Long.valueOf(data.length())); - - file = connection.downloadFile(objectURI); - assertEquals(Strings2.toStringAndClose(file), data); - - // change data in an existing file - data = "Here is my datum"; - object.setPayload(data.substring(2)); - connection.uploadBlock(objectURI, object, range(2, data.getBytes().length)); - validateFileInfoAndNameIsInMetadata(container, objectURI, name, Long.valueOf(data.length())); - - file = connection.downloadFile(objectURI); - assertEquals(Strings2.toStringAndClose(file), data); - - connection.deleteFile(objectURI); - connection.deleteContainer(container); - } - - private FileInfoWithMetadata validateFileInfoAndNameIsInMetadata(URI container, URI objectURI, String name, Long size) - throws InterruptedException, ExecutionException, TimeoutException { - FileInfoWithMetadata response; - connection.putMetadataItem(objectURI, "name", name); - - response = connection.getFileInfo(objectURI); - validateFileInfo(response, container, name, size, "text/plain"); - - assertEquals(response.getMetadataItems().get("name"), URI.create(objectURI.toASCIIString() + "/metadata/name")); - - validateMetadataItemNameEquals(objectURI, name); - return response; - } - -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClientTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClientTest.java deleted file mode 100644 index d23b5816d2..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClientTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs; - -import static org.jclouds.rest.RestContextFactory.contextSpec; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.Timeout; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response; -import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; - -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code PCSCloudAsyncClient} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.PCSCloudTest") -public class PCSCloudAsyncClientTest extends RestClientTest { - - public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException { - Method method = PCSCloudAsyncClient.class.getMethod("authenticate"); - GeneratedHttpRequest request = processor.createRequest(method); - - assertRequestLineEquals(request, "GET http://localhost:8080/v3 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, CloudXlinkHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - public RestContextSpec createContextSpec() { - return contextSpec("test", "http://localhost:8080", "3", "", "identity", "credential", PCSCloudClient.class, - PCSCloudAsyncClient.class); - } - - @Override - protected void checkFilters(HttpRequest request) { - - } - - @Timeout(duration = 10, timeUnit = TimeUnit.SECONDS) - public interface PCSCloudClient { - - Response authenticate(); - } - -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayloadTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayloadTest.java deleted file mode 100644 index 59583e6081..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayloadTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.binders; - -import static org.testng.Assert.assertEquals; - -import java.net.URI; - -import org.jclouds.http.HttpRequest; -import org.jclouds.mezeo.pcs.binders.BindContainerNameToXmlPayload; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code BindContainerNameToXmlPayload} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.BindContainerNameToXmlPayloadTest") -public class BindContainerNameToXmlPayloadTest { - - public void test() { - BindContainerNameToXmlPayload binder = new BindContainerNameToXmlPayload(); - HttpRequest request = new HttpRequest("GET", URI.create("http://localhost")); - binder.bindToRequest(request, "foo"); - - assertEquals(request.getPayload().getRawContent(), "foo"); - assertEquals(request.getPayload().getContentMetadata().getContentLength(), Long.valueOf( - "foo".getBytes().length)); - assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/unknown"); - - } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayloadTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayloadTest.java deleted file mode 100644 index 6dfc1bc32d..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayloadTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.binders; - -import static org.testng.Assert.assertEquals; - -import java.net.URI; - -import javax.ws.rs.core.HttpHeaders; - -import org.jclouds.http.HttpRequest; -import org.jclouds.mezeo.pcs.binders.BindFileInfoToXmlPayload; -import org.jclouds.mezeo.pcs.config.PCSObjectModule; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.testng.annotations.Test; - -import com.google.inject.Guice; - -/** - * Tests behavior of {@code BindFileInfoToXmlPayload} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.BindFileInfoToXmlPayloadTest") -public class BindFileInfoToXmlPayloadTest { - PCSFile.Factory factory = Guice.createInjector(new PCSObjectModule()).getInstance(PCSFile.Factory.class); - - public void test() { - BindFileInfoToXmlPayload binder = new BindFileInfoToXmlPayload(); - HttpRequest request = new HttpRequest("GET", URI.create("http://localhost")); - PCSFile file = factory.create(null); - file.getMetadata().setName("foo"); - request = binder.bindToRequest(request, file); - assertEquals(request.getPayload().getRawContent(), - "fooapplication/octet-streamfalse"); - assertEquals( - request.getFirstHeaderOrNull(HttpHeaders.CONTENT_LENGTH), - "fooapplication/octet-streamfalse" - .getBytes().length + ""); - assertEquals(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_TYPE), "application/vnd.csp.file-info+xml"); - - } - - public void testCompound() { - BindFileInfoToXmlPayload binder = new BindFileInfoToXmlPayload(); - HttpRequest request = new HttpRequest("GET", URI.create("http://localhost")); - - PCSFile file = factory.create(null); - file.getMetadata().setName("subdir/foo"); - request = binder.bindToRequest(request, file); - assertEquals(request.getPayload().getRawContent(), - "fooapplication/octet-streamfalse"); - assertEquals( - request.getFirstHeaderOrNull(HttpHeaders.CONTENT_LENGTH), - "fooapplication/octet-streamfalse" - .getBytes().length + ""); - assertEquals(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_TYPE), "application/vnd.csp.file-info+xml"); - - } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AddMetadataAndReturnIdTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AddMetadataAndReturnIdTest.java deleted file mode 100644 index 3ef830097a..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AddMetadataAndReturnIdTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.functions; - -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code UseResourceIdAsETag} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.AddMetadataAndReturnIdTest") -public class AddMetadataAndReturnIdTest { -// static { -// RuntimeDelegate.setInstance(new RuntimeDelegateImpl()); -// } -// HttpResponse response = new HttpResponse(); -// ConcurrentMap fileCache; -// private RestAnnotationProcessor factory; -// private Method method; -// -// private static interface TestService { -// @POST -// public void foo(String container, PCSFile file, @Endpoint URI endpoint); -// } -// -// @BeforeClass -// void setupMap() { -// fileCache = new ConcurrentHashMap(); -// fileCache.put(new Key("container", "key"), "7F143552-AAF5-11DE-BBB0-0BC388ED913B"); -// } -// -// @SuppressWarnings("unchecked") -// PCSUtil createPCSUtil() { -// PCSUtil connection = createMock(PCSUtil.class); -// final Future voidF = createMock(Future.class); -// expect( -// connection.putMetadata(eq("7F143552-AAF5-11DE-BBB0-0BC388ED913B"), eq("foo"), -// eq("bar"))).andReturn(voidF); -// expect( -// connection.putMetadata(eq("7F143552-AAF5-11DE-BBB0-0BC388ED913B"), eq("biz"), -// eq("baz"))).andReturn(voidF); -// replay(connection); -// return connection; -// } -// -// @Test(expectedExceptions = IllegalStateException.class) -// public void testNoArgs() { -// AddMetadataAndReturnId function = new AddMetadataAndReturnId(fileCache, createPCSUtil()); -// -// function.apply(response); -// } -// -// @Test(expectedExceptions = IllegalStateException.class) -// public void testNoRequest() { -// AddMetadataAndReturnId function = new AddMetadataAndReturnId(fileCache, createPCSUtil()); -// function.apply(response); -// } -// -// public void testGetEtag() { -// PCSUtil connection = createPCSUtil(); -// AddMetadataAndReturnId function = new AddMetadataAndReturnId(fileCache, connection); -// function.setContext(factory.createRequest(method, "container", new PCSFile("key"), URI -// .create("http://localhost:8080"))); -// response.setContent(Utils -// .toInputStream("http://localhost/contents/7F143552-AAF5-11DE-BBB0-0BC388ED913B")); -// String eTag = function.apply(response); -// assertEquals(eTag, "7F143552-AAF5-11DE-BBB0-0BC388ED913B"); -// } -// -// public void testMetadataGetEtag() { -// PCSUtil connection = createPCSUtil(); -// AddMetadataAndReturnId function = new AddMetadataAndReturnId(fileCache, connection); -// PCSFile pcsFile = new PCSFile("key"); -// pcsFile.getMetadata().getUserMetadata().put("foo", "bar"); -// pcsFile.getMetadata().getUserMetadata().put("biz", "baz"); -// -// function.setContext(factory.createRequest(method, "container", pcsFile, URI -// .create("http://localhost:8080"))); -// response.setContent(Utils -// .toInputStream("http://localhost/contents/7F143552-AAF5-11DE-BBB0-0BC388ED913B")); -// String eTag = function.apply(response); -// assertEquals(eTag, "7F143552-AAF5-11DE-BBB0-0BC388ED913B"); -// verify(connection); -// } -// -// /** -// * before class, as we need to ensure that the filter is threadsafe. -// * -// * @throws NoSuchMethodException -// * @throws SecurityException -// * -// */ -// @BeforeClass -// protected void createFilter() throws SecurityException, NoSuchMethodException { -// Injector injector = Guice.createInjector(new RestModule(), new ExecutorServiceModule( -// Executors.sameThreadExecutor()), new JavaUrlHttpCommandExecutorServiceModule(), -// new AbstractModule() { -// -// protected void configure() { -// RuntimeDelegate.setInstance(new RuntimeDelegateImpl()); -// bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() { -// public Logger getLogger(String category) { -// return Logger.NULL; -// } -// }); -// } -// -// }); -// factory = injector.getInstance(com.google.inject.Key -// .get(new TypeLiteral>() { -// })); -// -// method = TestService.class.getMethod("foo", String.class, PCSFile.class, URI.class); -// } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AssembleBlobFromBlobMetadataCallTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AssembleBlobFromBlobMetadataCallTest.java deleted file mode 100644 index 412a348f9d..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/functions/AssembleBlobFromBlobMetadataCallTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.functions; - - -/** - * @author Adrian Cole - */ -public class AssembleBlobFromBlobMetadataCallTest { - -// @SuppressWarnings("unchecked") -// @Test(expectedExceptions = NullPointerException.class) -// public void testCall() throws HttpException { -// FileMetadata metadata = new FileMetadata("blob"); -// metadata.setSize(103); -// ConcurrentMap mdCache = createMock(ConcurrentMap.class); -// InputStream data = createMock(InputStream.class); -// AssembleBlobFromContentAndMetadataCache callable = new AssembleBlobFromContentAndMetadataCache( -// mdCache); -// HttpResponse response = createMock(HttpResponse.class); -// expect(mdCache.get(new Key("container", "blob"))).andReturn(metadata); -// expect(response.getContent()).andReturn(data); -// replay(mdCache); -// replay(response); -// PCSFile file = callable.apply(response); -// assertEquals(file.getMetadata(), metadata); -// assertEquals(file.getName(), "blob"); -// assertEquals(file.getData(), data); -// assertEquals(file.getContentLength(), metadata.getSize()); -// } - -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/internal/StubPCSAsyncClient.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/internal/StubPCSAsyncClient.java deleted file mode 100644 index 187441cd5d..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/internal/StubPCSAsyncClient.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.internal; - -import java.io.InputStream; -import java.net.URI; -import java.util.Map; - -import org.jclouds.mezeo.pcs.PCSAsyncClient; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; -import org.jclouds.mezeo.pcs.domain.PCSFile; -import org.jclouds.mezeo.pcs.options.PutBlockOptions; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Implementation of {@link PCSBlobStore} which keeps all data in a local Map object. - * - * @author Adrian Cole - */ -public class StubPCSAsyncClient implements PCSAsyncClient { - public ListenableFuture list() { - throw new UnsupportedOperationException(); - } - - public ListenableFuture list(URI container) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture createContainer(String container) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture createContainer(URI parent, String container) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture deleteContainer(URI container) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture deleteFile(URI file) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture downloadFile(URI file) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture uploadFile(URI container, PCSFile object) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture createFile(URI container, PCSFile object) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture uploadBlock(URI file, PCSFile object, PutBlockOptions... options) { - throw new UnsupportedOperationException(); - } - - public PCSFile newFile() { - throw new UnsupportedOperationException(); - } - - public ListenableFuture getFileInfo(URI file) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture addMetadataItemToMap(URI resource, String key, - Map map) { - throw new UnsupportedOperationException(); - } - - public ListenableFuture putMetadataItem(URI resource, String key, String value) { - throw new UnsupportedOperationException(); - } - -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/options/PutBlockOptionsTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/options/PutBlockOptionsTest.java deleted file mode 100644 index e8a51d2d99..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/options/PutBlockOptionsTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.options; - -import static org.jclouds.mezeo.pcs.options.PutBlockOptions.Builder.range; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; - -import org.jclouds.mezeo.pcs.options.PutBlockOptions; -import org.testng.annotations.Test; - -/** - * Tests possible uses of PutBlockOptions and PutBlockOptions.Builder.* - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "mezeo.PutBlockOptionsTest") -public class PutBlockOptionsTest { - - @Test - public void testRange() { - PutBlockOptions options = new PutBlockOptions(); - options.range(0, 1024); - bytes1to1024(options); - } - - private void bytes1to1024(PutBlockOptions options) { - assertEquals(options.getRange(), "bytes 0-1024/*"); - } - - @Test - public void testRangeZeroToFive() { - PutBlockOptions options = new PutBlockOptions(); - options.range(0, 5); - assertEquals(options.getRange(), "bytes 0-5/*"); - } - - @Test - public void testRangeOverride() { - PutBlockOptions options = new PutBlockOptions(); - options.range(0, 5).range(10, 100); - assertEquals(options.getRange(), "bytes 10-100/*"); - } - - @Test - public void testNullRange() { - PutBlockOptions options = new PutBlockOptions(); - assertNull(options.getRange()); - } - - @Test - public void testRangeStatic() { - PutBlockOptions options = range(0, 1024); - bytes1to1024(options); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRangeNegative1() { - range(-1, 0); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRangeNegative2() { - range(0, -1); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRangeNegative() { - range(-1, -1); - } - -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHanderTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHanderTest.java deleted file mode 100644 index 9642f181de..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/CloudXlinkHanderTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.URI; -import java.util.Map; - -import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.mezeo.pcs.PCSCloudAsyncClient; -import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler; -import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler.PCSCloudResponseImpl; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; - -/** - * Tests behavior of {@code ParseFlavorListFromJsonResponseTest} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.CloudXlinkHanderTest") -public class CloudXlinkHanderTest extends BaseHandlerTest { - Map map = ImmutableMap - . builder() - .put( - "rootContainer", - URI - .create("https://pcsbeta.mezeo.net/v2/containers/0B5C8F50-8E72-11DE-A1D4-D73479DA6257")) - .put("contacts", URI.create("https://pcsbeta.mezeo.net/v2/contacts")).put("shares", - URI.create("https://pcsbeta.mezeo.net/v2/shares")).put("projects", - URI.create("https://pcsbeta.mezeo.net/v2/projects")).put("metacontainers", - URI.create("https://pcsbeta.mezeo.net/v2/metacontainers")).put("account", - URI.create("https://pcsbeta.mezeo.net/v2/account")).put("tags", - URI.create("https://pcsbeta.mezeo.net/v2/tags")).put("recyclebin", - URI.create("https://pcsbeta.mezeo.net/v2/recyclebin")).build(); - - public void testApplyInputStream() { - InputStream is = getClass().getResourceAsStream("/discovery.xml"); - PCSCloudAsyncClient.Response list = new PCSCloudResponseImpl(map); - - PCSCloudAsyncClient.Response result = (PCSCloudAsyncClient.Response) factory.create( - injector.getInstance(CloudXlinkHandler.class)).parse(is); - - assertEquals(result, list); - } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/ContainerHandlerTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/ContainerHandlerTest.java deleted file mode 100644 index 0f78330da9..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/ContainerHandlerTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.URI; - -import org.jclouds.date.DateService; -import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.mezeo.pcs.domain.ContainerList; -import org.jclouds.mezeo.pcs.domain.ResourceInfo; -import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl; -import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl; -import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl; -import org.jclouds.mezeo.pcs.xml.ContainerHandler; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSortedSet; -import com.google.common.collect.Maps; - -/** - * Tests behavior of {@code ContainerHandler} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.ContainerHandlerTest") -public class ContainerHandlerTest extends BaseHandlerTest { - - private DateService dateService; - - @BeforeTest - @Override - protected void setUpInjector() { - super.setUpInjector(); - dateService = injector.getInstance(DateService.class); - assert dateService != null; - } - - public void testApplyInputStream() { - InputStream is = getClass().getResourceAsStream("/test_root_container.xml"); - ImmutableSortedSet list = ImmutableSortedSet - .of( - new ContainerInfoImpl( - URI - .create("https://pcsbeta.mezeo.net/v2/containers/7F143552-AAF5-11DE-BBB0-0BC388ED913B"), - "test1", - dateService.fromSeconds(1254008225), - false, - dateService.fromSeconds(1254008226), - "adrian@jclouds.org", - 1, - true, - dateService.fromSeconds(1254008227), - 1024, - URI - .create("https://pcsbeta.mezeo.net/v2/containers/7F143552-AAF5-11DE-BBB0-0BC388ED913B/contents"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/7F143552-AAF5-11DE-BBB0-0BC388ED913B/tags"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/7F143552-AAF5-11DE-BBB0-0BC388ED913B/metadata"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C")), - new FileInfoImpl( - URI - .create("https://pcsbeta.mezeo.net/v2/files/5C81DADC-AAEE-11DE-9D55-B39340AEFF3A"), - "more", - dateService.fromSeconds(1254005157), - false, - dateService.fromSeconds(1254005158), - "adrian@jclouds.org", - 1, - false, - dateService.fromSeconds(1254005159), - true, - "application/octet-stream", - 254288, - URI - .create("https://pcsbeta.mezeo.net/v2/files/5C81DADC-AAEE-11DE-9D55-B39340AEFF3A/content"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/5C81DADC-AAEE-11DE-9D55-B39340AEFF3A/permissions"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/5C81DADC-AAEE-11DE-9D55-B39340AEFF3A/tags"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/5C81DADC-AAEE-11DE-9D55-B39340AEFF3A/metadata"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/5C81DADC-AAEE-11DE-9D55-B39340AEFF3A/thumbnail")), - - new FileInfoImpl( - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3"), - "testfile.txt", - dateService.fromSeconds(1254000180), - true, - dateService.fromSeconds(1254000181), - "adrian@jclouds.org", - 3, - false, - dateService.fromSeconds(1254000182), - false, - "text/plain", - 5, - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/content"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/permissions"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/tags"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/metadata"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/thumbnail")) - - ); - - ContainerList expects = new ContainerListImpl( - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C"), - "/", - dateService.fromSeconds(1254848007), - false, - dateService.fromSeconds(1255026455), - "adrian@jclouds.org", - 0, - false, - dateService.fromSeconds(1255026455), - 0, - list, - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C/tags"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C/metadata"), - Maps. newHashMap(), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C")); - - ContainerList result = (ContainerList) factory.create( - injector.getInstance(ContainerHandler.class)).parse(is); - - assertEquals(result, expects); - } -} diff --git a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/FileMetadataHandlerTest.java b/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/FileMetadataHandlerTest.java deleted file mode 100644 index 5cb2b0b2a6..0000000000 --- a/sandbox-apis/pcs/src/test/java/org/jclouds/mezeo/pcs/xml/FileMetadataHandlerTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.mezeo.pcs.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.URI; - -import org.jclouds.date.DateService; -import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata; -import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl; -import org.jclouds.mezeo.pcs.xml.FileHandler; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; - -/** - * Tests behavior of {@code FileListToFileMetadataListHandler} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "pcs2.FileMetadataHandlerTest") -public class FileMetadataHandlerTest extends BaseHandlerTest { - - private DateService dateService; - - @BeforeTest - @Override - protected void setUpInjector() { - super.setUpInjector(); - dateService = injector.getInstance(DateService.class); - assert dateService != null; - } - - public void testFileMetadata() { - InputStream is = getClass().getResourceAsStream("/test_file_metadata.xml"); - - FileInfoWithMetadata expects = new FileInfoWithMetadataImpl( - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3"), - "testfile.txt", - dateService.fromSeconds(1254000180), - true, - dateService.fromSeconds(1254000181), - "adrian@jclouds.org", - 3, - false, - dateService.fromSeconds(1254000182), - false, - "text/plain", - 5, - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/content"), - URI - .create("https://pcsbeta.mezeo.net/v2/containers/C4DA95C2-B298-11DE-8D7C-2B1FE4F2B99C"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/permissions"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/tags"), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/metadata"), - // Note that we should convert uppercase to lowercase, since most clouds do anyway - - ImmutableMap - . of( - "foo", - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/metadata/Foo")), - URI - .create("https://pcsbeta.mezeo.net/v2/files/9E4C5AFA-A98B-11DE-8B4C-C3884B4A2DA3/thumbnail")); - - FileInfoWithMetadata result = (FileInfoWithMetadata) factory.create( - injector.getInstance(FileHandler.class)).parse(is); - - assertEquals(result, expects); - } -} diff --git a/sandbox-apis/pcs/src/test/resources/discovery.xml b/sandbox-apis/pcs/src/test/resources/discovery.xml deleted file mode 100644 index b772a48c31..0000000000 --- a/sandbox-apis/pcs/src/test/resources/discovery.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/sandbox-apis/pcs/src/test/resources/log4j.xml b/sandbox-apis/pcs/src/test/resources/log4j.xml deleted file mode 100644 index 0e2c1b2868..0000000000 --- a/sandbox-apis/pcs/src/test/resources/log4j.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-apis/pcs/src/test/resources/test_file_metadata.xml b/sandbox-apis/pcs/src/test/resources/test_file_metadata.xml deleted file mode 100644 index 44b0870302..0000000000 --- a/sandbox-apis/pcs/src/test/resources/test_file_metadata.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - testfile.txt - 1254000180 - true - 1254000181 - adrian@jclouds.org - 3 - False - 1254000182 - false - text/plain - 5 - - - - - - - - - diff --git a/sandbox-apis/pcs/src/test/resources/test_root_container.xml b/sandbox-apis/pcs/src/test/resources/test_root_container.xml deleted file mode 100644 index 660364a2d6..0000000000 --- a/sandbox-apis/pcs/src/test/resources/test_root_container.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - / - 1254848007 - False - 1255026455 - adrian@jclouds.org - 0 - False - 1255026455 - 0 - - - - test1 - 1254008225 - false - 1254008226 - adrian@jclouds.org - 1 - true - 1254008227 - 1024 - - - - - - - more - 1254005157 - false - 1254005158 - adrian@jclouds.org - 1 - false - 1254005159 - true - application/octet-stream - 254288 - - - - - - - - - testfile.txt - 1254000180 - true - 1254000181 - adrian@jclouds.org - 3 - false - 1254000182 - false - text/plain - 5 - - - - - - - - - - - - diff --git a/sandbox-apis/scality-rs2/README.txt b/sandbox-apis/scality-rs2/README.txt deleted file mode 100644 index f32255f9f7..0000000000 --- a/sandbox-apis/scality-rs2/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -# -# The jclouds API for RS2, Scality RING's s3 flavour (http://www.scality.com/scalable-data-storage-technology/). -# -# Expects the jclouds S3 API to be present on your application's classpath. -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. diff --git a/sandbox-apis/scality-rs2/pom.xml b/sandbox-apis/scality-rs2/pom.xml deleted file mode 100644 index b193aa0ee4..0000000000 --- a/sandbox-apis/scality-rs2/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.api - scality-rs2 - jclouds Eucalyptus Walrus api - Simple Storage Service (S3) implementation based on Scality RING RS2 - bundle - - - org.jclouds.scality.rs2.blobstore.ScalityRS2TestInitializer - FIXME_ENDPOINT - 2006-03-01 - - FIXME_IDENTITY - FIXME_CREDENTIAL - - org.jclouds.scality.rs2*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - s3 - ${project.version} - jar - - - org.jclouds.api - s3 - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.scality-rs2.endpoint} - ${test.scality-rs2.api-version} - ${test.scality-rs2.build-version} - ${test.scality-rs2.identity} - ${test.scality-rs2.credential} - ${test.initializer} - ${jclouds.blobstore.httpstream.url} - ${jclouds.blobstore.httpstream.md5} - - - - - - - - - - - - diff --git a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2AsyncClient.java b/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2AsyncClient.java deleted file mode 100644 index 75d60fe0f7..0000000000 --- a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2AsyncClient.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2; - -import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER; - -import org.jclouds.blobstore.attr.BlobScope; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.s3.S3AsyncClient; -import org.jclouds.s3.filters.RequestAuthorizeSignature; - -/** - * - * @author Adrian Cole - */ -@SkipEncoding('/') -@RequestFilters(RequestAuthorizeSignature.class) -@BlobScope(CONTAINER) -public interface ScalityRS2AsyncClient extends S3AsyncClient { - public static final String VERSION = "2006-03-01"; - -} diff --git a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2ContextBuilder.java b/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2ContextBuilder.java deleted file mode 100644 index c62c34392b..0000000000 --- a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2ContextBuilder.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.s3.S3ContextBuilder; -import org.jclouds.scality.rs2.blobstore.config.ScalityRS2BlobStoreContextModule; -import org.jclouds.scality.rs2.config.ScalityRS2RestClientModule; - -import com.google.inject.Module; - -/** - * - * - * @author Adrian Cole - */ -public class ScalityRS2ContextBuilder extends S3ContextBuilder { - - public ScalityRS2ContextBuilder(Properties props) { - super(props); - } - - @Override - protected void addClientModule(List modules) { - modules.add(new ScalityRS2RestClientModule()); - } - @Override - protected void addContextModule(List modules) { - modules.add(new ScalityRS2BlobStoreContextModule()); - } - -} diff --git a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2PropertiesBuilder.java b/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2PropertiesBuilder.java deleted file mode 100644 index 30f1b3e030..0000000000 --- a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/ScalityRS2PropertiesBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2; - -import static org.jclouds.Constants.PROPERTY_API_VERSION; - -import java.util.Properties; - -import org.jclouds.s3.S3PropertiesBuilder; - -/** - * Builds properties used in ScalityRS2 Clients - * - * @author Adrian Cole - */ -public class ScalityRS2PropertiesBuilder extends S3PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_API_VERSION, ScalityRS2AsyncClient.VERSION); - return properties; - } - - public ScalityRS2PropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/blobstore/config/ScalityRS2BlobStoreContextModule.java b/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/blobstore/config/ScalityRS2BlobStoreContextModule.java deleted file mode 100644 index 2c576275a6..0000000000 --- a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/blobstore/config/ScalityRS2BlobStoreContextModule.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore.config; - -import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule; - -/** - * - * @author Adrian Cole - */ -public class ScalityRS2BlobStoreContextModule extends S3BlobStoreContextModule { - -} diff --git a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/config/ScalityRS2RestClientModule.java b/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/config/ScalityRS2RestClientModule.java deleted file mode 100644 index 9ba0907fbb..0000000000 --- a/sandbox-apis/scality-rs2/src/main/java/org/jclouds/scality/rs2/config/ScalityRS2RestClientModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.config; - -import javax.inject.Singleton; - -import org.jclouds.http.RequiresHttp; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.s3.S3AsyncClient; -import org.jclouds.s3.S3Client; -import org.jclouds.s3.config.S3RestClientModule; -import org.jclouds.scality.rs2.ScalityRS2AsyncClient; - -import com.google.inject.Provides; - -/** - * - * @author Adrian Cole - */ -@ConfiguresRestClient -@RequiresHttp -public class ScalityRS2RestClientModule extends S3RestClientModule { - - public ScalityRS2RestClientModule() { - super(S3Client.class, ScalityRS2AsyncClient.class); - } - - @Provides - @Singleton - S3AsyncClient provideS3AsyncClient(ScalityRS2AsyncClient in) { - return in; - } - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2AsyncClientTestDisabled.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2AsyncClientTestDisabled.java deleted file mode 100644 index 5ecf14f70c..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2AsyncClientTestDisabled.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2; - -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.jclouds.s3.S3AsyncClient; -import org.jclouds.s3.S3AsyncClientTest; -import org.testng.annotations.Test; - -import com.google.inject.TypeLiteral; - -/** - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(enabled = false, groups = "unit", testName = "ScalityRS2AsyncClientTest") -public class ScalityRS2AsyncClientTestDisabled extends S3AsyncClientTest { - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - public ScalityRS2AsyncClientTestDisabled() { - this.provider = "scality-rs2"; - this.url = "scality-test.com"; - } - - // TODO parameterize this test so that it can pass -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2ClientLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2ClientLiveTest.java deleted file mode 100644 index 7e4da9f07b..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/ScalityRS2ClientLiveTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2; - -import static org.testng.Assert.assertEquals; - -import org.jclouds.s3.S3ClientLiveTest; -import org.jclouds.s3.domain.S3Object; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code S3Client} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "ScalityRS2ClientLiveTest") -public class ScalityRS2ClientLiveTest extends S3ClientLiveTest { - // no support for content encoding - @Override - protected void assertContentEncoding(S3Object newObject, String string) { - assert (newObject.getPayload().getContentMetadata().getContentEncoding().indexOf(string) != -1); - assert (newObject.getMetadata().getContentMetadata().getContentEncoding().indexOf(string) != -1); - } - - // no support for cache control - @Override - protected void assertCacheControl(S3Object newObject, String string) { - assertEquals(newObject.getMetadata().getCacheControl(), null); - } -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobIntegrationLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobIntegrationLiveTest.java deleted file mode 100644 index de5cee910c..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobIntegrationLiveTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; - -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.blobstore.domain.BlobMetadata; -import org.jclouds.s3.blobstore.integration.S3BlobIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2BlobIntegrationLiveTest") -public class ScalityRS2BlobIntegrationLiveTest extends S3BlobIntegrationLiveTest { - // no support for content language - @Override - protected void checkContentLanguage(Blob blob, String contentLanguage) { - assert blob.getPayload().getContentMetadata().getContentLanguage() == null; - assert blob.getMetadata().getContentMetadata().getContentLanguage() == null; - } - - // double range not supported - @Test(groups = { "integration", "live" }) - @Override - public void testGetTwoRanges() throws InterruptedException, IOException { - - } - - // no md5 - @Override - protected void checkMD5(BlobMetadata metadata) throws IOException { - assertEquals(metadata.getContentMetadata().getContentMD5(), null); - } - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobLiveTest.java deleted file mode 100644 index 8e4eccd932..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobLiveTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import static org.testng.Assert.assertEquals; - -import org.jclouds.s3.blobstore.integration.S3BlobLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2BlobLiveTest") -public class ScalityRS2BlobLiveTest extends S3BlobLiveTest { - - // no md5 - @Override - protected void checkMD5(String container, String name, byte[] md5) { - assertEquals(context.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), null); - } -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobMapIntegrationLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobMapIntegrationLiveTest.java deleted file mode 100644 index 390ccdf5de..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import org.jclouds.s3.blobstore.integration.S3BlobMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2BlobMapIntegrationLiveTest") -public class ScalityRS2BlobMapIntegrationLiveTest extends S3BlobMapIntegrationLiveTest { - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobSignerLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobSignerLiveTest.java deleted file mode 100644 index fa94a83de4..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2BlobSignerLiveTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import org.jclouds.s3.blobstore.integration.S3BlobSignerLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2BlobSignerLiveTest") -public class ScalityRS2BlobSignerLiveTest extends S3BlobSignerLiveTest { - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerIntegrationLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerIntegrationLiveTest.java deleted file mode 100644 index b776c2a375..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerIntegrationLiveTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; - -import org.jclouds.blobstore.domain.BlobMetadata; -import org.jclouds.s3.blobstore.integration.S3ContainerIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2ContainerIntegrationLiveTest") -public class ScalityRS2ContainerIntegrationLiveTest extends S3ContainerIntegrationLiveTest { - // doesn't support MD5 - @Override - protected void checkMD5(BlobMetadata metadata) throws IOException { - assertEquals(metadata.getContentMetadata().getContentMD5(), null); - } -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerLiveTest.java deleted file mode 100644 index 2e270e70e8..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ContainerLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import org.jclouds.s3.blobstore.integration.S3ContainerLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2ContainerLiveTest") -public class ScalityRS2ContainerLiveTest extends S3ContainerLiveTest { - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2InputStreamMapIntegrationLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2InputStreamMapIntegrationLiveTest.java deleted file mode 100644 index f7b211b0eb..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2InputStreamMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import org.jclouds.s3.blobstore.integration.S3InputStreamMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2InputStreamMapIntegrationLiveTest") -public class ScalityRS2InputStreamMapIntegrationLiveTest extends S3InputStreamMapIntegrationLiveTest { - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ServiceIntegrationLiveTest.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ServiceIntegrationLiveTest.java deleted file mode 100644 index 31422ceb02..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2ServiceIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import org.jclouds.s3.blobstore.integration.S3ServiceIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScalityRS2ServiceIntegrationLiveTest") -public class ScalityRS2ServiceIntegrationLiveTest extends S3ServiceIntegrationLiveTest { - -} diff --git a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2TestInitializer.java b/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2TestInitializer.java deleted file mode 100644 index 90008b7281..0000000000 --- a/sandbox-apis/scality-rs2/src/test/java/org/jclouds/scality/rs2/blobstore/ScalityRS2TestInitializer.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scality.rs2.blobstore; - -import org.jclouds.s3.blobstore.integration.S3TestInitializer; - - -/** - * - * @author Adrian Cole - */ -public class ScalityRS2TestInitializer extends S3TestInitializer { - - public ScalityRS2TestInitializer() { - provider = "scality-rs2"; - } - - -} diff --git a/sandbox-apis/simpledb/pom.xml b/sandbox-apis/simpledb/pom.xml deleted file mode 100644 index acfe611455..0000000000 --- a/sandbox-apis/simpledb/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.api - simpledb - jcloud simpledb api - jclouds components to access an implementation of Simple DB - bundle - - - https://sdb.amazonaws.com - 2009-04-15 - - ${test.aws.identity} - ${test.aws.credential} - - org.jclouds.simpledb*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.common - aws-common - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.simpledb.endpoint} - ${test.simpledb.api-version} - ${test.simpledb.build-version} - ${test.simpledb.identity} - ${test.simpledb.credential} - - - - - - - - - - - - diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBAsyncClient.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBAsyncClient.java deleted file mode 100644 index 9a394fb001..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBAsyncClient.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb; - -import static org.jclouds.simpledb.reference.SimpleDBParameters.ACTION; -import static org.jclouds.simpledb.reference.SimpleDBParameters.VERSION; - -import java.util.Map; - -import javax.annotation.Nullable; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; - -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.FormParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.simpledb.binders.BindAttributesToIndexedFormParams; -import org.jclouds.simpledb.domain.Item; -import org.jclouds.simpledb.domain.ListDomainsResponse; -import org.jclouds.simpledb.options.ListDomainsOptions; -import org.jclouds.simpledb.xml.ItemsHandler; -import org.jclouds.simpledb.xml.ListDomainsResponseHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides access to SimpleDB via their REST API. - *

- * - * @author Adrian Cole - * @author Luís A. Bastião Silva - */ -@RequestFilters(FormSigner.class) -@FormParams(keys = VERSION, values = SimpleDBAsyncClient.VERSION) -@VirtualHost -public interface SimpleDBAsyncClient { - public static final String VERSION = "2009-04-15"; - - /** - * @see SimpleDBClient#listDomainsInRegion - */ - @POST - @Path("/") - @FormParams(keys = ACTION, values = "ListDomains") - @XMLResponseParser(ListDomainsResponseHandler.class) - ListenableFuture listDomainsInRegion( - @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, ListDomainsOptions... options); - - /** - * @see SimpleDBClient#createDomainInRegion - */ - @POST - @Path("/") - @FormParams(keys = ACTION, values = "CreateDomain") - ListenableFuture createDomainInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("DomainName") String domainName); - - /** - * @see SimpleDBClient#deleteDomain - */ - @POST - @Path("/") - @FormParams(keys = ACTION, values = "DeleteDomain") - ListenableFuture deleteDomainInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("DomainName") String domainName); - - - /** - * @see SimpleDBClient#putAttributes - */ - @POST - @Path("/") - @FormParams(keys = ACTION, values = "PutAttributes") - ListenableFuture putAttributes(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("DomainName") String domainName, - @FormParam("ItemName") String itemName, - @BinderParam(BindAttributesToIndexedFormParams.class) Item attributes); - - /** - * @see SimpleDBClient#putAttributes - */ - @POST - @Path("/") - @FormParams(keys = ACTION, values = "Select") - @XMLResponseParser(ItemsHandler.class) - ListenableFuture> select(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("SelectExpression") String selectExpression); - - - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBClient.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBClient.java deleted file mode 100644 index 7c4601c13c..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBClient.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb; - -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.annotation.Nullable; - -import org.jclouds.concurrent.Timeout; -import org.jclouds.simpledb.domain.Item; -import org.jclouds.simpledb.domain.ListDomainsResponse; -import org.jclouds.simpledb.options.ListDomainsOptions; - -/** - * Provides access to SimpleDB via their REST API. - *

- * - * @author Adrian Cole - * @author Luís A. Bastião Silva - */ -@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) -public interface SimpleDBClient { - - /** - * The ListDomains operation lists all domains associated with the Access Key ID. It returns - * domain names up to the limit set by MaxNumberOfDomains. A NextToken is returned if there are - * more than MaxNumberOfDomains domains. Calling ListDomains successive times with the NextToken - * returns up to MaxNumberOfDomains more domain names each time. - * - * - * @param region - * Domains are Region-specific. - * @param options - * specify result count or other options - * - * @see - */ - ListDomainsResponse listDomainsInRegion(@Nullable String region, ListDomainsOptions... options); - - /** - * The CreateDomain operation creates a new domain. - * - *

- * The domain name must be unique among the domains associated with the Access Key ID provided in - * the request. The CreateDomain operation might take 10 or more seconds to complete. - * - * - *

Note

- * CreateDomain is an idempotent operation; running it multiple times using the same domain name - * will not result in an error response. - *

- * You can create up to 100 domains per account. - *

- * If you require additional domains, go to - * http://amazon.com/contact-us/simpledb-limit-request/. - * - * @param region - * Domains are Region-specific. - * @param domainName - * The name of the domain to create. The name can range between 3 and 255 characters - * and can contain the following characters: a-z, A-Z, 0-9, '_', '-', and '.'. - * - * @see - */ - void createDomainInRegion(@Nullable String region, String domainName); - - /** - * The DeleteDomain operation deletes a domain. Any items (and their attributes) in the domain - * are deleted as well. The DeleteDomain operation might take 10 or more seconds to complete.

- * Note

- * - * Running DeleteDomain on a domain that does not exist or running the function multiple times - * using the same domain name will not result in an error response. - * - * - * @param region - * Domains are Region-specific. - * @param domainName - * The name of the domain to delete. - * - * - * @see - */ - void deleteDomainInRegion(String region, String domainName); - void putAttributes(String region, String domain, String itemName, Item attributes); - Map select(String region, String selectionExpression); -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBContextBuilder.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBContextBuilder.java deleted file mode 100644 index 2e68b821a3..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBContextBuilder.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule; -import org.jclouds.logging.jdk.config.JDKLoggingModule; -import org.jclouds.rest.RestContextBuilder; -import org.jclouds.simpledb.config.SimpleDBRestClientModule; - -import com.google.inject.Injector; -import com.google.inject.Module; - -/** - * Creates {@link SimpleDBContext} or {@link Injector} instances based on the most commonly requested - * arguments. - *

- * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided. - *

- *

- * If no Modules are specified, the default {@link JDKLoggingModule logging} and - * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed. - * - * @author Adrian Cole - * @author Luís A. Bastião Silva - * @see SimpleDBContext - */ -public class SimpleDBContextBuilder extends RestContextBuilder { - - public SimpleDBContextBuilder(Properties props) { - super(SimpleDBClient.class, SimpleDBAsyncClient.class, props); - } - - @Override - protected void addClientModule(List modules) { - modules.add(new SimpleDBRestClientModule()); - } -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBPropertiesBuilder.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBPropertiesBuilder.java deleted file mode 100644 index 3760f875a4..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/SimpleDBPropertiesBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb; - -import static org.jclouds.Constants.PROPERTY_API_VERSION; -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; -import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; - -import java.util.Properties; - -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in SimpleDB Clients - * - * @author Adrian Cole - */ -public class SimpleDBPropertiesBuilder extends PropertiesBuilder { - - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); - properties.setProperty(PROPERTY_HEADER_TAG, "amz"); - properties.setProperty(PROPERTY_API_VERSION, SimpleDBAsyncClient.VERSION); - properties.setProperty(PROPERTY_ENDPOINT, "https://sdb.amazonaws.com"); - return properties; - } - - public SimpleDBPropertiesBuilder() { - super(); - } - - public SimpleDBPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/binders/BindAttributesToIndexedFormParams.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/binders/BindAttributesToIndexedFormParams.java deleted file mode 100644 index 89107f38c4..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/binders/BindAttributesToIndexedFormParams.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.binders; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static java.lang.String.format; - -import java.util.Collection; -import java.util.Iterator; - -import org.jclouds.simpledb.domain.AttributePair; -import org.jclouds.simpledb.domain.Item; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.utils.ModifyRequest; -import org.jclouds.rest.Binder; - -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.ImmutableMultimap.Builder; - -/** - * - * @author Luís A. Bastião Silva - */ -public class BindAttributesToIndexedFormParams implements Binder { - - private final String attributeName = "Attribute.%d.Name"; - private final String attributeValue = "Attribute.%d.Value"; - private final String attributeReplace = "Attribute.%d.Replace"; - - @Override - public R bindToRequest(R request, Object input) { - checkArgument(checkNotNull(input, "input") instanceof Item, "this binder is only valid for AttributeMap"); - Item attributeMap = (Item) input; - - Builder builder = ImmutableMultimap.builder(); - int amazonOneBasedIndex = 1; // according to docs, counters must start with 1 - for (Map.Entry> entry : attributeMap.getAttributes().entrySet()); - String itemName = entry.getKey(); - - for (AttributePair attr : = entry.getValue()) { - // not null by contract - - String value = attr.getValue(); - - if (value != null) { - builder.put(format(attributeName, amazonOneBasedIndex), attr.getKey()); - builder.put(format(attributeValue, amazonOneBasedIndex), value); - builder.put(format(attributeReplace, amazonOneBasedIndex), String.valueOf(attr.isReplace())); - - } - amazonOneBasedIndex++; - } - - } - ImmutableMultimap forms = builder.build(); - return forms.size() == 0 ? request : ModifyRequest.putFormParams(request, forms); - } - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/config/SimpleDBRestClientModule.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/config/SimpleDBRestClientModule.java deleted file mode 100644 index ae52954c64..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/config/SimpleDBRestClientModule.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.config; - -import org.jclouds.aws.config.FormSigningRestClientModule; -import org.jclouds.http.RequiresHttp; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.simpledb.SimpleDBAsyncClient; -import org.jclouds.simpledb.SimpleDBClient; - -/** - * Configures the SimpleDB connection. - * - * @author Adrian Cole - * @author Luís A. Bastião Silva - */ -@RequiresHttp -@ConfiguresRestClient -public class SimpleDBRestClientModule extends FormSigningRestClientModule { - - public SimpleDBRestClientModule() { - super(SimpleDBClient.class, SimpleDBAsyncClient.class); - } - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/AttributePair.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/AttributePair.java deleted file mode 100644 index c14948934a..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/AttributePair.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.domain; - - - -/** - * AttributePair is a class to support the attributes to put in the SimpleDB - *

- * - * @author Luís A. Bastião Silva - */ -public class AttributePair -{ - - private String key; - private String value; - private boolean replace; - - - /** - * - * Default constructor to represent an attribute in a domain in SimpleDB - * - *

- * - * @param key Name of Attribute - * @param value Value of Attribute - * @param replace Replace value if it already exists in domain - */ - public AttributePair(String key, String value, boolean replace) - { - this.key = key; - - this.value = value ; - this.replace = replace; - } - - - public String getKey() { - return key; - } - - - public String getValue() { - return value; - } - - public void setValue(String value) - { - this.value = value; - } - - - public boolean isReplace() { - return replace; - } - - - - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/DomainMetadata.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/DomainMetadata.java deleted file mode 100644 index e774440578..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/DomainMetadata.java +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.domain; - -import java.util.Date; - -/** - * - * @see - * @author Adrian Cole - * @author Luís A. Bastião Silva - */ -public class DomainMetadata { - private final String region; - private final String name; - private final Date timestamp; - private final long itemCount; - private final long attributeValueCount; - private final long attributeNameCount; - private final long itemNamesSizeBytes; - private final long attributeValuesSizeBytes; - private final long attributeNamesSizeBytes; - - public DomainMetadata(String region, String name, Date timestamp, long itemCount, long attributeValueCount, - long attributeNameCount, long itemNamesSizeBytes, long attributeValuesSizeBytes, long attributeNamesSizeBytes) { - this.region = region; - this.name = name; - this.timestamp = timestamp; - this.itemCount = itemCount; - this.attributeValueCount = attributeValueCount; - this.attributeNameCount = attributeNameCount; - this.itemNamesSizeBytes = itemNamesSizeBytes; - this.attributeValuesSizeBytes = attributeValuesSizeBytes; - this.attributeNamesSizeBytes = attributeNamesSizeBytes; - } - - /** - * - * @return region the domain belongs to - */ - public String getRegion() { - return region; - } - - /** - * - * @return name of the domain - */ - public String getName() { - return name; - } - - /** - * - * @return The number of all items in the domain. - */ - public Date getTimestamp() { - return timestamp; - } - - /** - * - * @return - */ - public long getItemCount() { - return itemCount; - } - - /** - * - * @return The number of all attribute name/value pairs in the domain. - */ - public long getAttributeValueCount() { - return attributeValueCount; - } - - /** - * - * @return The number of unique attribute names in the domain. - */ - public long getAttributeNameCount() { - return attributeNameCount; - } - - /** - * - * @return The total size of all item names in the domain, in bytes. - */ - public long getItemNamesSizeBytes() { - return itemNamesSizeBytes; - } - - /** - * - * @return The total size of all attribute values, in bytes. - */ - public long getAttributeValuesSizeBytes() { - return attributeValuesSizeBytes; - } - - /** - * - * @return The total size of all unique attribute names, in bytes. - */ - public long getAttributeNamesSizeBytes() { - return attributeNamesSizeBytes; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (int) (attributeNameCount ^ (attributeNameCount >>> 32)); - result = prime * result + (int) (attributeNamesSizeBytes ^ (attributeNamesSizeBytes >>> 32)); - result = prime * result + (int) (attributeValueCount ^ (attributeValueCount >>> 32)); - result = prime * result + (int) (attributeValuesSizeBytes ^ (attributeValuesSizeBytes >>> 32)); - result = prime * result + (int) (itemCount ^ (itemCount >>> 32)); - result = prime * result + (int) (itemNamesSizeBytes ^ (itemNamesSizeBytes >>> 32)); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((region == null) ? 0 : region.hashCode()); - result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - DomainMetadata other = (DomainMetadata) obj; - if (attributeNameCount != other.attributeNameCount) - return false; - if (attributeNamesSizeBytes != other.attributeNamesSizeBytes) - return false; - if (attributeValueCount != other.attributeValueCount) - return false; - if (attributeValuesSizeBytes != other.attributeValuesSizeBytes) - return false; - if (itemCount != other.itemCount) - return false; - if (itemNamesSizeBytes != other.itemNamesSizeBytes) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (region == null) { - if (other.region != null) - return false; - } else if (!region.equals(other.region)) - return false; - if (timestamp == null) { - if (other.timestamp != null) - return false; - } else if (!timestamp.equals(other.timestamp)) - return false; - return true; - } - - @Override - public String toString() { - return "[region=" + region + ", name=" + name + ", timestamp=" + timestamp + ", itemCount=" + itemCount - + ", attributeValueCount=" + attributeValueCount + ", attributeNameCount=" + attributeNameCount - + ", itemNamesSizeBytes=" + itemNamesSizeBytes + ", attributeValuesSizeBytes=" + attributeValuesSizeBytes - + ", attributeNamesSizeBytes=" + attributeNamesSizeBytes + "]"; - } - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/Item.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/Item.java deleted file mode 100644 index ccb23b4f93..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/Item.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.domain; - -import javax.annotation.Nullable; - -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Multimap; - -/** - * Defines the mapping of Items - * - * @author Luís A. Bastião Silva - */ -public class Item { - - private final Multimap attributes = LinkedHashMultimap - .create(); - - public Item() { - } - - /** - * Creates a map of Attribute Pair - * - */ - public Item(Multimap attributes) - { - - this.attributes.putAll(attributes); - - } - - public Item addAttributePair(@Nullable String itemName, - AttributePair attrPair) - { - this.attributes.put(itemName, attrPair); - return this; - } - - public Multimap getAttributes() - { - return ImmutableMultimap. builder().putAll( - attributes).build(); - } -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/ListDomainsResponse.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/ListDomainsResponse.java deleted file mode 100644 index 3639e422d9..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/domain/ListDomainsResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.domain; - -import java.util.Set; - -/** - * - * @author Adrian Cole - * @author Luís A. Bastião Silva - * @see - */ -public interface ListDomainsResponse extends Set { - - /** - * An opaque token indicating that there are more than MaxNumberOfDomains domains still - * available. - */ - String getNextToken(); - -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/options/ListDomainsOptions.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/options/ListDomainsOptions.java deleted file mode 100644 index 7d02ac54e1..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/options/ListDomainsOptions.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.options; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Contains options supported in the Form API for the ListDomains operation.

- * Usage

The recommended way to instantiate a ListDomainsOptions object is to statically import - * ListDomainsOptions.Builder.* and invoke a static creation method followed by an instance mutator - * (if needed): - *

- * - * import static org.jclouds.simpledb.options.ListDomainsOptions.Builder.* - *

- * SimpleDBClient connection = // get connection - * Set domains = connection.listDomainsInRegion(maxNumberOfDomains(1)); - * - * - * @author Adrian Cole - * @author Luís A. Bastião Silva - * @see - */ -public class ListDomainsOptions extends BaseHttpRequestOptions { - - /** - * The maximum number of domain names you want returned. - * - * @param maxNumberOfDomains - * Maximum 100 - */ - public ListDomainsOptions maxNumberOfDomains(int maxNumberOfDomains) { - checkArgument(maxNumberOfDomains > 0 && maxNumberOfDomains <= 100, "must be between 1-100"); - formParameters.put("MaxNumberOfDomains", maxNumberOfDomains + ""); - return this; - } - - public String getMaxNumberOfDomains() { - return getFirstFormOrNull("MaxNumberOfDomains"); - } - - /** - * - * @param nextToken - * tells Amazon SimpleDB where to start the next list of domain names. - */ - public ListDomainsOptions nextToken(String nextToken) { - checkNotNull(nextToken, "nextToken"); - formParameters.put("NextToken", nextToken); - return this; - } - - /** - * - * @return String that tells Amazon SimpleDB where to start the next list of domain names. - */ - public String getNextToken() { - return getFirstFormOrNull("NextToken"); - } - - public static class Builder { - - /** - * @see ListDomainsOptions#nextToken - */ - public static ListDomainsOptions nextToken(String nextToken) { - ListDomainsOptions options = new ListDomainsOptions(); - return options.nextToken(nextToken); - } - - /** - * @see ListDomainsOptions#maxNumberOfDomains - */ - public static ListDomainsOptions maxNumberOfDomains(int maxNumberOfDomains) { - ListDomainsOptions options = new ListDomainsOptions(); - return options.maxNumberOfDomains(maxNumberOfDomains); - } - - } -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/package-info.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/package-info.java deleted file mode 100644 index e08a24bd31..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * - * @see - * @author Adrian Cole - * @author Luís A. Bastião Silva - */ -package org.jclouds.simpledb; diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/SimpleDBParameters.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/SimpleDBParameters.java deleted file mode 100644 index d66f5d08c5..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/SimpleDBParameters.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.reference; - -/** - * Configuration properties and constants used in SimpleDB connections. - * - * @see - * @author Adrian Cole - * @author Luís A. Bastião Silva - */ -public interface SimpleDBParameters { - - /** - * The action to perform. For example: CreateDomain. - */ - public static final String ACTION = "Action"; - - /** - * The API version to use, as specified in the WSDL. For example: 2009-02-01. - */ - public static final String VERSION = "Version"; - - /** - * Your Access Key ID. For example: 0AS7253JW73RRM652K02. For more information, see Your AWS - * Identifiers in the Amazon SimpleDB Developer Guide. - */ - public static final String AWS_ACCESS_KEY_ID = "AWSAccessKeyId"; - - /** - * The date and time the request is signed, in the format YYYY-MM-DDThh:mm:ssZ, as specified in - * the ISO 8601 standard. Query requests must include either Timestamp or Expires, but not both. - * - */ - public static final String TIMESTAMP = "Timestamp"; - - /** - * The date and time at which the signature included in the request expires, in the format - * YYYY-MM-DDThh:mm:ssZ, as specified in the ISO 8601 standard. Query requests must include - * either Timestamp or Expires, but not both. - */ - public static final String EXPIRES = "Expires"; - /** - * A request signature (for information, see Request Authentication in the Amazon SimpleDB Developer - * Guide). For example: Qnpl4Qk/7tINHzfXCiT7VbBatDA=. - */ - public static final String SIGNATURE = "Signature"; - /** - *Required when you use signature version 2 with Query requests. For more information, see Query - * Request Authentication in the Amazon SimpleDB Developer Guide. - */ - public static final String SIGNATURE_METHOD = "SignatureMethod"; - /** - * For more information, see Query Request Authentication in the Amazon SimpleDB Developer Guide. - */ - public static final String SIGNATURE_VERSION = "SignatureVersion"; -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/package-info.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/package-info.java deleted file mode 100644 index 51d91c2d6d..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/reference/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * This package contains properties and reference data used in SimpleDB. - * @author Adrian Cole - */ -package org.jclouds.simpledb.reference; diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ItemsHandler.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ItemsHandler.java deleted file mode 100644 index aba7373ca1..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ItemsHandler.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.xml; - -import java.util.Map; - -import org.jclouds.date.DateService; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.simpledb.domain.AttributePair; -import org.jclouds.simpledb.domain.Item; -import org.xml.sax.Attributes; - -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; -import com.google.inject.Inject; - -/** - * - * @author Luís A. Bastião Silva - */ -public class ItemsHandler extends - ParseSax.HandlerWithResult> { - private StringBuilder currentText = new StringBuilder(); - - private Map items = Maps.newConcurrentMap(); - private Multimap attributes = LinkedHashMultimap.create(); - private String attributeName; - private String attributeValue = ""; - private String itemName; - - private boolean inside = false; - - protected final DateService dateService; - - @Inject - public ItemsHandler(DateService dateService) { - this.dateService = dateService; - } - - public Map getResult() { - return items; - } - - public void startElement(String uri, String localName, String qName, Attributes attributes) - { - if (qName.equals("Attribute")) { - inside = true; - } - } - - public void endElement(String uri, String name, String qName) - { - if (qName.equals("Attribute")) - { - inside = false; - - - System.out.println("AttributeName: " + attributeName); - System.out.println("AttributeValue: " + attributeValue); - } - else if(qName.equals("Name")) { - if (inside) - attributeName = currentText.toString().trim(); - else - itemName = currentText.toString().trim(); - - } else if (qName.equals("Value")) - { - attributeValue = currentText.toString().trim(); - - attributes.put(attributeName,new AttributePair(attributeName, - attributeValue, false)); - } - else if (qName.equals("Item")) - { - System.out.println("ItemName: " + itemName); - - Item item = new Item(attributes); - items.put(itemName, item); - attributes = LinkedHashMultimap.create(); - this.attributeName = null; - this.attributeValue = null; - this.itemName = null; - inside = false; - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } -} diff --git a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ListDomainsResponseHandler.java b/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ListDomainsResponseHandler.java deleted file mode 100644 index 26e7d6e86d..0000000000 --- a/sandbox-apis/simpledb/src/main/java/org/jclouds/simpledb/xml/ListDomainsResponseHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.xml; - -import java.util.LinkedHashSet; -import java.util.Set; - -import org.jclouds.simpledb.domain.ListDomainsResponse; -import org.jclouds.http.functions.ParseSax; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * Parses the following XML document: - *

- * ListDomainsResponse - * - * @author Adrian Cole - * @author Luís A. Bastião Silva - * @see - */ -public class ListDomainsResponseHandler extends ParseSax.HandlerWithResult { - private StringBuilder currentText = new StringBuilder(); - - private Set domains = Sets.newLinkedHashSet(); - private String nextToken; - - @Override - public ListDomainsResponse getResult() { - return new ListDomainsResponseImpl(domains, nextToken); - } - - public static class ListDomainsResponseImpl extends LinkedHashSet implements ListDomainsResponse { - - private final String nextToken; - - public ListDomainsResponseImpl(Iterable domains, String nextToken) { - Iterables.addAll(this, domains); - this.nextToken = nextToken; - } - - @Override - public String getNextToken() { - return nextToken; - } - - } - - public void endElement(String uri, String name, String qName) { - if (qName.equals("DomainName")) { - domains.add(currentText.toString().trim()); - } else if (qName.equals("NextToken")) { - if (!currentText.toString().equals("")) - this.nextToken = currentText.toString().trim(); - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } - -} diff --git a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java deleted file mode 100644 index 105df02838..0000000000 --- a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBAsyncClientTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Map; -import java.util.Properties; - -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.jclouds.simpledb.config.SimpleDBRestClientModule; -import org.jclouds.simpledb.options.ListDomainsOptions; -import org.jclouds.simpledb.xml.ListDomainsResponseHandler; -import org.testng.annotations.Test; - -import com.google.inject.Module; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code SimpleDBAsyncClient} - * - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "SimpleDBAsyncClientTest") -public class SimpleDBAsyncClientTest extends RestClientTest { - - protected String provider = "simpledb"; - - @RequiresHttp - @ConfiguresRestClient - private static final class TestSimpleDBRestClientModule extends SimpleDBRestClientModule { - } - - public void testListDomainsInRegion() throws SecurityException, NoSuchMethodException, IOException { - Method method = SimpleDBAsyncClient.class.getMethod("listDomainsInRegion", String.class, - ListDomainsOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method); - - assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2009-04-15&Action=ListDomains", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, ListDomainsResponseHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testCreateDomainInRegion() throws SecurityException, NoSuchMethodException, IOException { - Method method = SimpleDBAsyncClient.class.getMethod("createDomainInRegion", String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, null, "domainName"); - - assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2009-04-15&Action=CreateDomain&DomainName=domainName", - "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - // TODO fix this test as it has the wrong arg type - @Test(enabled = false) - public void testPutAttributes() throws SecurityException, NoSuchMethodException, IOException { - Method method = SimpleDBAsyncClient.class.getMethod("putAttributes", String.class, String.class, Map.class); - GeneratedHttpRequest request = processor.createRequest(method, null, "domainName"); - - assertRequestLineEquals(request, "POST https://sdb.amazonaws.com/ HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Host: sdb.amazonaws.com\n"); - assertPayloadEquals(request, "Version=2009-04-15&Action=PutAttributes&DomainName=domainName&ItemName=itemName" - + "&Attribute.1.Name=name" + "&Attribute.1.Value=fuzzy" + "&Attribute.1.Replace=true", - "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), FormSigner.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - protected Module createModule() { - return new TestSimpleDBRestClientModule(); - } - - @Override - public RestContextSpec createContextSpec() { - // TODO take this out, when the service is registered in jclouds-core/rest.properties - Properties restProperties = new Properties(); - restProperties.setProperty(provider + ".contextbuilder", SimpleDBContextBuilder.class.getName()); - restProperties.setProperty(provider + ".propertiesbuilder", SimpleDBPropertiesBuilder.class.getName()); - return new RestContextFactory(restProperties).createContextSpec(provider, "foo", "bar", getProperties()); - } - -} diff --git a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBClientLiveTest.java b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBClientLiveTest.java deleted file mode 100644 index dc60197dfb..0000000000 --- a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/SimpleDBClientLiveTest.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertNotNull; - -import java.util.Properties; -import java.util.Set; -import java.util.SortedSet; - -import org.jclouds.Constants; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.simpledb.domain.ListDomainsResponse; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; -import com.google.inject.Module; - -/** - * Tests behavior of {@code SimpleDBClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true) -public class SimpleDBClientLiveTest { - - protected SimpleDBClient client; - - private RestContext context; - - protected Set domains = Sets.newHashSet(); - protected String provider = "simpledb"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; - - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); - credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider - + ".credential"); - endpoint = System.getProperty("test." + provider + ".endpoint"); - apiVersion = System.getProperty("test." + provider + ".api-version"); - } - - protected Properties setupProperties() { - Properties overrides = new Properties(); - overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); - overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); - overrides.setProperty(provider + ".identity", identity); - if (credential != null) - overrides.setProperty(provider + ".credential", credential); - if (endpoint != null) - overrides.setProperty(provider + ".endpoint", endpoint); - if (apiVersion != null) - overrides.setProperty(provider + ".api-version", apiVersion); - return overrides; - } - - @BeforeGroups(groups = { "live" }) - public void setupClient() { - setupCredentials(); - Properties overrides = setupProperties(); - context = new RestContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule()), - overrides); - this.client = context.getApi(); - } - - @Test - protected void testListDomains() throws InterruptedException { - listDomainInRegion(null); - } - - protected void listDomainInRegion(String region) throws InterruptedException { - SortedSet allResults = Sets.newTreeSet(client.listDomainsInRegion(region)); - assertNotNull(allResults); - if (allResults.size() >= 1) { - String domain = allResults.last(); - assertDomainInList(region, domain); - } - } - - public static final String PREFIX = System.getProperty("user.name") + "-simpledb"; - - protected String createDomainInRegion(String region, String domainName) throws InterruptedException { - try { - SortedSet result = Sets.newTreeSet(client.listDomainsInRegion(region)); - if (result.size() >= 1) { - client.deleteDomainInRegion(region, result.last()); - domainName += 1;// cannot recreate a domain within 60 seconds - } - } catch (Exception e) { - - } - client.createDomainInRegion(region, domainName); - - // TODO get the domain metadata and ensure the region is correct - - // if (region != null) - // assertEquals(domain.getRegion(), region); - // assertEquals(domain.getName(), domainName); - assertDomainInList(region, domainName); - domains.add(domainName); - return domainName; - } - - @Test - protected void testCreateDomain() throws InterruptedException { - createDomainInRegion(null, PREFIX + "1"); - } - - protected void assertDomainInList(final String region, final String domain) throws InterruptedException { - assertEventually(new Runnable() { - public void run() { - ListDomainsResponse domains = client.listDomainsInRegion(region); - assert domains.contains(domain) : domain + " not in " + domains; - } - }); - } - - private static final int INCONSISTENCY_WINDOW = 10000; - - /** - * Due to eventual consistency, container commands may not return correctly immediately. Hence, - * we will try up to the inconsistency window to see if the assertion completes. - */ - protected static void assertEventually(Runnable assertion) throws InterruptedException { - long start = System.currentTimeMillis(); - AssertionError error = null; - for (int i = 0; i < 30; i++) { - try { - assertion.run(); - if (i > 0) - System.err.printf("%d attempts and %dms asserting %s%n", i + 1, System.currentTimeMillis() - start, - assertion.getClass().getSimpleName()); - return; - } catch (AssertionError e) { - error = e; - } - Thread.sleep(INCONSISTENCY_WINDOW / 30); - } - if (error != null) - throw error; - } - - @AfterTest - public void shutdown() { - context.close(); - } -} diff --git a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/options/ListDomainsOptionsTest.java b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/options/ListDomainsOptionsTest.java deleted file mode 100644 index e6c6de3eef..0000000000 --- a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/options/ListDomainsOptionsTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.options; - -import static org.jclouds.simpledb.options.ListDomainsOptions.Builder.maxNumberOfDomains; -import static org.jclouds.simpledb.options.ListDomainsOptions.Builder.nextToken; -import static org.testng.Assert.assertEquals; - -import org.jclouds.http.options.HttpRequestOptions; -import org.testng.annotations.Test; - -/** - * Tests possible uses of ListDomainsOptions and ListDomainsOptions.Builder.* - * - * @author Adrian Cole - */ -public class ListDomainsOptionsTest { - - @Test - public void testAssignability() { - assert HttpRequestOptions.class.isAssignableFrom(ListDomainsOptions.class); - assert !String.class.isAssignableFrom(ListDomainsOptions.class); - } - - @Test - public void testNextToken() { - ListDomainsOptions options = new ListDomainsOptions(); - options.nextToken("test"); - assertEquals(options.buildFormParameters().get("NextToken"), ImmutableList.of("test")); - } - - @Test - public void testNullNextToken() { - ListDomainsOptions options = new ListDomainsOptions(); - assertEquals(options.buildFormParameters().get("NextToken"), ImmutableList.of()); - } - - @Test - public void testNextTokenStatic() { - ListDomainsOptions options = nextToken("test"); - assertEquals(options.buildFormParameters().get("NextToken"), ImmutableList.of("test")); - } - - public void testInvalidMaxNumberOfDomainsZero() { - maxNumberOfDomains(0); - } - - public void testInvalidMaxNumberOfDomainsOver100() { - maxNumberOfDomains(101); - } - - @Test - public void testMaxNumberOfDomains() { - ListDomainsOptions options = new ListDomainsOptions(); - options.maxNumberOfDomains(1); - assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), ImmutableList.of("1")); - } - - @Test - public void testNullMaxNumberOfDomains() { - ListDomainsOptions options = new ListDomainsOptions(); - assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), ImmutableList.of()); - } - - @Test - public void testMaxNumberOfDomainsStatic() { - ListDomainsOptions options = maxNumberOfDomains(1); - assertEquals(options.buildFormParameters().get("MaxNumberOfDomains"), ImmutableList.of("1")); - } - -} diff --git a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/xml/ListDomainsResponseHandlerTest.java b/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/xml/ListDomainsResponseHandlerTest.java deleted file mode 100644 index 94424d3c9f..0000000000 --- a/sandbox-apis/simpledb/src/test/java/org/jclouds/simpledb/xml/ListDomainsResponseHandlerTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.simpledb.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; - -import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.simpledb.domain.ListDomainsResponse; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code ListDomainsResponseHandler} - * - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "ListDomainsResponseHandlerTest") -public class ListDomainsResponseHandlerTest extends BaseHandlerTest { - - public void test() { - InputStream is = getClass().getResourceAsStream("/list_domains.xml"); - - ListDomainsResponse result = factory.create(injector.getInstance(ListDomainsResponseHandler.class)).parse(is); - - assertEquals( - result, - new ListDomainsResponseHandler.ListDomainsResponseImpl(ImmutableSet.of("Domain1-200706011651", - "Domain2-200706011652"), "TWV0ZXJpbmdUZXN0RG9tYWluMS0yMDA3MDYwMTE2NTY")); - - } -} diff --git a/sandbox-apis/simpledb/src/test/resources/list_domains.xml b/sandbox-apis/simpledb/src/test/resources/list_domains.xml deleted file mode 100644 index bd5595c2c4..0000000000 --- a/sandbox-apis/simpledb/src/test/resources/list_domains.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Domain1-200706011651 - Domain2-200706011652 - TWV0ZXJpbmdUZXN0RG9tYWluMS0yMDA3MDYwMTE2NTY= - - - eb13162f-1b95-4511-8b12-489b86acfd28 - 0.0000219907 - - \ No newline at end of file diff --git a/sandbox-apis/simpledb/src/test/resources/log4j.xml b/sandbox-apis/simpledb/src/test/resources/log4j.xml deleted file mode 100644 index bca086b5c6..0000000000 --- a/sandbox-apis/simpledb/src/test/resources/log4j.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-drivers/asynchttpclient/pom.xml b/sandbox-drivers/asynchttpclient/pom.xml deleted file mode 100644 index 5491450aeb..0000000000 --- a/sandbox-drivers/asynchttpclient/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.driver - jclouds-asynchttpclient - jclouds Ning Http Client - Ning Http client - bundle - - - org.jclouds.http.ning*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - jclouds-sona-snapshots-nexus - https://oss.sonatype.org/content/repositories/snapshots - - true - - - - - - - org.jclouds - jclouds-core - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - com.ning - async-http-client - 1.7.4 - - - org.eclipse.jetty - jetty-security - test - - - - diff --git a/sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/NingHttpCommandExecutorService.java b/sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/NingHttpCommandExecutorService.java deleted file mode 100644 index 0202a05bd3..0000000000 --- a/sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/NingHttpCommandExecutorService.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http.ning; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Map.Entry; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import javax.inject.Singleton; -import javax.ws.rs.core.HttpHeaders; - -import org.jclouds.JcloudsVersion; -import org.jclouds.crypto.CryptoStreams; -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpCommandExecutorService; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpRequestFilter; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.handlers.DelegatingErrorHandler; -import org.jclouds.http.handlers.DelegatingRetryHandler; -import org.jclouds.http.internal.BaseHttpCommandExecutorService; -import org.jclouds.io.Payload; -import org.jclouds.io.Payloads; -import org.jclouds.io.payloads.FilePayload; -import org.jclouds.rest.internal.RestAnnotationProcessor; - -import com.google.common.base.Function; -import com.google.common.base.Throwables; -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.io.Closeables; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.Inject; -import com.ning.http.client.AsyncHttpClient; -import com.ning.http.client.Request; -import com.ning.http.client.RequestBuilder; -import com.ning.http.client.Response; -import com.ning.http.client.generators.InputStreamBodyGenerator; - -/** - * Todo Write me - * - * @author Sam Tunnicliffe - * @author Adrian Cole - */ -public class NingHttpCommandExecutorService implements HttpCommandExecutorService { - - //TODO: get async version from maven or something - public static final String USER_AGENT = String.format("jclouds/%s async-http-client/%s", JcloudsVersion.get(), "1.7.4"); - - private final AsyncHttpClient client; - private final ConvertToNingRequest convertToNingRequest; - private final ConvertToJCloudsResponse convertToJCloudsResponse; - private final DelegatingRetryHandler retryHandler; - private final DelegatingErrorHandler errorHandler; - - @Inject - public NingHttpCommandExecutorService(AsyncHttpClient client, ConvertToNingRequest convertToNingRequest, - ConvertToJCloudsResponse convertToJCloudsResponse, DelegatingRetryHandler retryHandler, - DelegatingErrorHandler errorHandler) { - this.client = client; - this.convertToNingRequest = convertToNingRequest; - this.convertToJCloudsResponse = convertToJCloudsResponse; - this.retryHandler = retryHandler; - this.errorHandler = errorHandler; - } - - @Override - public ListenableFuture submit(HttpCommand command) { - try { - for (;;) { - Future responseF = client.executeRequest(convertToNingRequest.apply(command.getCurrentRequest())); - final HttpResponse httpResponse = convertToJCloudsResponse.apply(responseF.get()); - int statusCode = httpResponse.getStatusCode(); - if (statusCode >= 300) { - if (retryHandler.shouldRetryRequest(command, httpResponse)) { - continue; - } else { - errorHandler.handleError(command, httpResponse); - return Futures.immediateFuture(httpResponse); - } - } else { - return Futures.immediateFuture(httpResponse); - } - } - - } catch (IOException e) { - throw Throwables.propagate(e); - } catch (InterruptedException e) { - throw Throwables.propagate(e); - } catch (ExecutionException e) { - throw Throwables.propagate(e); - } - } - - @Singleton - public static class ConvertToNingRequest implements Function { - - public Request apply(HttpRequest request) { - - for (HttpRequestFilter filter : request.getFilters()) { - request = filter.filter(request); - } - - RequestBuilder builder = new RequestBuilder(request.getMethod()); - builder.setUrl(request.getEndpoint().toASCIIString()); - Payload payload = request.getPayload(); - if (payload != null) { - boolean chunked = "chunked".equals(request.getFirstHeaderOrNull("Transfer-Encoding")); - - if (request.getPayload().getContentMetadata().getContentMD5() != null) - builder.addHeader("Content-MD5", CryptoStreams.base64(request.getPayload().getContentMetadata() - .getContentMD5())); - if (request.getPayload().getContentMetadata().getContentType() != null) - builder.addHeader(HttpHeaders.CONTENT_TYPE, request.getPayload().getContentMetadata().getContentType()); - if (request.getPayload().getContentMetadata().getContentLanguage() != null) - builder.addHeader(HttpHeaders.CONTENT_LANGUAGE, request.getPayload().getContentMetadata() - .getContentLanguage()); - if (request.getPayload().getContentMetadata().getContentEncoding() != null) - builder.addHeader(HttpHeaders.CONTENT_ENCODING, request.getPayload().getContentMetadata() - .getContentEncoding()); - if (request.getPayload().getContentMetadata().getContentDisposition() != null) - builder.addHeader("Content-Disposition", request.getPayload().getContentMetadata() - .getContentDisposition()); - if (!chunked) { - Long length = checkNotNull(request.getPayload().getContentMetadata().getContentLength(), - "payload.getContentLength"); - builder.addHeader(HttpHeaders.CONTENT_LENGTH, length.toString()); - } - setPayload(builder, payload); - } else { - builder.addHeader(HttpHeaders.CONTENT_LENGTH, "0"); - } - - builder.addHeader(HttpHeaders.USER_AGENT, USER_AGENT); - for (Map entry : request.getHeaders().entries()) { - builder.addHeader(entry.getKey(), entry.getValue()); - } - - return builder.build(); - } - - void setPayload(RequestBuilder requestBuilder, Payload payload) { - if (payload instanceof FilePayload) { - requestBuilder.setBody(((FilePayload) payload).getRawContent()); - } else { - requestBuilder.setBody(new InputStreamBodyGenerator(payload.getInput())); - } - } - } - - @Singleton - public static class ConvertToJCloudsResponse implements Function { - - public HttpResponse apply(Response nativeResponse) { - - InputStream in = null; - try { - in = BaseHttpCommandExecutorService.consumeOnClose(nativeResponse.getResponseBodyAsStream()); - } catch (IOException e) { - Closeables.closeQuietly(in); - throw propagate(e); - } - - Payload payload = in != null ? Payloads.newInputStreamPayload(in) : null; - Multimap headers = LinkedHashMultimap.create(); - for (Entry> header : nativeResponse.getHeaders()) { - headers.putAll(header.getKey(), header.getValue()); - } - if (payload != null) - payload.getContentMetadata().setPropertiesFromHttpHeaders(headers); - return new HttpResponse(nativeResponse.getStatusCode(), nativeResponse.getStatusText(), payload, - RestAnnotationProcessor.filterOutContentHeaders(headers)); - } - } -} diff --git a/sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/config/NingHttpCommandExecutorServiceModule.java b/sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/config/NingHttpCommandExecutorServiceModule.java deleted file mode 100644 index 9a1d78e152..0000000000 --- a/sandbox-drivers/asynchttpclient/src/main/java/org/jclouds/http/ning/config/NingHttpCommandExecutorServiceModule.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http.ning.config; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorService; -import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl; -import org.jclouds.http.config.ConfiguresHttpCommandExecutorService; -import org.jclouds.http.ning.NingHttpCommandExecutorService; - -import com.google.inject.AbstractModule; -import com.google.inject.Provides; -import com.google.inject.Scopes; -import com.ning.http.client.AsyncHttpClient; -import com.ning.http.client.AsyncHttpClientConfig; - -/** - * Configures {@link NingHttpCommandExecutorService}. - * - * Note that this uses threads - * - * @author Sam Tunnicliffe - * @author Adrian Cole - */ -@ConfiguresHttpCommandExecutorService -public class NingHttpCommandExecutorServiceModule extends AbstractModule { - - @Override - protected void configure() { - bindClient(); - } - - @Singleton - @Provides - AsyncHttpClient provideNingClient() { - AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setFollowRedirects(true) - .build(); - return new AsyncHttpClient(config); - } - - protected void bindClient() { - bind(HttpCommandExecutorService.class).to(NingHttpCommandExecutorService.class).in( - Scopes.SINGLETON); - - bind(TransformingHttpCommandExecutorService.class).to( - TransformingHttpCommandExecutorServiceImpl.class).in(Scopes.SINGLETON); - } - -} diff --git a/sandbox-drivers/asynchttpclient/src/test/java/org/jclouds/http/ning/NingHttpCommandExecutorServiceTest.java b/sandbox-drivers/asynchttpclient/src/test/java/org/jclouds/http/ning/NingHttpCommandExecutorServiceTest.java deleted file mode 100644 index 51d9be9ef6..0000000000 --- a/sandbox-drivers/asynchttpclient/src/test/java/org/jclouds/http/ning/NingHttpCommandExecutorServiceTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.http.ning; - -import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT; -import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS; -import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT; -import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST; -import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT; -import static org.jclouds.Constants.PROPERTY_USER_THREADS; - -import java.util.Properties; - -import org.jclouds.http.BaseHttpCommandExecutorServiceIntegrationTest; -import org.jclouds.http.ning.config.NingHttpCommandExecutorServiceModule; -import org.testng.annotations.Test; - -import com.google.inject.Module; - -/** - * Tests the functionality of the {@link ApacheHCHttpCommandExecutorService} - * - * @author Adrian Cole - */ -@Test(testName = "NingHttpCommandExecutorServiceTest") -public class NingHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorServiceIntegrationTest { - static { - System.setProperty("http.conn-manager.timeout", 1000 + ""); - } - - protected Module createConnectionModule() { - return new NingHttpCommandExecutorServiceModule(); - } - - protected void addConnectionProperties(Properties props) { - props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 20 + ""); - props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + ""); - props.setProperty(PROPERTY_CONNECTION_TIMEOUT, 100 + ""); - props.setProperty(PROPERTY_SO_TIMEOUT, 100 + ""); - props.setProperty(PROPERTY_IO_WORKER_THREADS, 3 + ""); - props.setProperty(PROPERTY_USER_THREADS, 0 + ""); - } -} diff --git a/sandbox-drivers/asynchttpclient/src/test/resources/test.jks b/sandbox-drivers/asynchttpclient/src/test/resources/test.jks deleted file mode 100644 index e641fb5470345f3ca35830613ed9b69262d216ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1365 zcmezO_TO6u1_mY|W&~sQtmK^h(v)H#U+ewrt4%<;T?S1|+YI>FxU|_ASs1mL1Q{7w z8CaT_7X4Ljus&bM7w`G3R_(3u29fEzncQv)@!bD*c;iN|OyTaCv^yWbc>Mtj+(M{S-Vu20q*N)zqn_q`-X2 z8hMY*DUKKKZLNRXqHy-o*+{QNUpNXEurK%ZdFeV;*;k{=(Y{epu43Yo>AdUzt`Yk? zXWzDY78{gIO1x&Us2P_5b0D|`Qf~~ z56`1Z+rKVJQfT4&_ObWmKFt{p2U|5~->!Pel3)0dTXjiMN}|#;Cl)piCOP2dj)x3phObz8#Z{0-6N8|8mZvNl!Z;0Jv1*nFTXqw zCc=Rs!j2)rg(1R?A;Jt7F_07IH8e1=G_Wu*H8nRei2`zs3@nT+p*%u-MYn|K*vQGYLixsM| z56?Rk;-2c;(0P8(SLZqLiyj1Nsm3XYJUO*wd&7(w)4sUeYm}a1$i&RZz=-TTU}P}^ z-6ayRd0+pHZ##sz^PHWVg{8N?YfD*p@=y6r^9{%Ex+Dc~UUQ0zvukGjy7Sfd#6#iI zw?k@n)x4ERs&1;<{#*P+>;39$0aNG2@=iMNX5GbaetBlU`EGu-Haf&mV=2AJ;OAY9 zE;II>@59yw-#@nW_=iOu3#_hod~mte^}Wok#o - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - aws-simpledb - jclouds Amazon SimpleDB provider - SimpleDB implementation targeted to Amazon Web Services - bundle - - - https://sdb.amazonaws.com - 2009-04-15 - - ${test.aws.identity} - ${test.aws.credential} - - org.jclouds.aws.simpledb*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - simpledb - ${project.version} - jar - - - org.jclouds.api - simpledb - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.aws-simpledb.endpoint} - ${test.aws-simpledb.api-version} - ${test.aws-simpledb.build-version} - ${test.aws-simpledb.identity} - ${test.aws-simpledb.credential} - - - - - - - - - - - - diff --git a/sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBPropertiesBuilder.java b/sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBPropertiesBuilder.java deleted file mode 100644 index 6d032262e6..0000000000 --- a/sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBPropertiesBuilder.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.aws.simpledb; - -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.aws.domain.Region.AP_NORTHEAST_1; -import static org.jclouds.aws.domain.Region.AP_SOUTHEAST_1; -import static org.jclouds.aws.domain.Region.EU_WEST_1; -import static org.jclouds.aws.domain.Region.SA_EAST_1; -import static org.jclouds.aws.domain.Region.US_EAST_1; -import static org.jclouds.aws.domain.Region.US_WEST_1; -import static org.jclouds.aws.domain.Region.US_WEST_2; -import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION; - -import java.util.Properties; - -import org.jclouds.aws.domain.Region; - -/** - * Builds properties used in SimpleDB Clients - * - * @author Adrian Cole - */ -public class AWSSimpleDBPropertiesBuilder extends org.jclouds.simpledb.SimpleDBPropertiesBuilder { - - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); - properties.putAll(Region.regionProperties()); - - properties.setProperty(PROPERTY_ENDPOINT, "https://sdb.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + US_EAST_1 + ".endpoint", "https://sdb.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + US_WEST_1 + ".endpoint", - "https://sdb.us-west-1.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + US_WEST_2 + ".endpoint", - "https://sdb.us-west-2.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + SA_EAST_1 + ".endpoint", - "https://sdb.sa-east-1.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + EU_WEST_1 + ".endpoint", - "https://sdb.eu-west-1.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + AP_SOUTHEAST_1 + ".endpoint", - "https://sdb.ap-southeast-1.amazonaws.com"); - properties.setProperty(PROPERTY_REGION + "." + AP_NORTHEAST_1 + ".endpoint", - "https://sdb.ap-northeast-1.amazonaws.com"); - return properties; - } - - public AWSSimpleDBPropertiesBuilder() { - super(); - } - - public AWSSimpleDBPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderMetadata.java b/sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderMetadata.java deleted file mode 100644 index fd47d3d7cb..0000000000 --- a/sandbox-providers/aws-simpledb/src/main/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderMetadata.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.aws.simpledb; - -import java.net.URI; -import java.util.Set; - -import org.jclouds.providers.BaseProviderMetadata; -import org.jclouds.providers.ProviderMetadata; - -import com.google.common.collect.ImmutableSet; - -/** - * Implementation of @ link org.jclouds.types.ProviderMetadata} for Amazon's SimpleDB provider. - * - * @author Adrian Cole - */ -public class AWSSimpleDBProviderMetadata extends BaseProviderMetadata { - - /** - * {@inheritDoc} - */ - @Override - public String getId() { - return "aws-simpledb"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getType() { - return ProviderMetadata.TABLE_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return "Amazon SimpleDB"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getIdentityName() { - return "Access Key ID"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getCredentialName() { - return "Secret Access Key"; - } - - /** - * {@inheritDoc} - */ - @Override - public URI getHomepage() { - return URI.create("http://aws.amazon.com/simpledb"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getConsole() { - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public URI getApiDocumentation() { - return URI.create("http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getLinkedServices() { - return ImmutableSet.of("aws-s3", "aws-ec2", "aws-elb", "aws-simpledb"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getIso3166Codes() { - return ImmutableSet.of("US-VA", "US-CA", "US-OR", "BR-SP", "IE", "SG", "JP-13"); - } -} diff --git a/sandbox-providers/aws-simpledb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/sandbox-providers/aws-simpledb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index 2e3fd4f328..0000000000 --- a/sandbox-providers/aws-simpledb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.aws.simpledb.AWSSimpleDBProviderMetadata diff --git a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java b/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java deleted file mode 100644 index fc80d04831..0000000000 --- a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBAsyncClientTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.aws.simpledb; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Properties; - -import org.jclouds.aws.domain.Region; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.simpledb.SimpleDBAsyncClient; -import org.jclouds.simpledb.SimpleDBAsyncClientTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code SimpleDBAsyncClient} - * - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "aws.SimpleDBAsyncClientTest") -public class AWSSimpleDBAsyncClientTest extends SimpleDBAsyncClientTest { - - public AWSSimpleDBAsyncClientTest() { - this.provider = "aws-simpledb"; - } - - @Override - protected Properties getProperties() { - return RestContextFactory.getPropertiesFromResource("/rest.properties"); - } - - public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException { - Method method = SimpleDBAsyncClient.class.getMethod("createDomainInRegion", String.class, String.class); - for (String region : Region.DEFAULT_REGIONS) { - processor.createRequest(method, region, "domainName"); - } - } - - @Override - public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec(provider, "foo", "bar", getProperties()); - } -} diff --git a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBClientLiveTest.java b/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBClientLiveTest.java deleted file mode 100644 index e9f3e81ef9..0000000000 --- a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBClientLiveTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.aws.simpledb; - -import org.jclouds.aws.domain.Region; -import org.jclouds.simpledb.SimpleDBClientLiveTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code SimpleDBClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "AWSSimpleDBClientLiveTest") -public class AWSSimpleDBClientLiveTest extends SimpleDBClientLiveTest { - public AWSSimpleDBClientLiveTest(){ - provider = "aws-simpledb"; - } - @Test - void testListDomainsInRegion() throws InterruptedException { - for (String region : Region.DEFAULT_REGIONS) { - listDomainInRegion(region); - } - } - - @Test - void testCreateDomainInRegions() throws InterruptedException { - String domainName = PREFIX + "1"; - for (String region : Region.DEFAULT_REGIONS) { - domainName = createDomainInRegion(region, domainName); - } - } - -} diff --git a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderTest.java b/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderTest.java deleted file mode 100644 index 51d600340f..0000000000 --- a/sandbox-providers/aws-simpledb/src/test/java/org/jclouds/aws/simpledb/AWSSimpleDBProviderTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.aws.simpledb; - -import org.jclouds.providers.BaseProviderMetadataTest; -import org.jclouds.providers.ProviderMetadata; -import org.testng.annotations.Test; - -/** - * The AWSSimpleDBProviderTest tests the org.jclouds.providers.AWSSimpleDBProvider class. - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "AWSSimpleDBProviderTest") -public class AWSSimpleDBProviderTest extends BaseProviderMetadataTest { - - public AWSSimpleDBProviderTest() { - super(new AWSSimpleDBProviderMetadata(), ProviderMetadata.TABLE_TYPE); - } -} diff --git a/sandbox-providers/azurequeue/pom.xml b/sandbox-providers/azurequeue/pom.xml deleted file mode 100644 index 1975541a7a..0000000000 --- a/sandbox-providers/azurequeue/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - azurequeue - jcloud azurequeue provider - jclouds components to access Azure Queue Service - bundle - - - https://${jclouds.identity}.queue.core.windows.net - 2009-09-19 - - ${test.azure.identity} - ${test.azure.credential} - - org.jclouds.azurequeue*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.common - azure-common - ${project.version} - jar - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.azurequeue.endpoint} - ${test.azurequeue.api-version} - ${test.azurequeue.build-version} - ${test.azurequeue.identity} - ${test.azurequeue.credential} - - - - - - - - - - - diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueAsyncClient.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueAsyncClient.java deleted file mode 100644 index c3cb995d81..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueAsyncClient.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue; - -import java.util.Set; -import java.util.concurrent.ExecutionException; - -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.jclouds.azure.storage.domain.BoundedSet; -import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication; -import org.jclouds.azure.storage.options.CreateOptions; -import org.jclouds.azure.storage.options.ListOptions; -import org.jclouds.azurequeue.binders.BindToXmlStringPayload; -import org.jclouds.azurequeue.domain.QueueMessage; -import org.jclouds.azurequeue.domain.QueueMetadata; -import org.jclouds.azurequeue.options.GetOptions; -import org.jclouds.azurequeue.options.PutMessageOptions; -import org.jclouds.azurequeue.xml.AccountNameEnumerationResultsHandler; -import org.jclouds.azurequeue.xml.QueueMessagesListHandler; -import org.jclouds.azure.storage.reference.AzureStorageHeaders; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.annotations.XMLResponseParser; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Azure Queue via their REST API. - *

- * The Queue service stores messages that may be read by any client who has access to the storage - * identity. - *

- * A queue can contain an unlimited number of messages, each of which can be up to 8 KB in size. - * Messages are generally added to the end of the queue and retrieved from the front of the queue, - * although first in, first out (FIFO) behavior is not guaranteed. - *

- * If you need to store messages larger than 8 KB, you can store message data as a blob or in a - * table, and then store a reference to the data as a message in a queue. - *

- * All commands return a ListenableFuture of the result from Azure Queue. Any exceptions incurred - * during processing will be wrapped in an {@link ExecutionException} as documented in - * {@link ListenableFuture#get()}. - * - * @see - * @author Adrian Cole - */ -@SkipEncoding('/') -@RequestFilters(SharedKeyLiteAuthentication.class) -@Headers(keys = AzureStorageHeaders.VERSION, values = "2009-09-19") -public interface AzureQueueAsyncClient { - - /** - * @see AzureQueueClient#listQueues - */ - @GET - @XMLResponseParser(AccountNameEnumerationResultsHandler.class) - @Path("/") - @QueryParams(keys = "comp", values = "list") - ListenableFuture> listQueues(ListOptions... listOptions); - - /** - * @see AzureQueueClient#createQueue - */ - @PUT - @Path("/{queue}") - ListenableFuture createQueue(@PathParam("queue") String queue, CreateOptions... options); - - /** - * @see AzureQueueClient#getMessages - */ - @GET - @Path("/{queue}/messages") - @XMLResponseParser(QueueMessagesListHandler.class) - ListenableFuture> getMessages(@PathParam("queue") String queue, - GetOptions... options); - - /** - * @see AzureQueueClient#deleteQueue - */ - @DELETE - @Path("/{queue}") - ListenableFuture deleteQueue(@PathParam("queue") String queue); - - /** - * @see AzureQueueClient#putMessage - */ - @POST - @Path("/{queue}/messages") - ListenableFuture putMessage(@PathParam("queue") String queue, - @BinderParam(BindToXmlStringPayload.class) String message, PutMessageOptions... options); - - /** - * @see AzureQueueClient#clearMessages - */ - @DELETE - @Path("/{queue}/messages") - ListenableFuture clearMessages(@PathParam("queue") String queue); -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueClient.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueClient.java deleted file mode 100644 index 7566cde484..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueClient.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue; - -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - -import org.jclouds.azure.storage.domain.BoundedSet; -import org.jclouds.azure.storage.options.CreateOptions; -import org.jclouds.azure.storage.options.ListOptions; -import org.jclouds.azurequeue.domain.QueueMessage; -import org.jclouds.azurequeue.domain.QueueMetadata; -import org.jclouds.azurequeue.options.GetOptions; -import org.jclouds.azurequeue.options.PutMessageOptions; -import org.jclouds.concurrent.Timeout; -import org.jclouds.http.HttpResponseException; - -import java.util.concurrent.Future; - -/** - * Provides access to Azure Queue via their REST API. - *

- * The Queue service stores messages that may be read by any client who has access to the storage - * identity. - *

- * A queue can contain an unlimited number of messages, each of which can be up to 8 KB in size. - * Messages are generally added to the end of the queue and retrieved from the front of the queue, - * although first in, first out (FIFO) behavior is not guaranteed. - *

- * If you need to store messages larger than 8 KB, you can store message data as a blob or in a - * table, and then store a reference to the data as a message in a queue. - *

- * All commands return a Future of the result from Azure Queue. Any exceptions incurred - * during processing will be wrapped in an {@link ExecutionException} as documented in - * {@link Future#get()}. - * - * @see AzureQueueAsyncClient - * @see - * @author Adrian Cole - */ -@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) -public interface AzureQueueClient { - - /** - * The List Queues operation returns a list of the queues under the specified identity. - *

- * The 2009-07-17 version of the List Queues operation times out after 30 seconds. - * - * @param listOptions - * controls the number or type of results requested - * @see ListOptions - */ - BoundedSet listQueues(ListOptions... listOptions); - - /** - * The Create Queue operation creates a new queue under the specified identity. - *

- * You can specify user-defined metadata as name-value pairs on the queue at the time that it is - * created. - *

- * When a queue with the specified name already exists, the Queue service checks the metadata - * associated with the existing queue. If the existing metadata is identical to the metadata - * specified on the Create Queue request, status code 204 (No Content) is returned. - *

- * If the existing metadata does not match the metadata provided with the Create Queue request, - * the operation fails and status code 409 (Conflict) is returned. Clients can take advantage of - * this behavior to avoid an additional call to check whether a named queue already exists. - * - * @see CreateQueueOptions - * - */ - boolean createQueue(String queue, CreateOptions... options); - - /** - * The Delete Queue operation permanently deletes the specified queue. - * - *

- * When a queue is successfully deleted, the queue is immediately marked for deletion and is no - * longer accessible to clients. The queue is later removed from the Queue service during garbage - * collection. - * - */ - void deleteQueue(String queue); - - /** - * The Put Message operation adds a new message to the back of the message queue. A message may - * be up to 8 KB in size and must be in a format that can be included in an XML request with - * UTF-8 encoding. - * - *

- * - * The message time-to-live specifies how long a message will remain in the queue, from the time - * it is added to the time it is retrieved and deleted. If a message is not retrieved before the - * time-to-live interval expires, the message is removed from the queue. - * - * @throws HttpResponseException - * If the message is too large, the service returns status code 400 (Bad Request). - * - */ - void putMessage(String queue, String message, PutMessageOptions... options); - - /** - * The Clear Messages operation deletes all messages from the specified queue. - * - *

- * If a queue contains a large number of messages, Clear Messages may time out before all - * messages have been deleted. In this case the Queue service will return status code 500 - * (Internal Server Error), with the additional error code OperationTimedOut. If the operation - * times out, the client should continue to retry Clear Messages until it succeeds, to ensure - * that all messages have been deleted. - */ - @Timeout(duration = 10, timeUnit = TimeUnit.MINUTES) - void clearMessages(String queue); - - /** - * The Get Messages operation retrieves one or more messages from the front of the queue. - * - * @param queue - * the name of the queue to retrieve messages from - * @param options - * controls the number of messages to receive and the visibility window - */ - Set getMessages(String queue, GetOptions... options); - -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueProviderMetadata.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueProviderMetadata.java deleted file mode 100644 index 24ba89c9a3..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/AzureQueueProviderMetadata.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue; - -import com.google.common.collect.ImmutableSet; - -import java.net.URI; -import java.util.Set; - -import org.jclouds.providers.BaseProviderMetadata; -import org.jclouds.providers.ProviderMetadata; - -/** - * Implementation of {@link org.jclouds.types.ProviderMetadata} for Microsoft Azure Queue Service. - * - * @author Adrian Cole - */ -public class AzureQueueProviderMetadata extends BaseProviderMetadata { - - /** - * {@inheritDoc} - */ - @Override - public String getId() { - return "azurequeue"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getType() { - return ProviderMetadata.QUEUE_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return "Microsoft Azure Queue Service"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getIdentityName() { - return "Account Name"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getCredentialName() { - return "Access Key"; - } - - /** - * {@inheritDoc} - */ - @Override - public URI getHomepage() { - return URI.create("http://www.microsoft.com/windowsazure/storage/"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getConsole() { - return URI.create("https://windows.azure.com/default.aspx"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getApiDocumentation() { - return URI.create("http://msdn.microsoft.com/en-us/library/dd135733.aspx"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getLinkedServices() { - return ImmutableSet.of("azureblob", "azurequeue", "azuretable"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getIso3166Codes() { - return ImmutableSet.of("US-TX","US-IL","IE-D","SG","NL-NH","HK"); - } - -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/binders/BindToXmlStringPayload.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/binders/BindToXmlStringPayload.java deleted file mode 100644 index ef95a622e5..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/binders/BindToXmlStringPayload.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.binders; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpRequest; -import org.jclouds.rest.binders.BindToStringPayload; - -/** - * Adds an payload to a request. - * - * @author Adrian Cole - */ -@Singleton -public class BindToXmlStringPayload extends BindToStringPayload { - @Override - public R bindToRequest(R request, Object payload) { - return super.bindToRequest(request, new StringBuilder().append("").append(payload) - .append("").toString()); - } -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMessage.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMessage.java deleted file mode 100644 index fb7960bcbb..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMessage.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.domain; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Date; - -/** - * - * @author Adrian Cole - * - */ -public class QueueMessage { - private final String messageId; - private final Date insertionTime; - private final Date expirationTime; - private final int dequeueCount; - private final String popReceipt; - private final Date timeNextVisible; - private final String messageText; - - public QueueMessage(String messageId, Date insertionTime, Date expirationTime, int dequeueCount, - String popReceipt, Date timeNextVisible, String messageText) { - this.messageId = checkNotNull(messageId, "messageId"); - this.insertionTime = checkNotNull(insertionTime, "insertionTime"); - this.expirationTime = checkNotNull(expirationTime, "expirationTime"); - this.dequeueCount = dequeueCount; - checkArgument(dequeueCount >= 0, "dequeueCount not set"); - this.popReceipt = checkNotNull(popReceipt, "popReceipt"); - this.timeNextVisible = checkNotNull(timeNextVisible, "timeNextVisible"); - this.messageText = checkNotNull(messageText, "messageText"); - } - - /** - * The MessageID element is a GUID value that identifies the message in the queue. This value is - * assigned to the message by the Queue service and is opaque to the client. This value may be - * used together with the value of the PopReceipt element to delete a message from the queue - * after it has been retrieved with the Get Messages operation. - * - * - */ - public String getMessageId() { - return messageId; - } - - public Date getInsertionTime() { - return insertionTime; - } - - public Date getExpirationTime() { - return expirationTime; - } - - /** - * DequeueCount element has a value of 1 the first time the message is dequeued. This value is - * incremented each time the message is subsequently dequeued. - * */ - public int getDequeueCount() { - return dequeueCount; - } - - /** - * The value of PopReceipt is opaque to the client; its only purpose is to ensure that a message - * may be deleted with the Delete Message operation. - */ - public String getPopReceipt() { - return popReceipt; - } - - public Date getTimeNextVisible() { - return timeNextVisible; - } - - public String getMessageText() { - return messageText; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + dequeueCount; - result = prime * result + ((expirationTime == null) ? 0 : expirationTime.hashCode()); - result = prime * result + ((insertionTime == null) ? 0 : insertionTime.hashCode()); - result = prime * result + ((messageId == null) ? 0 : messageId.hashCode()); - result = prime * result + ((messageText == null) ? 0 : messageText.hashCode()); - result = prime * result + ((popReceipt == null) ? 0 : popReceipt.hashCode()); - result = prime * result + ((timeNextVisible == null) ? 0 : timeNextVisible.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - QueueMessage other = (QueueMessage) obj; - if (dequeueCount != other.dequeueCount) - return false; - if (expirationTime == null) { - if (other.expirationTime != null) - return false; - } else if (!expirationTime.equals(other.expirationTime)) - return false; - if (insertionTime == null) { - if (other.insertionTime != null) - return false; - } else if (!insertionTime.equals(other.insertionTime)) - return false; - if (messageId == null) { - if (other.messageId != null) - return false; - } else if (!messageId.equals(other.messageId)) - return false; - if (messageText == null) { - if (other.messageText != null) - return false; - } else if (!messageText.equals(other.messageText)) - return false; - if (popReceipt == null) { - if (other.popReceipt != null) - return false; - } else if (!popReceipt.equals(other.popReceipt)) - return false; - if (timeNextVisible == null) { - if (other.timeNextVisible != null) - return false; - } else if (!timeNextVisible.equals(other.timeNextVisible)) - return false; - return true; - } - - @Override - public String toString() { - return "QueueMessage [dequeueCount=" + dequeueCount + ", expirationTime=" + expirationTime - + ", insertionTime=" + insertionTime + ", messageId=" + messageId + ", messageText=" - + messageText + ", popReceipt=" + popReceipt + ", timeNextVisible=" - + timeNextVisible + "]"; - } - -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMetadata.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMetadata.java deleted file mode 100644 index 32ad2f4c9a..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/domain/QueueMetadata.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.domain; - -import java.net.URI; - -/** - * - * @author Adrian Cole - * - */ -public class QueueMetadata implements Comparable { - private final String name; - private final URI url; - - public QueueMetadata(String name, URI url) { - this.name = name; - this.url = url; - } - - @Override - public String toString() { - return "QueueMetadata [name=" + name + ", url=" + url + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((url == null) ? 0 : url.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - QueueMetadata other = (QueueMetadata) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (url == null) { - if (other.url != null) - return false; - } else if (!url.equals(other.url)) - return false; - return true; - } - - public String getName() { - return name; - } - - public URI getUrl() { - return url; - } - - public int compareTo(QueueMetadata o) { - return (this == o) ? 0 : getName().compareTo(o.getName()); - } -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/GetOptions.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/GetOptions.java deleted file mode 100644 index 8dd4435a28..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/GetOptions.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.options; - -import static com.google.common.base.Preconditions.checkArgument; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Contains common options supported in the REST API for the GET operation.

- * Usage

The recommended way to instantiate a GetOptions object is to statically import - * GetOptions.* and invoke a static creation method followed by an instance mutator (if needed): - *

- * - * import static org.jclouds.azurequeue.options.GetOptions.Builder.* - * import org.jclouds.azurequeue.AzureQueueClient; - *

- * AzureQueueClient connection = // get connection - * messages = connection.getMessages("queueName", maxMessages(3)); - * * - * - * @see - * @author Adrian Cole - */ -public class GetOptions extends BaseHttpRequestOptions { - public static final GetOptions NONE = new GetOptions(); - - /** - * A nonzero integer value that specifies the number of messages to retrieve from the queue, up - * to a maximum of 32. By default, a single message is retrieved from the queue with this - * operation. - * - */ - public GetOptions maxMessages(int count) { - checkArgument(count > 0&& count <= 32, "count must be a positive number; max 32"); - queryParameters.replaceValues("numofmessages", ImmutableList.of(count + "")); - return this; - } - - /** - * An integer value that specifies the message's visibility timeout in seconds. The maximum value - * is 2 hours. The default message visibility timeout is 30 seconds. - */ - public GetOptions visibilityTimeout(int timeout) { - checkArgument(timeout > 0 && timeout <= 2 * 60 * 60, - "timeout is in seconds; must be positive and maximum 2 hours"); - queryParameters.replaceValues("visibilitytimeout", ImmutableList.of(timeout + "")); - return this; - } - - public static class Builder { - - /** - * @see GetOptions#maxMessages(int) - */ - public static GetOptions maxMessages(int count) { - GetOptions options = new GetOptions(); - return options.maxMessages(count); - } - - /** - * @see GetOptions#visibilityTimeout(int) - */ - public static GetOptions visibilityTimeout(int visibilityTimeout) { - GetOptions options = new GetOptions(); - return options.visibilityTimeout(visibilityTimeout); - } - } -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/PutMessageOptions.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/PutMessageOptions.java deleted file mode 100644 index 09e01cfcde..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/options/PutMessageOptions.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.options; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Contains options supported in the REST API for the Create Container operation.

- * Usage

The recommended way to instantiate a PutMessageOptions object is to statically - * import PutMessageOptions.* and invoke a static creation method followed by an instance - * mutator (if needed): - *

- * - * import static org.jclouds.azurequeue.options.PutMessageOptions.Builder.* - * import org.jclouds.azurequeue.AzureQueueClient; - *

- * AzureQueueClient connection = // get connection - * connection.putMessage("containerName", withTTL()); - * * - * - * @see - * @author Adrian Cole - */ -public class PutMessageOptions extends BaseHttpRequestOptions { - public static final PutMessageOptions NONE = new PutMessageOptions(); - - /** - * Specifies the time-to-live interval for the message, in seconds. The maximum time-to-live - * allowed is 7 days. If this parameter is omitted, the default time-to-live is 7 days. - */ - public PutMessageOptions withTTL(int seconds) { - this.queryParameters.put("messagettl", seconds + ""); - return this; - } - - public static class Builder { - - /** - * @see PutMessageOptions#withTTL - */ - public static PutMessageOptions withTTL(int seconds) { - PutMessageOptions options = new PutMessageOptions(); - return options.withTTL(seconds); - } - - } -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandler.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandler.java deleted file mode 100644 index 52a95f9a98..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.xml; - -import java.net.URI; -import java.util.Set; - -import javax.inject.Inject; - -import org.jclouds.azure.storage.domain.BoundedSet; -import org.jclouds.azure.storage.domain.internal.BoundedHashSet; -import org.jclouds.azurequeue.domain.QueueMetadata; -import org.jclouds.http.functions.ParseSax; - -import com.google.common.collect.Sets; - -/** - * Parses the following XML document: - *

- * EnumerationResults AccountName="http://myidentity.queue.core.windows.net" - * - * @see - * @author Adrian Cole - */ -public class AccountNameEnumerationResultsHandler extends - ParseSax.HandlerWithResult> { - - private Set metadata = Sets.newLinkedHashSet(); - private URI currentUrl; - private String prefix; - private String marker; - private int maxResults; - private String nextMarker; - private String currentName; - - private StringBuilder currentText = new StringBuilder(); - - @Inject - public AccountNameEnumerationResultsHandler() { - } - - public BoundedSet getResult() { - return new BoundedHashSet(metadata, currentUrl, prefix, marker, maxResults, - nextMarker); - } - - public void endElement(String uri, String name, String qName) { - if (qName.equals("MaxResults")) { - maxResults = Integer.parseInt(currentText.toString().trim()); - } else if (qName.equals("Marker")) { - marker = currentText.toString().trim(); - marker = (marker.equals("")) ? null : marker; - } else if (qName.equals("Prefix")) { - prefix = currentText.toString().trim(); - prefix = (prefix.equals("")) ? null : prefix; - } else if (qName.equals("NextMarker")) { - nextMarker = currentText.toString().trim(); - nextMarker = (nextMarker.equals("")) ? null : nextMarker; - } else if (qName.equals("Queue")) { - metadata.add(new QueueMetadata(currentName, currentUrl)); - currentUrl = null; - currentName = null; - } else if (qName.equals("Url")) { - currentUrl = URI.create(currentText.toString().trim()); - } else if (qName.equals("QueueName")) { - currentName = currentText.toString().trim(); - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } -} diff --git a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/QueueMessagesListHandler.java b/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/QueueMessagesListHandler.java deleted file mode 100644 index 2ff73eae4c..0000000000 --- a/sandbox-providers/azurequeue/src/main/java/org/jclouds/azurequeue/xml/QueueMessagesListHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.xml; - -import java.util.Date; -import java.util.Set; - -import javax.inject.Inject; - -import org.jclouds.azurequeue.domain.QueueMessage; -import org.jclouds.date.DateService; -import org.jclouds.http.functions.ParseSax; - -import com.google.common.collect.Sets; - -/** - * Parses the following XML document: - *

- * QueueMessagesList - * - * @see - * @author Adrian Cole - */ -public class QueueMessagesListHandler extends ParseSax.HandlerWithResult> { - - private Set messages = Sets.newLinkedHashSet(); - - private String messageId; - private Date insertionTime; - private Date expirationTime; - private int dequeueCount; - private String popReceipt; - private Date timeNextVisible; - private String messageText; - - private StringBuilder currentText = new StringBuilder(); - - private final DateService dateService; - - @Inject - public QueueMessagesListHandler(DateService dateService) { - this.dateService = dateService; - } - - public Set getResult() { - return messages; - } - - public void endElement(String uri, String name, String qName) { - if (qName.equals("MessageId")) { - this.messageId = currentText.toString().trim(); - } else if (qName.equals("InsertionTime")) { - this.insertionTime = parseDate(); - } else if (qName.equals("ExpirationTime")) { - this.expirationTime = parseDate(); - } else if (qName.equals("DequeueCount")) { - this.dequeueCount = Integer.parseInt(currentText.toString().trim()); - } else if (qName.equals("PopReceipt")) { - this.popReceipt = currentText.toString().trim(); - } else if (qName.equals("TimeNextVisible")) { - this.timeNextVisible = parseDate(); - } else if (qName.equals("MessageText")) { - // TODO: figure out why we need to do trim. excess leading whitespace seems to be from - // outside the element - this.messageText = currentText.toString().trim(); - } else if (qName.equals("QueueMessage")) { - messages.add(new QueueMessage(messageId, insertionTime, expirationTime, dequeueCount, - popReceipt, timeNextVisible, messageText)); - messageId = null; - insertionTime = null; - expirationTime = null; - dequeueCount = -1; - popReceipt = null; - timeNextVisible = null; - messageText = null; - } - currentText = new StringBuilder(); - } - - private Date parseDate() { - return dateService.rfc822DateParse(currentText.toString().trim()); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } - -} diff --git a/sandbox-providers/azurequeue/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/sandbox-providers/azurequeue/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index add5b002b3..0000000000 --- a/sandbox-providers/azurequeue/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.azurequeue.AzureQueueProviderMetadata diff --git a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueAsyncClientTest.java b/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueAsyncClientTest.java deleted file mode 100644 index 7b240eb1c5..0000000000 --- a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueAsyncClientTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue; - -import static org.jclouds.azure.storage.options.CreateOptions.Builder.withMetadata; -import static org.jclouds.azure.storage.options.ListOptions.Builder.maxResults; -import static org.jclouds.azurequeue.options.GetOptions.Builder.maxMessages; -import static org.jclouds.azurequeue.options.PutMessageOptions.Builder.withTTL; -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Properties; - -import org.jclouds.azure.storage.filters.SharedKeyLiteAuthentication; -import org.jclouds.azure.storage.options.CreateOptions; -import org.jclouds.azure.storage.options.ListOptions; -import org.jclouds.azurequeue.options.GetOptions; -import org.jclouds.azurequeue.options.PutMessageOptions; -import org.jclouds.azurequeue.xml.AccountNameEnumerationResultsHandler; -import org.jclouds.azurequeue.xml.QueueMessagesListHandler; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.http.functions.ReturnTrueIf2xx; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMultimap; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code AzureQueueAsyncClient} - * - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "AzureQueueAsyncClientTest") -public class AzureQueueAsyncClientTest extends RestClientTest { - - public void testGetMessages() throws SecurityException, NoSuchMethodException, IOException { - Method method = AzureQueueAsyncClient.class.getMethod("getMessages", String.class, GetOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, "myqueue"); - - assertRequestLineEquals(request, "GET https://identity.queue.core.windows.net/myqueue/messages HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, QueueMessagesListHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testGetMessagesOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = AzureQueueAsyncClient.class.getMethod("getMessages", String.class, GetOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, "myqueue", maxMessages(1).visibilityTimeout(30)); - - assertRequestLineEquals(request, - "GET https://identity.queue.core.windows.net/myqueue/messages?numofmessages=1&visibilitytimeout=30 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, QueueMessagesListHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testListQueues() throws SecurityException, NoSuchMethodException, IOException { - Method method = AzureQueueAsyncClient.class.getMethod("listQueues", ListOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method); - - assertRequestLineEquals(request, "GET https://identity.queue.core.windows.net/?comp=list HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, AccountNameEnumerationResultsHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testListQueuesOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = AzureQueueAsyncClient.class.getMethod("listQueues", ListOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, maxResults(1).marker("marker").prefix("prefix")); - - assertRequestLineEquals(request, - "GET https://identity.queue.core.windows.net/?comp=list&maxresults=1&marker=marker&prefix=prefix HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ParseSax.class); - assertSaxResponseParserClassEquals(method, AccountNameEnumerationResultsHandler.class); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testCreateQueue() throws SecurityException, NoSuchMethodException, IOException { - Method method = AzureQueueAsyncClient.class.getMethod("createQueue", String.class, CreateOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, "queue"); - - assertRequestLineEquals(request, "PUT https://identity.queue.core.windows.net/queue HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testCreateQueueOptions() throws SecurityException, NoSuchMethodException, IOException { - - Method method = AzureQueueAsyncClient.class.getMethod("createQueue", String.class, CreateOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, "queue", withMetadata(ImmutableMultimap.of("foo", "bar"))); - - assertRequestLineEquals(request, "PUT https://identity.queue.core.windows.net/queue HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-meta-foo: bar\nx-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testDeleteQueue() throws SecurityException, NoSuchMethodException, IOException { - - Method method = AzureQueueAsyncClient.class.getMethod("deleteQueue", String.class); - GeneratedHttpRequest request = processor.createRequest(method, "queue"); - - assertRequestLineEquals(request, "DELETE https://identity.queue.core.windows.net/queue HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testPutMessage() throws SecurityException, NoSuchMethodException, IOException { - - Method method = AzureQueueAsyncClient.class.getMethod("putMessage", String.class, String.class, - PutMessageOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, "queue", "message"); - - assertRequestLineEquals(request, "POST https://identity.queue.core.windows.net/queue/messages HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, "message", - "application/unknown", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testPutMessageOptions() throws SecurityException, NoSuchMethodException, IOException { - - Method method = AzureQueueAsyncClient.class.getMethod("putMessage", String.class, String.class, - PutMessageOptions[].class); - GeneratedHttpRequest request = processor.createRequest(method, "queue", "message", withTTL(3)); - - assertRequestLineEquals(request, - "POST https://identity.queue.core.windows.net/queue/messages?messagettl=3 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, "message", - "application/unknown", false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testClearMessages() throws SecurityException, NoSuchMethodException, IOException { - - Method method = AzureQueueAsyncClient.class.getMethod("clearMessages", String.class); - GeneratedHttpRequest request = processor.createRequest(method, "queue"); - - assertRequestLineEquals(request, "DELETE https://identity.queue.core.windows.net/queue/messages HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "x-ms-version: 2009-09-19\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec("azurequeue", "identity", "credential", new Properties()); - } - -} diff --git a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueClientLiveTest.java b/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueClientLiveTest.java deleted file mode 100644 index 054dc021ab..0000000000 --- a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueClientLiveTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.azure.storage.options.ListOptions.Builder.prefix; -import static org.jclouds.azurequeue.options.GetOptions.Builder.maxMessages; -import static org.jclouds.azurequeue.options.PutMessageOptions.Builder.withTTL; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.security.SecureRandom; -import java.util.Properties; -import java.util.Set; - -import org.jclouds.Constants; -import org.jclouds.azure.storage.domain.BoundedSet; -import org.jclouds.azure.storage.options.CreateOptions; -import org.jclouds.azurequeue.domain.QueueMessage; -import org.jclouds.azurequeue.domain.QueueMetadata; -import org.jclouds.http.HttpResponseException; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.rest.RestContextFactory; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.inject.Module; - -/** - * Tests behavior of {@code AzureQueueClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true) -public class AzureQueueClientLiveTest { - - protected AzureQueueClient connection; - - private String queuePrefix = System.getProperty("user.name") + "-azurequeue"; - protected String provider = "azurequeue"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; - - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); - credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider - + ".credential"); - endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint"); - apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider - + ".api-version"); - } - - protected Properties setupProperties() { - Properties overrides = new Properties(); - overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); - overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); - overrides.setProperty(provider + ".identity", identity); - overrides.setProperty(provider + ".credential", credential); - overrides.setProperty(provider + ".endpoint", endpoint); - overrides.setProperty(provider + ".api-version", apiVersion); - return overrides; - } - - @BeforeGroups(groups = { "live" }) - public void setupClient() { - setupCredentials(); - Properties overrides = setupProperties(); - - connection = (AzureQueueClient) new RestContextFactory().createContext(provider, - ImmutableSet. of(new Log4JLoggingModule()), overrides).getApi(); - } - - @Test - public void testListQueues() throws Exception { - - BoundedSet response = connection.listQueues(); - assert null != response; - long initialQueueCount = response.size(); - assertTrue(initialQueueCount >= 0); - - } - - String privateQueue; - - @Test(timeOut = 5 * 60 * 1000) - public void testCreateQueue() throws Exception { - boolean created = false; - while (!created) { - privateQueue = queuePrefix + new SecureRandom().nextInt(); - try { - created = connection.createQueue(privateQueue, CreateOptions.Builder.withMetadata(ImmutableMultimap.of( - "foo", "bar"))); - } catch (HttpResponseException htpe) { - if (htpe.getResponse().getStatusCode() == 409) { - continue; - } else { - throw htpe; - } - } - } - BoundedSet response = connection.listQueues(); - assert null != response; - long queueCount = response.size(); - assertTrue(queueCount >= 1); - // TODO ... check to see the queue actually exists - } - - @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateQueue" }) - public void testListQueuesWithOptions() throws Exception { - BoundedSet response = connection.listQueues(prefix(privateQueue).maxResults(1)); - assert null != response; - long initialQueueCount = response.size(); - assertTrue(initialQueueCount >= 0); - assertEquals(privateQueue, response.getPrefix()); - assertEquals(1, response.getMaxResults()); - } - - @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateQueue" }) - public void testPutMessage() throws Exception { - connection.putMessage(privateQueue, "holycow", withTTL(4)); - connection.putMessage(privateQueue, "holymoo", withTTL(4)); - } - - @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testPutMessage" }) - public void testGetMessages() throws Exception { - Set messages = connection.getMessages(privateQueue, maxMessages(2)); - QueueMessage m1 = Iterables.get(messages, 0); - assertEquals(m1.getMessageText(), "holycow"); - QueueMessage m2 = Iterables.get(messages, 1); - assertEquals(m2.getMessageText(), "holymoo"); - assertEquals(connection.getMessages(privateQueue).size(), 0); - } - - @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testGetMessages" }) - public void testDeleteQueue() throws Exception { - connection.clearMessages(privateQueue); - connection.deleteQueue(privateQueue); - // TODO loop for up to 30 seconds checking if they are really gone - } - -} diff --git a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueProviderTest.java b/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueProviderTest.java deleted file mode 100644 index 2eac5b3989..0000000000 --- a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/AzureQueueProviderTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue; - -import org.jclouds.providers.BaseProviderMetadataTest; -import org.jclouds.providers.ProviderMetadata; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "AzureQueueProviderTest") -public class AzureQueueProviderTest extends BaseProviderMetadataTest { - - public AzureQueueProviderTest() { - super(new AzureQueueProviderMetadata(), ProviderMetadata.QUEUE_TYPE); - } -} diff --git a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/options/GetOptionsTest.java b/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/options/GetOptionsTest.java deleted file mode 100644 index 0e0ef1094a..0000000000 --- a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/options/GetOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.options; - -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; - -/** - * Tests behavior of {@code GetOptions} - * - * @author Adrian Cole - */ -@Test(groups = "unit") -public class GetOptionsTest { - - public void testMaxMessages() { - GetOptions options = new GetOptions().maxMessages(1); - assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("numofmessages")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testMaxMessagesTooSmall() { - new GetOptions().maxMessages(0); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testMaxMessagesTooBig() { - new GetOptions().maxMessages(33); - } - - public void testMaxMessagesStatic() { - GetOptions options = GetOptions.Builder.maxMessages(1); - assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("numofmessages")); - } - - public void testVisibilityTimeout() { - GetOptions options = new GetOptions().visibilityTimeout(1); - assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("visibilitytimeout")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testVisibilityTimeoutTooSmall() { - new GetOptions().visibilityTimeout(0); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testVisibilityTimeoutTooBig() { - new GetOptions().visibilityTimeout((2 * 60 * 60) + 1); - } - - public void testVisibilityTimeoutStatic() { - GetOptions options = GetOptions.Builder.visibilityTimeout(1); - assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("visibilitytimeout")); - } - -} diff --git a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandlerTest.java b/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandlerTest.java deleted file mode 100644 index e094dbb697..0000000000 --- a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/AccountNameEnumerationResultsHandlerTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.URI; - -import org.jclouds.azure.storage.domain.BoundedSet; -import org.jclouds.azure.storage.domain.internal.BoundedHashSet; -import org.jclouds.azurequeue.domain.QueueMetadata; -import org.jclouds.http.functions.BaseHandlerTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSortedSet; - -/** - * Tests behavior of {@code AccountNameEnumerationResultsHandler} - * - * @author Adrian Cole - */ -//NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "queue.AccountNameEnumerationResultsHandlerTest") -public class AccountNameEnumerationResultsHandlerTest extends BaseHandlerTest { - - public void testApplyInputStream() { - InputStream is = getClass().getResourceAsStream("/test_list_queues.xml"); - BoundedSet list = new BoundedHashSet(ImmutableSortedSet.of( - new QueueMetadata("q1", URI.create("http://myaccount.queue.core.windows.net/q1")), - new QueueMetadata("q2", URI.create("http://myaccount.queue.core.windows.net/q2")), - new QueueMetadata("q3", URI.create("http://myaccount.queue.core.windows.net/q3"))), - URI.create("http://myaccount.queue.core.windows.net"), "q", null, 3, "q4"); - BoundedSet result = (BoundedSet) factory.create( - injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); - assertEquals(result, list); - } - - public void testApplyInputStreamWithOptions() { - InputStream is = getClass().getResourceAsStream("/test_list_queues_options.xml"); - BoundedSet list = new BoundedHashSet(ImmutableSortedSet.of( - new QueueMetadata("q4", URI.create("http://myaccount.queue.core.windows.net/q4")), - new QueueMetadata("q5", URI.create("http://myaccount.queue.core.windows.net/q5"))), - URI.create("http://myaccount.queue.core.windows.net"), "q", "q4", 3, null); - - BoundedSet result = (BoundedSet) factory.create( - injector.getInstance(AccountNameEnumerationResultsHandler.class)).parse(is); - - assertEquals(result, list); - } -} diff --git a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/QueueMessagesListHandlerTest.java b/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/QueueMessagesListHandlerTest.java deleted file mode 100644 index add1a16467..0000000000 --- a/sandbox-providers/azurequeue/src/test/java/org/jclouds/azurequeue/xml/QueueMessagesListHandlerTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.azurequeue.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.util.Set; - -import org.jclouds.azurequeue.domain.QueueMessage; -import org.jclouds.date.DateService; -import org.jclouds.http.functions.BaseHandlerTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code QueueMessagesListHandler} - * - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "QueueMessagesListHandlerTest") -public class QueueMessagesListHandlerTest extends BaseHandlerTest { - private DateService dateService; - - @BeforeTest - protected void setUpInjector() { - super.setUpInjector(); - dateService = injector.getInstance(DateService.class); - } - - public void testApplyInputStream() { - InputStream is = getClass().getResourceAsStream("/test_get_messages.xml"); - Set expected = ImmutableSet. of( - - new QueueMessage("43190737-06f4-4ccf-b600-28f410707df3", dateService - .rfc822DateParse("Fri, 11 Jun 2010 18:35:08 GMT"), dateService - .rfc822DateParse("Fri, 11 Jun 2010 18:35:13 GMT"), 1, - "AgAAAAEAAADZcwAADlwO5JQJywE=", dateService - .rfc822DateParse("Fri, 11 Jun 2010 18:35:39 GMT"), "holycow"), - new QueueMessage("7b75a124-7efe-45a2-97e4-388664319718", dateService - .rfc822DateParse("Fri, 11 Jun 2010 18:35:09 GMT"), dateService - .rfc822DateParse("Fri, 11 Jun 2010 18:35:13 GMT"), 1, - "AgAAAAEAAADZcwAADlwO5JQJywE=", dateService - .rfc822DateParse("Fri, 11 Jun 2010 18:35:39 GMT"), "holymoo")); - - Set result = factory.create( - injector.getInstance(QueueMessagesListHandler.class)).parse(is); - assertEquals(result, expected); - } -} diff --git a/sandbox-providers/azurequeue/src/test/resources/log4j.xml b/sandbox-providers/azurequeue/src/test/resources/log4j.xml deleted file mode 100644 index 22cc40c5e2..0000000000 --- a/sandbox-providers/azurequeue/src/test/resources/log4j.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-providers/azurequeue/src/test/resources/test_get_messages.xml b/sandbox-providers/azurequeue/src/test/resources/test_get_messages.xml deleted file mode 100644 index d888d600e1..0000000000 --- a/sandbox-providers/azurequeue/src/test/resources/test_get_messages.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - 43190737-06f4-4ccf-b600-28f410707df3 - Fri, 11 Jun 2010 18:35:08 GMT - Fri, 11 Jun 2010 18:35:13 GMT - 1 - AgAAAAEAAADZcwAADlwO5JQJywE= - Fri, 11 Jun 2010 18:35:39 GMT - holycow - - - 7b75a124-7efe-45a2-97e4-388664319718 - Fri, 11 Jun 2010 18:35:09 GMT - Fri, 11 Jun 2010 18:35:13 GMT - 1 - AgAAAAEAAADZcwAADlwO5JQJywE= - Fri, 11 Jun 2010 18:35:39 GMT - holymoo - - \ No newline at end of file diff --git a/sandbox-providers/azurequeue/src/test/resources/test_list_queues.xml b/sandbox-providers/azurequeue/src/test/resources/test_list_queues.xml deleted file mode 100644 index 139c30de2f..0000000000 --- a/sandbox-providers/azurequeue/src/test/resources/test_list_queues.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - q - 3 - - - q1 - http://myaccount.queue.core.windows.net/q1 - - - q2 - http://myaccount.queue.core.windows.net/q2 - - - q3 - http://myaccount.queue.core.windows.net/q3 - - - q4 - diff --git a/sandbox-providers/azurequeue/src/test/resources/test_list_queues_options.xml b/sandbox-providers/azurequeue/src/test/resources/test_list_queues_options.xml deleted file mode 100644 index 1d2f9b00b9..0000000000 --- a/sandbox-providers/azurequeue/src/test/resources/test_list_queues_options.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - q - q4 - 3 - - - q4 - http://myaccount.queue.core.windows.net/q4 - - - q5 - http://myaccount.queue.core.windows.net/q5 - - - - diff --git a/sandbox-providers/boxdotnet/pom.xml b/sandbox-providers/boxdotnet/pom.xml deleted file mode 100644 index d99824fb9f..0000000000 --- a/sandbox-providers/boxdotnet/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - boxdotnet - jclouds BoxDotNet core - jclouds components to access BoxDotNet - bundle - - - - - jclouds-sona-snapshots-nexus - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - - https://www.box.net/api/1.0/rest - 1.0 - - FIXME - FIXME - - org.jclouds.boxdotnet*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - org.jclouds - jclouds-core - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - log4j - log4j - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.boxdotnet.endpoint} - ${test.boxdotnet.api-version} - ${test.boxdotnet.build-version} - ${test.boxdotnet.identity} - ${test.boxdotnet.credential} - - - - - - - - - - - diff --git a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetAsyncClient.java b/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetAsyncClient.java deleted file mode 100644 index 9341702150..0000000000 --- a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetAsyncClient.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet; - -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.rest.annotations.ExceptionParser; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; -import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to BoxDotNet via their REST API. - *

- * - * @see BoxDotNetClient - * @see - * @author Adrian Cole - */ -@RequestFilters(BasicAuthentication.class) -public interface BoxDotNetAsyncClient { - /* - * TODO: define interface methods for BoxDotNet - */ - - /** - * @see BoxDotNetClient#list() - */ - @GET - @Path("/items") - ListenableFuture list(); - - /** - * @see BoxDotNetClient#get(long) - */ - @GET - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path("/items/{itemId}") - ListenableFuture get(@PathParam("itemId") long id); - - /** - * @see BoxDotNetClient#delete - */ - @DELETE - @Path("/items/{itemId}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture delete(@PathParam("itemId") long id); -} diff --git a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetClient.java b/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetClient.java deleted file mode 100644 index b2fb5ea71c..0000000000 --- a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetClient.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet; - -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.Timeout; - -/** - * Provides synchronous access to BoxDotNet. - *

- * - * @see BoxDotNetAsyncClient - * @see - * @author Adrian Cole - */ -@Timeout(duration = 4, timeUnit = TimeUnit.SECONDS) -public interface BoxDotNetClient { - /* - * Note all these delegate to methods in BoxDotNetAsyncClient with a specified or inherited timeout. - * The signatures should match those of BoxDotNetAsyncClient, except the returnvals should not be - * wrapped in a Future - */ - - String list(); - - /** - * @return null, if not found - */ - String get(long id); - - void delete(long id); - -} diff --git a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetContextBuilder.java b/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetContextBuilder.java deleted file mode 100644 index 073ccae347..0000000000 --- a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetContextBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.boxdotnet.config.BoxDotNetRestClientModule; -import org.jclouds.rest.RestContextBuilder; - -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class BoxDotNetContextBuilder extends - RestContextBuilder { - - public BoxDotNetContextBuilder(Properties props) { - super(BoxDotNetClient.class, BoxDotNetAsyncClient.class, props); - } - - protected void addClientModule(List modules) { - modules.add(new BoxDotNetRestClientModule()); - } - -} diff --git a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetPropertiesBuilder.java b/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetPropertiesBuilder.java deleted file mode 100644 index ee8edf8e30..0000000000 --- a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/BoxDotNetPropertiesBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet; - -import static org.jclouds.Constants.PROPERTY_ENDPOINT; - -import java.util.Properties; - -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in BoxDotNet Clients - * - * @author Adrian Cole - */ -public class BoxDotNetPropertiesBuilder extends PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ENDPOINT, "https://www.box.net/api/1.0/rest"); - return properties; - } - - public BoxDotNetPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/config/BoxDotNetRestClientModule.java b/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/config/BoxDotNetRestClientModule.java deleted file mode 100644 index 5065b6fda1..0000000000 --- a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/config/BoxDotNetRestClientModule.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet.config; - -import org.jclouds.boxdotnet.BoxDotNetAsyncClient; -import org.jclouds.boxdotnet.BoxDotNetClient; -import org.jclouds.boxdotnet.handlers.BoxDotNetErrorHandler; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpRetryHandler; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.http.annotation.Redirection; -import org.jclouds.http.annotation.ServerError; -import org.jclouds.http.handlers.BackoffLimitedRetryHandler; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; - -/** - * Configures the BoxDotNet connection. - * - * @author Adrian Cole - */ -@RequiresHttp -@ConfiguresRestClient -public class BoxDotNetRestClientModule extends - RestClientModule { - - public BoxDotNetRestClientModule() { - super(BoxDotNetClient.class, BoxDotNetAsyncClient.class); - } - - @Override - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(BoxDotNetErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(BoxDotNetErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(BoxDotNetErrorHandler.class); - } - - @Override - protected void bindRetryHandlers() { - bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class); - } - -} diff --git a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/handlers/BoxDotNetErrorHandler.java b/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/handlers/BoxDotNetErrorHandler.java deleted file mode 100644 index e3a0015f65..0000000000 --- a/sandbox-providers/boxdotnet/src/main/java/org/jclouds/boxdotnet/handlers/BoxDotNetErrorHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet.handlers; - -import java.io.IOException; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpResponseException; -import org.jclouds.logging.Logger; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; -import org.jclouds.util.Strings2; - -import com.google.common.base.Throwables; -import com.google.common.io.Closeables; - -/** - * This will parse and set an appropriate exception on the command object. - * - * @author Adrian Cole - * - */ -@Singleton -public class BoxDotNetErrorHandler implements HttpErrorHandler { - @Resource - protected Logger logger = Logger.NULL; - - public void handleError(HttpCommand command, HttpResponse response) { - // it is important to always read fully and close streams - String message = parseMessage(response); - Exception exception = message != null ? new HttpResponseException(command, response, message) - : new HttpResponseException(command, response); - try { - message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), - response.getStatusLine()); - switch (response.getStatusCode()) { - case 401: - case 403: - exception = new AuthorizationException(message, exception); - break; - case 404: - if (!command.getCurrentRequest().getMethod().equals("DELETE")) { - exception = new ResourceNotFoundException(message, exception); - } - break; - } - } finally { - Closeables.closeQuietly(response.getPayload()); - command.setException(exception); - } - } - - public String parseMessage(HttpResponse response) { - if (response.getPayload() == null) - return null; - try { - return Strings2.toString(response.getPayload()); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - try { - response.getPayload().getInput().close(); - } catch (IOException e) { - Throwables.propagate(e); - } - } - } -} diff --git a/sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetAsyncClientTest.java b/sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetAsyncClientTest.java deleted file mode 100644 index dcfe760d98..0000000000 --- a/sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetAsyncClientTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet; - -import static org.jclouds.rest.RestContextFactory.contextSpec; -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.http.functions.ReturnStringIf2xx; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; -import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; -import org.jclouds.rest.internal.GeneratedHttpRequest; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; - -import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; - -/** - * Tests annotation parsing of {@code BoxDotNetAsyncClient} - * - * @author Adrian Cole - */ -@Test(groups = "unit") -public class BoxDotNetAsyncClientTest extends RestClientTest { - - public void testList() throws SecurityException, NoSuchMethodException, IOException { - Method method = BoxDotNetAsyncClient.class.getMethod("list"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, "GET https://www.box.net/api/1.0/rest/items HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - // now make sure request filters apply by replaying - httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); - httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); - - assertRequestLineEquals(httpRequest, "GET https://www.box.net/api/1.0/rest/items HTTP/1.1"); - // for example, using basic authentication, we should get "only one" - // header - assertNonPayloadHeadersEqual(httpRequest, "Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n"); - assertPayloadEquals(httpRequest, null, null, false); - - // TODO: insert expected response class, which probably extends ParseJson - assertResponseParserClassEquals(method, httpRequest, ReturnStringIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testGet() throws SecurityException, NoSuchMethodException, IOException { - Method method = BoxDotNetAsyncClient.class.getMethod("get", long.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, 1); - - assertRequestLineEquals(httpRequest, "GET https://www.box.net/api/1.0/rest/items/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - // TODO: insert expected response class, which probably extends ParseJson - assertResponseParserClassEquals(method, httpRequest, ReturnStringIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - // note that get methods should convert 404's to null - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testDelete() throws SecurityException, NoSuchMethodException, IOException { - Method method = BoxDotNetAsyncClient.class.getMethod("delete", long.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, 1); - - assertRequestLineEquals(httpRequest, "DELETE https://www.box.net/api/1.0/rest/items/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), BasicAuthentication.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - public RestContextSpec createContextSpec() { - return contextSpec("boxdotnet", "https://www.box.net/api/1.0/rest", "1.0", "", "identity", "credential", - BoxDotNetClient.class, BoxDotNetAsyncClient.class); - } -} diff --git a/sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetClientLiveTest.java b/sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetClientLiveTest.java deleted file mode 100644 index 9b8ec25f9a..0000000000 --- a/sandbox-providers/boxdotnet/src/test/java/org/jclouds/boxdotnet/BoxDotNetClientLiveTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.boxdotnet; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertNotNull; - -import java.util.Properties; - -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Tests behavior of {@code BoxDotNetClient} - * - * @author Adrian Cole - */ -@Test(groups = "live") -public class BoxDotNetClientLiveTest { - - private BoxDotNetClient connection; - private RestContext context; - - @BeforeGroups(groups = { "live" }) - public void setupClient() { - String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); - String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); - - Properties restProperties = new Properties(); - restProperties.setProperty("boxdotnet.contextbuilder", "org.jclouds.boxdotnet.BoxDotNetContextBuilder"); - restProperties.setProperty("boxdotnet.propertiesbuilder", "org.jclouds.boxdotnet.BoxDotNetPropertiesBuilder"); - - context = new RestContextFactory(restProperties).createContext("boxdotnet", identity, credential, - ImmutableSet. of(new Log4JLoggingModule())); - - connection = context.getApi(); - } - - @AfterGroups(groups = "live") - void tearDown() { - if (context != null) - context.close(); - } - - @Test - public void testList() throws Exception { - String response = connection.list(); - assertNotNull(response); - } - - @Test - public void testGet() throws Exception { - String response = connection.get(1l); - assertNotNull(response); - } - - /* - * TODO: add tests for BoxDotNet interface methods - */ -} diff --git a/sandbox-providers/boxdotnet/src/test/resources/log4j.xml b/sandbox-providers/boxdotnet/src/test/resources/log4j.xml deleted file mode 100644 index 3351727cb7..0000000000 --- a/sandbox-providers/boxdotnet/src/test/resources/log4j.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-providers/dunkel-vcd/pom.xml b/sandbox-providers/dunkel-vcd/pom.xml deleted file mode 100644 index 9af55779fc..0000000000 --- a/sandbox-providers/dunkel-vcd/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - dunkel-vcd - jclouds Dunkel vCloud provider - vCloud implementation targeted to Dunkel - - - https://vcd.dunkel.de/api - 1.0 - 1.0.1.356485 - FIXME_IDENTITY - FIXME_CREDENTIAL - - - - - org.jclouds.dunkel.vcd*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - vcloud - ${project.version} - - - org.jclouds.api - vcloud - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-compute - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - org.jclouds.driver - jclouds-sshj - ${project.version} - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.dunkel-vcd.endpoint} - ${test.dunkel-vcd.api-version} - ${test.dunkel-vcd.build-version} - ${test.dunkel-vcd.identity} - ${test.dunkel-vcd.credential} - ${test.dunkel-vcd.image-id} - ${test.dunkel-vcd.image.login-user} - ${test.dunkel-vcd.image.authenticate-sudo} - - - - - - - - - - - - diff --git a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorContextBuilder.java b/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorContextBuilder.java deleted file mode 100644 index 496f679901..0000000000 --- a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorContextBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd; - -import src.main.java.org.jclouds.dunkel.vcd.config.DunkelVCloudDirectorComputeServiceContextModule; -import src.main.java.org.jclouds.dunkel.vcd.config.DunkelVCloudDirectorRestClientModule; - -/** - * - * @author Adrian Cole - * - */ -public class DunkelVCloudDirectorContextBuilder extends VCloudContextBuilder { - - public DunkelVCloudDirectorContextBuilder(Properties props) { - super(props); - } - - @Override - protected void addContextModule(List modules) { - modules.add(new DunkelVCloudDirectorComputeServiceContextModule()); - } - - @Override - protected void addClientModule(List modules) { - modules.add(new DunkelVCloudDirectorRestClientModule()); - } - -} diff --git a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorPropertiesBuilder.java b/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorPropertiesBuilder.java deleted file mode 100644 index e246599839..0000000000 --- a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorPropertiesBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd; - - -/** - * - * @author Adrian Cole - */ -public class DunkelVCloudDirectorPropertiesBuilder extends VCloudPropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ISO3166_CODES, "DE"); - properties.setProperty(PROPERTY_BUILD_VERSION, "1.0.1.356485"); - properties.setProperty(PROPERTY_ENDPOINT, "https://vcd.dunkel.de/api"); - properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, ".*-intranet"); - return properties; - } - - public DunkelVCloudDirectorPropertiesBuilder(Properties properties) { - super(properties); - } -} diff --git a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderMetadata.java b/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderMetadata.java deleted file mode 100644 index f657fe5d55..0000000000 --- a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderMetadata.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd; - - -/** - * Implementation of {@link org.jclouds.types.ProviderMetadata} for Dunkel vCloud Director - * - * @author Adrian Cole - */ -public class DunkelVCloudDirectorProviderMetadata extends BaseProviderMetadata { - - /** - * {@inheritDoc} - */ - @Override - public String getId() { - return "dunkel-vcd"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getType() { - return ProviderMetadata.COMPUTE_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return "Dunkel vCloud Director"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getIdentityName() { - return "User at Organization (user@org)"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getCredentialName() { - return "Password"; - } - - /** - * {@inheritDoc} - */ - @Override - public URI getHomepage() { - return URI.create("http://www.dunkel.de/vcloud/"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getConsole() { - return URI.create("https://vcd.dunkel.de/cloud"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getApiDocumentation() { - return URI.create("http://www.dunkel.de/vcloud/"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getLinkedServices() { - return ImmutableSet.of("dunkel-vcd"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getIso3166Codes() { - return ImmutableSet.of("DE"); - } - -} diff --git a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorComputeServiceContextModule.java b/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorComputeServiceContextModule.java deleted file mode 100644 index 210e5a1f23..0000000000 --- a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorComputeServiceContextModule.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd.config; - - -/** - * - * @author Adrian Cole - */ -public class DunkelVCloudDirectorComputeServiceContextModule extends VCloudComputeServiceContextModule { - - @Override - protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) { - return options.as(VCloudTemplateOptions.class).ipAddressAllocationMode(IpAddressAllocationMode.POOL); - } - - //CIM ostype does not include version info - @Override - protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { - return template.osFamily(RHEL).os64Bit(true); - } -} diff --git a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorRestClientModule.java b/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorRestClientModule.java deleted file mode 100644 index 9bb92e1c1f..0000000000 --- a/sandbox-providers/dunkel-vcd/src/main/java/org/jclouds/dunkel/vcd/config/DunkelVCloudDirectorRestClientModule.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd.config; - - -/** - * - * @author Adrian Cole - */ -@ConfiguresRestClient -public class DunkelVCloudDirectorRestClientModule extends VCloudRestClientModule { - -} diff --git a/sandbox-providers/dunkel-vcd/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/sandbox-providers/dunkel-vcd/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index 217f305590..0000000000 --- a/sandbox-providers/dunkel-vcd/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.dunkel.vcd.DunkelVCloudDirectorProviderMetadata diff --git a/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderTest.java b/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderTest.java deleted file mode 100644 index 5589905127..0000000000 --- a/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/DunkelVCloudDirectorProviderTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd; - -import src.main.java.org.jclouds.dunkel.vcd.DunkelVCloudDirectorProviderMetadata; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "DunkelVCloudDirectorProviderTest") -public class DunkelVCloudDirectorProviderTest extends BaseProviderMetadataTest { - - public DunkelVCloudDirectorProviderTest() { - super(new DunkelVCloudDirectorProviderMetadata(), ProviderMetadata.COMPUTE_TYPE); - } -} diff --git a/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorComputeServiceLiveTest.java b/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorComputeServiceLiveTest.java deleted file mode 100644 index 9f43601cd5..0000000000 --- a/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorComputeServiceLiveTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd.compute; - - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true) -public class DunkelVCloudDirectorComputeServiceLiveTest extends VCloudComputeServiceLiveTest { - public DunkelVCloudDirectorComputeServiceLiveTest() { - provider = "dunkel-vcd"; - } - -} diff --git a/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorTemplateBuilderLiveTest.java b/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorTemplateBuilderLiveTest.java deleted file mode 100644 index 0025def75d..0000000000 --- a/sandbox-providers/dunkel-vcd/src/test/java/org/jclouds/dunkel/vcd/compute/DunkelVCloudDirectorTemplateBuilderLiveTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.dunkel.vcd.compute; - - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "DunkelVCloudDirectorTemplateBuilderLiveTest") -public class DunkelVCloudDirectorTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { - - public DunkelVCloudDirectorTemplateBuilderLiveTest() { - provider = "dunkel-vcd"; - } - - @Override - protected Predicate defineUnsupportedOperatingSystems() { - return new Predicate() { - - @Override - public boolean apply(OsFamilyVersion64Bit input) { - switch (input.family) { - case RHEL: - return !(input.version.equals("") && input.is64Bit); - default: - return true; - } - } - - }; - } - - @Override - public void testDefaultTemplateBuilder() throws IOException { - Template defaultTemplate = context.getComputeService().templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), ""); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.RHEL); - assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); - } - - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("DE"); - } -} diff --git a/sandbox-providers/dunkel-vcd/src/test/resources/log4j.xml b/sandbox-providers/dunkel-vcd/src/test/resources/log4j.xml deleted file mode 100644 index 63810d3ca0..0000000000 --- a/sandbox-providers/dunkel-vcd/src/test/resources/log4j.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-providers/googlestorage/README.txt b/sandbox-providers/googlestorage/README.txt deleted file mode 100644 index 7bd6924617..0000000000 --- a/sandbox-providers/googlestorage/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -# -# The jclouds provider for Google Storage for Developers (http://code.google.com/apis/storage/). -# -# Expects the jclouds s3 API to be present on your application's classpath. -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. \ No newline at end of file diff --git a/sandbox-providers/googlestorage/pom.xml b/sandbox-providers/googlestorage/pom.xml deleted file mode 100644 index bd403f0ea7..0000000000 --- a/sandbox-providers/googlestorage/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - googlestorage - jclouds Google Storage for Developers provider - Simple Storage Service (S3) implementation targeted to Google Storage for Developers - bundle - - - org.jclouds.googlestorage.blobstore.GoogleStorageTestInitializer - https://commondatastorage.googleapis.com - 2006-03-01 - - FIX_ME - FIX_ME - - org.jclouds.googlestorage*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - s3 - ${project.version} - jar - - - org.jclouds.api - s3 - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.googlestorage.endpoint} - ${test.googlestorage.api-version} - ${test.googlestorage.build-version} - ${test.googlestorage.identity} - ${test.googlestorage.credential} - ${test.initializer} - ${jclouds.blobstore.httpstream.url} - ${jclouds.blobstore.httpstream.md5} - - - - - - - - - - - diff --git a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageAsyncClient.java b/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageAsyncClient.java deleted file mode 100644 index bb01db2dbb..0000000000 --- a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageAsyncClient.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER; - -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.jclouds.blobstore.attr.BlobScope; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Headers; -import org.jclouds.rest.annotations.ParamValidators; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.s3.Bucket; -import org.jclouds.s3.S3AsyncClient; -import org.jclouds.s3.S3Client; -import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured; -import org.jclouds.s3.domain.ObjectMetadata; -import org.jclouds.s3.filters.RequestAuthorizeSignature; -import org.jclouds.s3.options.CopyObjectOptions; -import org.jclouds.s3.predicates.validators.BucketNameValidator; -import org.jclouds.s3.xml.CopyObjectHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * - * @author Adrian Cole - */ -@SkipEncoding('/') -@RequestFilters(RequestAuthorizeSignature.class) -@BlobScope(CONTAINER) -public interface GoogleStorageAsyncClient extends S3AsyncClient { - /** - * @see S3Client#copyObject - */ - @Override - @PUT - @Path("/{destinationObject}") - @Headers(keys = "x-goog-copy-source", values = "/{sourceBucket}/{sourceObject}") - @XMLResponseParser(CopyObjectHandler.class) - ListenableFuture copyObject( - @PathParam("sourceBucket") String sourceBucket, - @PathParam("sourceObject") String sourceObject, - @Bucket @BinderParam(BindAsHostPrefixIfConfigured.class) @ParamValidators( { BucketNameValidator.class }) String destinationBucket, - @PathParam("destinationObject") String destinationObject, CopyObjectOptions... options); - -} diff --git a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageContextBuilder.java b/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageContextBuilder.java deleted file mode 100644 index dbce49319a..0000000000 --- a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageContextBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.googlestorage.config.GoogleStorageRestClientModule; -import org.jclouds.s3.S3ContextBuilder; - -import com.google.inject.Module; - -/** - * - * - * @author Adrian Cole - */ -public class GoogleStorageContextBuilder extends S3ContextBuilder { - - public GoogleStorageContextBuilder(Properties props) { - super(props); - } - - @Override - protected void addClientModule(List modules) { - modules.add(new GoogleStorageRestClientModule()); - } -} diff --git a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java b/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java deleted file mode 100644 index a070f8be18..0000000000 --- a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStoragePropertiesBuilder.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; -import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; -import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; - -import java.util.Properties; - -import org.jclouds.s3.S3PropertiesBuilder; - -/** - * Builds properties used in Google Storage - * - * @author Adrian Cole - */ -public class GoogleStoragePropertiesBuilder extends S3PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_AUTH_TAG, "GOOG1"); - properties.setProperty(PROPERTY_HEADER_TAG, "goog"); - properties.setProperty(PROPERTY_ISO3166_CODES, "US"); - properties.setProperty(PROPERTY_ENDPOINT, "https://commondatastorage.googleapis.com"); - return properties; - } - - public GoogleStoragePropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageProviderMetadata.java b/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageProviderMetadata.java deleted file mode 100644 index 2d03c39de9..0000000000 --- a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/GoogleStorageProviderMetadata.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import com.google.common.collect.ImmutableSet; - -import java.net.URI; -import java.util.Set; - -import org.jclouds.providers.BaseProviderMetadata; - -/** - * Implementation of {@ link org.jclouds.types.ProviderMetadata} for Google's - * Storage provider. - * - * @author Jeremy Whitlock - */ -public class GoogleStorageProviderMetadata extends BaseProviderMetadata { - - /** - * {@inheritDoc} - */ - @Override - public String getId() { - return "googlestorage"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getType() { - return BLOBSTORE_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return "Google Storage"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getIdentityName() { - return "Access Key"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getCredentialName() { - return "Secret Key"; - } - - /** - * {@inheritDoc} - */ - @Override - public URI getHomepage() { - return URI.create("http://code.google.com/apis/storage/"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getConsole() { - return URI.create("https://code.google.com/apis/console#:storage:access"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getApiDocumentation() { - return URI.create("http://code.google.com/apis/storage/docs/reference-guide.html"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getIso3166Codes() { - return ImmutableSet.of("US"); - } - -} diff --git a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequest.java b/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequest.java deleted file mode 100644 index 740c6ce2ff..0000000000 --- a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequest.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.binders; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.ws.rs.core.HttpHeaders; - -import org.jclouds.blobstore.binders.BindMapToHeadersWithPrefix; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.utils.ModifyRequest; -import org.jclouds.s3.binders.BindS3ObjectMetadataToRequest; -import org.jclouds.s3.domain.S3Object; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class BindGoogleStorageObjectMetadataToRequest extends BindS3ObjectMetadataToRequest { - @Inject - public BindGoogleStorageObjectMetadataToRequest(BindMapToHeadersWithPrefix metadataPrefixer) { - super(metadataPrefixer); - } - - @Override - public R bindToRequest(R request, Object input) { - checkArgument(checkNotNull(input, "input") instanceof S3Object, "this binder is only valid for S3Object!"); - checkNotNull(request, "request"); - - S3Object s3Object = S3Object.class.cast(input); - checkArgument(s3Object.getMetadata().getKey() != null, "s3Object.getMetadata().getKey() must be set!"); - - if (s3Object.getPayload().getContentMetadata().getContentLength() != null - && s3Object.getPayload().getContentMetadata().getContentLength() >= 0) { - checkArgument(s3Object.getPayload().getContentMetadata().getContentLength() <= 5l * 1024 * 1024 * 1024, - "maximum size for put object is 5GB"); - } else { - // Enable "chunked"/"streamed" data, where the size needn't be known in advance. - request = ModifyRequest.replaceHeader(request, "Transfer-Encoding", "chunked"); - } - - request = metadataPrefixer.bindToRequest(request, s3Object.getMetadata().getUserMetadata()); - - if (s3Object.getMetadata().getCacheControl() != null) { - request = ModifyRequest.replaceHeader(request, HttpHeaders.CACHE_CONTROL, s3Object.getMetadata() - .getCacheControl()); - } - return request; - } -} diff --git a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/config/GoogleStorageRestClientModule.java b/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/config/GoogleStorageRestClientModule.java deleted file mode 100644 index f6d7bb68ea..0000000000 --- a/sandbox-providers/googlestorage/src/main/java/org/jclouds/googlestorage/config/GoogleStorageRestClientModule.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.config; - -import javax.inject.Singleton; - -import org.jclouds.googlestorage.GoogleStorageAsyncClient; -import org.jclouds.googlestorage.binders.BindGoogleStorageObjectMetadataToRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.s3.S3AsyncClient; -import org.jclouds.s3.S3Client; -import org.jclouds.s3.binders.BindS3ObjectMetadataToRequest; -import org.jclouds.s3.config.S3RestClientModule; - -import com.google.inject.Provides; - -/** - * - * @author Adrian Cole - */ -@ConfiguresRestClient -@RequiresHttp -public class GoogleStorageRestClientModule extends S3RestClientModule { - - public GoogleStorageRestClientModule() { - super(S3Client.class, GoogleStorageAsyncClient.class); - } - - @Override - protected void configure() { - bind(BindS3ObjectMetadataToRequest.class).to(BindGoogleStorageObjectMetadataToRequest.class); - super.configure(); - } - - @Provides - @Singleton - S3AsyncClient provideS3AsyncClient(GoogleStorageAsyncClient in) { - return in; - } - -} diff --git a/sandbox-providers/googlestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/sandbox-providers/googlestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index 01a8afea14..0000000000 --- a/sandbox-providers/googlestorage/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.googlestorage.GoogleStorageProviderMetadata diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java deleted file mode 100644 index a04357a9f0..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageAsyncClientTestDisabled.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.jclouds.s3.S3AsyncClient; -import org.testng.annotations.Test; - -import com.google.inject.TypeLiteral; - -/** - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(enabled = false, groups = "unit", testName = "GoogleStorageAsyncClientTest") -public class GoogleStorageAsyncClientTestDisabled extends org.jclouds.s3.S3AsyncClientTest { - - public GoogleStorageAsyncClientTestDisabled() { - this.provider = "googlestorage"; - this.url = "commondatastorage.googleapis.com"; - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - // TODO parameterize this test so that it can pass -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java deleted file mode 100644 index f037b410b9..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageClientLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import org.jclouds.s3.S3ClientLiveTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code S3Client} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "GoogleStorageClientLiveTest") -public class GoogleStorageClientLiveTest extends S3ClientLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageProviderTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageProviderTest.java deleted file mode 100644 index 77e39996b5..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/GoogleStorageProviderTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage; - -import org.jclouds.providers.BaseProviderMetadataTest; -import org.jclouds.providers.ProviderMetadata; -import org.testng.annotations.Test; - -/** - * The GoogleStorageProviderTest tests the {@link GoogleStorageProviderMetadata} class. - * - * @author Jeremy Whitlock - */ -@Test(groups = "unit", testName = "GoogleStorageProviderTest") -public class GoogleStorageProviderTest extends BaseProviderMetadataTest { - - public GoogleStorageProviderTest() { - super(new GoogleStorageProviderMetadata(), ProviderMetadata.BLOBSTORE_TYPE); - } - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequestTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequestTest.java deleted file mode 100644 index fa240768f1..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/binders/BindGoogleStorageObjectMetadataToRequestTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.binders; - -import static org.testng.Assert.assertEquals; - -import java.io.File; -import java.net.URI; - -import javax.ws.rs.HttpMethod; - -import org.jclouds.http.HttpRequest; -import org.jclouds.io.Payload; -import org.jclouds.io.Payloads; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.jclouds.s3.BaseS3AsyncClientTest; -import org.jclouds.s3.S3AsyncClient; -import org.jclouds.s3.domain.S3Object; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code BindGoogleStorageObjectMetadataToRequest} - * - * @author Adrian Cole - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "BindGoogleStorageObjectMetadataToRequestTest") -public class BindGoogleStorageObjectMetadataToRequestTest extends BaseS3AsyncClientTest { - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Test - public void testPassWithMinimumDetailsAndPayload5GB() { - S3Object object = injector.getInstance(S3Object.Factory.class).create(null); - Payload payload = Payloads.newStringPayload(""); - payload.getContentMetadata().setContentLength(5 * 1024 * 1024 * 1024l); - object.setPayload(payload); - object.getMetadata().setKey("foo"); - - HttpRequest request = HttpRequest.builder().method("PUT").endpoint(URI.create("http://localhost")).build(); - BindGoogleStorageObjectMetadataToRequest binder = injector - .getInstance(BindGoogleStorageObjectMetadataToRequest.class); - - assertEquals(binder.bindToRequest(request, object), HttpRequest.builder().method("PUT").endpoint( - URI.create("http://localhost")).build()); - } - - @Test - public void testExtendedPropertiesBind() { - S3Object object = injector.getInstance(S3Object.Factory.class).create(null); - Payload payload = Payloads.newStringPayload(""); - payload.getContentMetadata().setContentLength(5 * 1024 * 1024 * 1024l); - object.setPayload(payload); - object.getMetadata().setKey("foo"); - object.getMetadata().getUserMetadata().putAll(ImmutableMap.of("foo", "bar")); - - HttpRequest request = HttpRequest.builder().method("PUT").endpoint(URI.create("http://localhost")).build(); - BindGoogleStorageObjectMetadataToRequest binder = injector - .getInstance(BindGoogleStorageObjectMetadataToRequest.class); - - assertEquals(binder.bindToRequest(request, object), HttpRequest.builder().method("PUT").endpoint( - URI.create("http://localhost")).headers(ImmutableMultimap.of("x-amz-meta-foo", "bar")).build()); - } - - public void testNoContentLengthIsChunked() { - S3Object object = injector.getInstance(S3Object.Factory.class).create(null); - Payload payload = Payloads.newStringPayload(""); - payload.getContentMetadata().setContentLength(null); - object.setPayload(payload); - object.getMetadata().setKey("foo"); - - HttpRequest request = HttpRequest.builder().method("PUT").endpoint(URI.create("http://localhost")).build(); - BindGoogleStorageObjectMetadataToRequest binder = injector - .getInstance(BindGoogleStorageObjectMetadataToRequest.class); - - assertEquals(binder.bindToRequest(request, object), HttpRequest.builder().method("PUT").endpoint( - URI.create("http://localhost")).headers(ImmutableMultimap.of("Transfer-Encoding", "chunked")).build()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNoNameIsBad() { - S3Object object = injector.getInstance(S3Object.Factory.class).create(null); - Payload payload = Payloads.newStringPayload(""); - payload.getContentMetadata().setContentLength(5368709120000l); - object.setPayload(payload); - - HttpRequest request = HttpRequest.builder().method("PUT").endpoint(URI.create("http://localhost")).build(); - BindGoogleStorageObjectMetadataToRequest binder = injector - .getInstance(BindGoogleStorageObjectMetadataToRequest.class); - binder.bindToRequest(request, object); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testOver5GBIsBad() { - S3Object object = injector.getInstance(S3Object.Factory.class).create(null); - Payload payload = Payloads.newStringPayload(""); - payload.getContentMetadata().setContentLength(5 * 1024 * 1024 * 1024l + 1); - object.setPayload(payload); - object.getMetadata().setKey("foo"); - - HttpRequest request = HttpRequest.builder().method("PUT").endpoint(URI.create("http://localhost")).build(); - BindGoogleStorageObjectMetadataToRequest binder = injector - .getInstance(BindGoogleStorageObjectMetadataToRequest.class); - binder.bindToRequest(request, object); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testMustBeS3Object() { - HttpRequest request = new HttpRequest(HttpMethod.POST, URI.create("http://localhost")); - injector.getInstance(BindGoogleStorageObjectMetadataToRequest.class).bindToRequest(request, new File("foo")); - } - - @Test(expectedExceptions = { NullPointerException.class, IllegalStateException.class }) - public void testNullIsBad() { - BindGoogleStorageObjectMetadataToRequest binder = injector - .getInstance(BindGoogleStorageObjectMetadataToRequest.class); - HttpRequest request = HttpRequest.builder().method("GET").endpoint(URI.create("http://momma")).build(); - binder.bindToRequest(request, null); - } - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java deleted file mode 100644 index eae1b3af3e..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobIntegrationLiveTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import java.io.IOException; - -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageBlobIntegrationLiveTest") -public class GoogleStorageBlobIntegrationLiveTest extends BaseBlobIntegrationTest { - // NOTE google supports streaming - // no support for content language - @Override - protected void checkContentLanguage(Blob blob, String contentLanguage) { - assert blob.getPayload().getContentMetadata().getContentLanguage() == null; - assert blob.getMetadata().getContentMetadata().getContentLanguage() == null; - } - - // double range not supported - @Test(groups = { "integration", "live" }) - public void testGetTwoRanges() throws InterruptedException, IOException { - - } -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java deleted file mode 100644 index a23301cc64..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3BlobLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageBlobLiveTest") -public class GoogleStorageBlobLiveTest extends S3BlobLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java deleted file mode 100644 index 5bbe6fb96f..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3BlobMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageBlobMapIntegrationLiveTest") -public class GoogleStorageBlobMapIntegrationLiveTest extends S3BlobMapIntegrationLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java deleted file mode 100644 index 5ab8963d51..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageBlobSignerLiveTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3BlobSignerLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageBlobSignerLiveTest") -public class GoogleStorageBlobSignerLiveTest extends S3BlobSignerLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java deleted file mode 100644 index d4d16abc41..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3ContainerIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageContainerIntegrationLiveTest") -public class GoogleStorageContainerIntegrationLiveTest extends S3ContainerIntegrationLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java deleted file mode 100644 index e10eddcb00..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageContainerLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3ContainerLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageContainerLiveTest") -public class GoogleStorageContainerLiveTest extends S3ContainerLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java deleted file mode 100644 index 1c57d1cfcf..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageInputStreamMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3InputStreamMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageInputStreamMapIntegrationLiveTest") -public class GoogleStorageInputStreamMapIntegrationLiveTest extends S3InputStreamMapIntegrationLiveTest { - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java deleted file mode 100644 index be898541d4..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageServiceIntegrationLiveTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import java.util.Set; - -import org.jclouds.s3.blobstore.integration.S3ServiceIntegrationLiveTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "GoogleStorageServiceIntegrationLiveTest") -public class GoogleStorageServiceIntegrationLiveTest extends S3ServiceIntegrationLiveTest { - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("US"); - } - -} diff --git a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java b/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java deleted file mode 100644 index 10961a96d4..0000000000 --- a/sandbox-providers/googlestorage/src/test/java/org/jclouds/googlestorage/blobstore/GoogleStorageTestInitializer.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.googlestorage.blobstore; - -import org.jclouds.s3.blobstore.integration.S3TestInitializer; - -/** - * - * @author Adrian Cole - */ -public class GoogleStorageTestInitializer extends S3TestInitializer { - - public GoogleStorageTestInitializer() { - provider = "googlestorage"; - } - -} diff --git a/sandbox-providers/hosteurope-storage/pom.xml b/sandbox-providers/hosteurope-storage/pom.xml deleted file mode 100644 index 1432318169..0000000000 --- a/sandbox-providers/hosteurope-storage/pom.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - hosteurope-storage - jclouds Host Europe Cloud Storage provider - Scality RING (ScalityRS2) implementation targeted to Host Europe Cloud Storage - bundle - - - org.jclouds.hosteurope.storage.blobstore.HostEuropeStorageTestInitializer - https://cs.hosteurope.de - 2006-03-01 - - FIX_ME - FIX_ME - - org.jclouds.hosteurope.storage*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - scality-rs2 - ${project.version} - jar - - - org.jclouds.api - scality-rs2 - ${project.version} - test-jar - test - - - org.jclouds.api - s3 - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.hosteurope-storage.endpoint} - ${test.hosteurope-storage.api-version} - ${test.hosteurope-storage.build-version} - ${test.hosteurope-storage.identity} - ${test.hosteurope-storage.credential} - ${test.initializer} - ${jclouds.blobstore.httpstream.url} - ${jclouds.blobstore.httpstream.md5} - - - - - - - - - - - - diff --git a/sandbox-providers/hosteurope-storage/src/main/java/org/jclouds/hosteurope/storage/HostEuropeStoragePropertiesBuilder.java b/sandbox-providers/hosteurope-storage/src/main/java/org/jclouds/hosteurope/storage/HostEuropeStoragePropertiesBuilder.java deleted file mode 100644 index 87860247b4..0000000000 --- a/sandbox-providers/hosteurope-storage/src/main/java/org/jclouds/hosteurope/storage/HostEuropeStoragePropertiesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage; - -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; - -import java.util.Properties; - -import org.jclouds.scality.rs2.ScalityRS2PropertiesBuilder; - -/** - * Builds properties used in HostEurope Storage - * - * @author Adrian Cole - */ -public class HostEuropeStoragePropertiesBuilder extends ScalityRS2PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ISO3166_CODES, "DE"); - properties.setProperty(PROPERTY_ENDPOINT, "https://cs.hosteurope.de<"); - return properties; - } - - public HostEuropeStoragePropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/HostEuropeStorageClientLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/HostEuropeStorageClientLiveTest.java deleted file mode 100644 index 6157dc8bc4..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/HostEuropeStorageClientLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage; - -import org.jclouds.scality.rs2.ScalityRS2ClientLiveTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code ScalityRS2Client} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "HostEuropeStorageClientLiveTest") -public class HostEuropeStorageClientLiveTest extends ScalityRS2ClientLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobIntegrationLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobIntegrationLiveTest.java deleted file mode 100644 index cbbd731080..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobIntegrationLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageBlobIntegrationLiveTest") -public class HostEuropeStorageBlobIntegrationLiveTest extends ScalityRS2BlobIntegrationLiveTest { - - - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobLiveTest.java deleted file mode 100644 index 12ba8207a8..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageBlobLiveTest") -public class HostEuropeStorageBlobLiveTest extends ScalityRS2BlobLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobMapIntegrationLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobMapIntegrationLiveTest.java deleted file mode 100644 index 41a124da9f..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageBlobMapIntegrationLiveTest") -public class HostEuropeStorageBlobMapIntegrationLiveTest extends ScalityRS2BlobMapIntegrationLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobSignerLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobSignerLiveTest.java deleted file mode 100644 index 6f683aea55..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageBlobSignerLiveTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobSignerLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageBlobSignerLiveTest") -public class HostEuropeStorageBlobSignerLiveTest extends ScalityRS2BlobSignerLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerIntegrationLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerIntegrationLiveTest.java deleted file mode 100644 index e0ccf33c71..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ContainerIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageContainerIntegrationLiveTest") -public class HostEuropeStorageContainerIntegrationLiveTest extends ScalityRS2ContainerIntegrationLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerLiveTest.java deleted file mode 100644 index 1fb3513d61..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageContainerLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ContainerLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageContainerLiveTest") -public class HostEuropeStorageContainerLiveTest extends ScalityRS2ContainerLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageInputStreamMapIntegrationLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageInputStreamMapIntegrationLiveTest.java deleted file mode 100644 index 3df1e2e89c..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageInputStreamMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2InputStreamMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageInputStreamMapIntegrationLiveTest") -public class HostEuropeStorageInputStreamMapIntegrationLiveTest extends ScalityRS2InputStreamMapIntegrationLiveTest { - -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageServiceIntegrationLiveTest.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageServiceIntegrationLiveTest.java deleted file mode 100644 index 9dec9378b3..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageServiceIntegrationLiveTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import java.util.Set; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ServiceIntegrationLiveTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "HostEuropeStorageServiceIntegrationLiveTest") -public class HostEuropeStorageServiceIntegrationLiveTest extends ScalityRS2ServiceIntegrationLiveTest { - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("DE"); - } -} diff --git a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageTestInitializer.java b/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageTestInitializer.java deleted file mode 100644 index 4475db447f..0000000000 --- a/sandbox-providers/hosteurope-storage/src/test/java/org/jclouds/hosteurope/storage/blobstore/HostEuropeStorageTestInitializer.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.hosteurope.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2TestInitializer; - - -/** - * - * @author Adrian Cole - */ -public class HostEuropeStorageTestInitializer extends ScalityRS2TestInitializer { - - public HostEuropeStorageTestInitializer() { - provider = "hosteurope-storage"; - } - - -} diff --git a/sandbox-providers/ibm-smartcloud/pom.xml b/sandbox-providers/ibm-smartcloud/pom.xml deleted file mode 100644 index 3136ab25b4..0000000000 --- a/sandbox-providers/ibm-smartcloud/pom.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - ibm-smartcloud - jclouds IBM SmartCloud core - jclouds components to access IBM SmartCloud - bundle - - - - - jclouds-sona-snapshots-nexus - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - - https://www-147.ibm.com/computecloud/enterprise/api/rest - 20100331 - - FIXME - FIXME - - - org.jclouds.ibm.smartcloud*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - org.jclouds - jclouds-core - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-compute - ${project.version} - - - org.jclouds - jclouds-compute - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - org.jclouds.driver - jclouds-sshj - ${project.version} - test - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.ibm-smartcloud.endpoint} - ${test.ibm-smartcloud.api-version} - ${test.ibm-smartcloud.build-version} - ${test.ibm-smartcloud.identity} - ${test.ibm-smartcloud.credential} - ${test.ibm-smartcloud.image-id} - - - - - - - - - - - - diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClient.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClient.java deleted file mode 100644 index 78ce8e3e94..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClient.java +++ /dev/null @@ -1,358 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import java.util.Date; -import java.util.Set; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.domain.Offering; -import org.jclouds.ibm.smartcloud.domain.StorageOffering; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.jclouds.ibm.smartcloud.functions.ParseLongFromDate; -import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions; -import org.jclouds.ibm.smartcloud.options.RestartInstanceOptions; -import org.jclouds.ibm.smartcloud.xml.LocationHandler; -import org.jclouds.ibm.smartcloud.xml.LocationsHandler; -import org.jclouds.rest.annotations.ExceptionParser; -import org.jclouds.rest.annotations.FormParams; -import org.jclouds.rest.annotations.ParamParser; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.annotations.Unwrap; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; -import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; -import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to IBMSmartCloud via their REST API. - *

- * - * @see IBMSmartCloudClient - * @see - * @author Adrian Cole - */ -@RequestFilters(BasicAuthentication.class) -@SkipEncoding( { '{', '}' }) -public interface IBMSmartCloudAsyncClient { - public static final String VERSION = "20100331"; - - /** - * @see IBMSmartCloudClient#listImages() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/image") - @Consumes(MediaType.APPLICATION_JSON) - @Unwrap - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listImages(); - - /** - * @see IBMSmartCloudClient#getImage(long) - */ - @GET - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/image/{imageId}") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture getImage(@PathParam("imageId") String id); - - /** - * @see IBMSmartCloudClient#getManifestOfImage - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/image/{imageId}/manifest") - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Consumes(MediaType.TEXT_XML) - ListenableFuture getManifestOfImage(@PathParam("imageId") String id); - - /** - * @see IBMSmartCloudClient#deleteImage - */ - @DELETE - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/image/{imageId}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture deleteImage(@PathParam("imageId") String id); - - /** - * @see IBMSmartCloudClient#setImageVisibility(long, Image.Visibility) - */ - @PUT - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/image/{imageId}") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture setImageVisibility(@PathParam("imageId") String id, - @FormParam("visibility") Image.Visibility visibility); - - /** - * @see IBMSmartCloudClient#listInstancesFromRequest(long) - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/requests/{requestId}") - @Unwrap - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture> listInstancesFromRequest(@PathParam("requestId") String requestId); - - /** - * @see IBMSmartCloudClient#listInstances() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances") - @Consumes(MediaType.APPLICATION_JSON) - @Unwrap - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listInstances(); - - /** - * @see IBMSmartCloudClient#getInstance(long) - */ - @GET - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances/{instanceId}") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture getInstance(@PathParam("instanceId") String id); - - /** - * - * @see IBMSmartCloudClient#extendReservationForInstance(long,Date) - */ - @PUT - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances/{instanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Unwrap - ListenableFuture extendReservationForInstance(@PathParam("instanceId") String id, - @FormParam("expirationTime") @ParamParser(ParseLongFromDate.class) Date expirationTime); - - /** - * @see IBMSmartCloudClient#restartInstance - */ - @PUT - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances/{instanceId}") - @FormParams(keys = "state", values = "restart") - ListenableFuture restartInstance(@PathParam("instanceId") String id, RestartInstanceOptions... options); - - /** - * @see IBMSmartCloudClient#saveInstanceToImage - */ - @PUT - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances/{instanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @FormParams(keys = "state", values = "save") - ListenableFuture saveInstanceToImage(@PathParam("instanceId") String id, - @FormParam("name") String toImageName, @FormParam("description") String toImageDescription); - - /** - * @see IBMSmartCloudClient#createInstanceInLocation - */ - @POST - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances") - @Consumes(MediaType.APPLICATION_JSON) - @Unwrap(depth = 2, edgeCollection = Set.class) - ListenableFuture createInstanceInLocation(@FormParam("location") String location, - @FormParam("name") String name, @FormParam("imageID") String imageID, - @FormParam("instanceType") String instanceType, CreateInstanceOptions... options); - - /** - * @see IBMSmartCloudClient#deleteInstance - */ - @DELETE - @Path(IBMSmartCloudAsyncClient.VERSION + "/instances/{instanceId}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture deleteInstance(@PathParam("instanceId") String id); - - /** - * @see IBMSmartCloudClient#listKeys() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys") - @Consumes(MediaType.APPLICATION_JSON) - @Unwrap - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listKeys(); - - /** - * @see IBMSmartCloudClient#generateKeyPair(String) - */ - @POST - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture generateKeyPair(@FormParam("name") String name); - - /** - * @see IBMSmartCloudClient#addPublicKey(String, String) - */ - @POST - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys") - ListenableFuture addPublicKey(@FormParam("name") String name, @FormParam("publicKey") String publicKey); - - /** - * @see IBMSmartCloudClient#updatePublicKey(String, String) - */ - @PUT - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys/{keyName}") - ListenableFuture updatePublicKey(@PathParam("keyName") String name, @FormParam("publicKey") String publicKey); - - /** - * @see IBMSmartCloudClient#setDefaultStatusOfKey(String, boolean) - */ - @PUT - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys/{keyName}") - ListenableFuture setDefaultStatusOfKey(@PathParam("keyName") String name, - @FormParam("default") boolean isDefault); - - /** - * @see IBMSmartCloudClient#getKey(String) - */ - @GET - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys/{keyName}") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture getKey(@PathParam("keyName") String name); - - /** - * @see IBMSmartCloudClient#deleteKey - */ - @DELETE - @Path(IBMSmartCloudAsyncClient.VERSION + "/keys/{keyName}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture deleteKey(@PathParam("keyName") String name); - - /** - * @see IBMSmartCloudClient#listStorageOfferings() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/storage") - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listStorageOfferings(); - - /** - * @see IBMSmartCloudClient#listVolumes() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/storage") - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listVolumes(); - - /** - * @see IBMSmartCloudClient#createVolumeInLocation - */ - @POST - @Path(IBMSmartCloudAsyncClient.VERSION + "/storage") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture createVolumeInLocation(@FormParam("location") String location, - @FormParam("name") String name, @FormParam("format") String format, @FormParam("size") String size, - @FormParam("offeringID") String offeringID); - - /** - * @see IBMSmartCloudClient#getVolume(long) - */ - @GET - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path(IBMSmartCloudAsyncClient.VERSION + "/storage/{volumeId}") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture getVolume(@PathParam("volumeId") String id); - - /** - * @see IBMSmartCloudClient#deleteVolume - */ - @DELETE - @Path(IBMSmartCloudAsyncClient.VERSION + "/storage/{volumeId}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture deleteVolume(@PathParam("volumeId") String id); - - /** - * @see IBMSmartCloudClient#listLocations() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/locations") - @Consumes(MediaType.TEXT_XML) - @XMLResponseParser(LocationsHandler.class) - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listLocations(); - - /** - * @see IBMSmartCloudClient#getLocation - */ - @GET - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - @Path(IBMSmartCloudAsyncClient.VERSION + "/locations/{locationId}") - @Consumes(MediaType.TEXT_XML) - @XMLResponseParser(LocationHandler.class) - ListenableFuture getLocation(@PathParam("locationId") String id); - - /** - * @see IBMSmartCloudClient#listAddressOfferings() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/offerings/address") - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listAddressOfferings(); - - /** - * @see IBMSmartCloudClient#listAddresses() - */ - @GET - @Path(IBMSmartCloudAsyncClient.VERSION + "/addresses") - @Consumes(MediaType.APPLICATION_JSON) - @Unwrap - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listAddresses(); - - /** - * @see IBMSmartCloudClient#allocateAddressInLocation - */ - @POST - @Path(IBMSmartCloudAsyncClient.VERSION + "/addresses") - @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture

allocateAddressInLocation(@FormParam("location") String locationId, - @FormParam("offeringID") String offeringID); - - /** - * @see IBMSmartCloudClient#releaseAddress - */ - @DELETE - @Path(IBMSmartCloudAsyncClient.VERSION + "/addresses/{addressId}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture releaseAddress(@PathParam("addressId") String id); - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java deleted file mode 100644 index ec7ff4a396..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClient.java +++ /dev/null @@ -1,468 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import java.util.Date; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.Timeout; -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.domain.Offering; -import org.jclouds.ibm.smartcloud.domain.StorageOffering; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions; -import org.jclouds.ibm.smartcloud.options.RestartInstanceOptions; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; - -/** - * Provides synchronous access to IBMSmartCloud. - *

- * - * @see IBMSmartCloudAsyncClient - * @see - * @author Adrian Cole - */ -@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) -public interface IBMSmartCloudClient { - /** - * - * @return the list of Images available to be provisioned on the IBM - * DeveloperCloud. - */ - Set listImages(); - - /** - * Returns the available Image identified by the supplied Image ID. - * - * @return null if image is not found - * @throws AuthorizationException - * code 401 if the user is not authorized to view this image to - * section - */ - Image getImage(String id); - - /** - * Deletes Image identified by the supplied Image ID. - * - * @throws AuthorizationException - * code 401 if the user is not authorized to delete this image - * @throws IllegalStateException - * code 412 if the image is in an invalid state to perform this - * operation - */ - void deleteImage(String id); - - String getManifestOfImage(String id); - - /** - * If set to {@code Image.Visibility#PUBLIC}, makes the Image identified by - * the supplied Image ID publicly available for all users to create Instances - * of. - * - * @return modified image or null, if image was not found. - * - * @throws AuthorizationException - * code 401 if the user is not authorized to change the visibility - * of this image - * @throws IllegalStateException - * code 412 if the image is in an invalid state to perform this - * operation - */ - Image setImageVisibility(String id, Image.Visibility visibility); - - /** - * - * @return the list of Instances that the authenticated user manages. - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this information - */ - Set listInstances(); - - /** - * - * @return the list of Instances that the authenticated user manages that - * were created as part of the request specified by {@code requestId} - * , or null if the request was not found - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this request - */ - Set listInstancesFromRequest(String requestId); - - /** - * Returns the Instance that the authenticated user manages with the - * specified {@code id} - * - * @return null if instance is not found - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this instance - */ - Instance getInstance(String id); - - /** - * Requests a new Instance to be created. - * - * @param location - * The id of the Location where this instance will be created - * @param name - * The alias to use to reference this instance - * @param imageID - * The ID of the image to create this instance from - * @param instanceType - * The instance type to use for this instance {SMALL, MEDIUM, - * LARGE} - * @param options - * overrides default public key, mounts a volume, or attaches a - * static ip - * @throws AuthorizationException - * code 401 if the authenticated user is not authorized to create - * instances - *

- * code 402 if payment is required before more instances may be - * created - * @throws IllegalStateException - * code 409 if there are not enough resources in the cloud to - * fulfill this request - *

- * code 412 One or more of the supplied parameters are invalid for - * this request - */ - Instance createInstanceInLocation(String location, String name, String imageID, String instanceType, - CreateInstanceOptions... options); - - /** - * Sets the expiration time of the instance to the value specified - * - * @throws ResourceNotFoundException - * code 404 The instance specified by {@code name} was not found - * @throws AuthorizationException - * code 401 if the user is not authorized to extend the expiration - * time of this instance - *

- * code 402 if payment is required before more instances may be - * created - * @throws IllegalStateException - *

- * code 406 The provided expiration date is not valid code 409 if - * there are not enough resources in the cloud to fulfill this - * request - *

- * code 412 The instance is in an invalid state to perform this - * operation - */ - Date extendReservationForInstance(String id, Date expirationTime); - - /** - * Restart the instance - * - * @param id - * the instance to restart - * @param options - * allows you to specify a new public key for login - * @throws ResourceNotFoundException - * code 404 The instance specified by {@code name} was not found - * @throws AuthorizationException - * code 401 if the user is not authorized to extend the expiration - * time of this instance - *

- * code 402 if payment is required before more instances may be - * created - * @throws IllegalStateException - *

- * code 406 The provided expiration date is not valid code 409 if - * there are not enough resources in the cloud to fulfill this - * request - *

- * code 412 The instance is in an invalid state to perform this - * operation - */ - void restartInstance(String id, RestartInstanceOptions... options); - - /** - * Saves an instance to a private image - * - * @param id - * the instance to save - * @param toImageName - * The name to associate with the captured image. - * @param toImageDescription - * The description to associate with the capture image. - * @return a private image - * @throws ResourceNotFoundException - * code 404 The instance specified by {@code name} was not found - * @throws AuthorizationException - * code 401 if the user is not authorized to extend the expiration - * time of this instance - *

- * code 402 if payment is required before more instances may be - * created - * @throws IllegalStateException - *

- * code 406 The provided expiration date is not valid code 409 if - * there are not enough resources in the cloud to fulfill this - * request - *

- * code 412 The instance is in an invalid state to perform this - * operation - */ - Image saveInstanceToImage(String id, String toImageName, String toImageDescription); - - /** - * Deletes the Instance that the authenticated user manages with the - * specified {@code id} - * - * @throws AuthorizationException - * code 401 if the user is not authorized to delete this instance - * @throws IllegalStateException - * code 412 if the instance is in an invalid state to perform this - * operation - */ - void deleteInstance(String id); - - /** - * - * @return the set of Public Keys stored for the authenticated user. - */ - Set listKeys(); - - /** - * Returns the key with the specified key name from the set of Public Keys - * stored for the authenticated user. - * - * @return null if key is not found - */ - Key getKey(String name); - - /** - * Used to generate a new SSH Key Pair for the authenticated user. - * - * @param name - * The name to used to identify this key pair. - * @return private key - * - * @throws IllegalStateException - * code 409 A key with the specified {@code name} already exists - * - */ - Key generateKeyPair(String name); - - /** - * Used to generate a new SSH Key Pair for the authenticated user. - * - * @param name - * The name to used to identify this key pair. - * @param publicKey - * The RSA SSH Key to add - * - * @throws IllegalStateException - * code 409 A key with the specified {@code name} already exists - *

- * code 412 The supplied public key is invalid - */ - void addPublicKey(String name, String publicKey); - - /** - * Used to update the Public Key specified by the supplied key name stored - * for the authenticated user. - * - * @param name - * The name to used to identify this key pair. - * @param publicKey - * The public key to store - * @throws ResourceNotFoundException - * code 404 The key specified by {@code name} was not found - * @throws IllegalStateException - * code 412 The supplied public key is invalid - */ - void updatePublicKey(String name, String publicKey); - - /** - * Used to set the Public Key specified by the supplied key name as the - * default key. - * - * @param name - * The name to used to identify this key pair. - * @param isDefault - * A boolean representing the default state of this key - * @throws ResourceNotFoundException - * code 404 The key specified by {@code name} was not found - */ - void setDefaultStatusOfKey(String name, boolean isDefault); - - /** - * Deletes Key identified by the supplied key name. - * - * @throws AuthorizationException - * code 401 if the user is not authorized to perform this action - */ - void deleteKey(String name); - - /** - * Used to retrieve the offerings of storage for the authenticated user. - * - * @return offerings or empty set if none - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this information - */ - Set listStorageOfferings(); - - /** - * - * @return the set of storage volumes for the authenticated user. - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this information - */ - Set listVolumes(); - - /** - * Creates a new storage volume for the authenticated user. - * - * @param location - * The id of the Location where the storage volume will be created - * @param name - * The desired name of the newly created storage volume - * @param format - * The filesystem format for the new storage volume. Valid format - * is: EXT3 - * @param size - * The size of the new storage volume. Valid values may include - * SMALL, MEDIUM, and LARGE. Actual values may depend on the - * location used and may be discovered via the location service - * @param offeringID - * The offeringID which can be obtained from - * {@link #listStorageOfferings} - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to create a volume - *

- * code 402 if payment is required before more storage volumes may - * be created - * @throws IllegalStateException - * code 409 if there are not enough resources in the cloud to - * fulfill this request - *

- * code 412 One or more of the supplied parameters are invalid for - * this request - */ - Volume createVolumeInLocation(String location, String name, String format, String size, String offeringID); - - /** - * Used to retrieve the specified storage volume for the authenticated user. - * - * @return null if volume is not found - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this storage volume - */ - Volume getVolume(String id); - - /** - * Remove the specified storage volume for the authenticated user. - * - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to remove this storage volume - * @throws IllegalStateException - * code 412 if the storage volume is not in the correct state to - * be deleted - */ - void deleteVolume(String id); - - /** - * - * @return the list of Locations (Data Centers) that the user is entitled to - * and their capabilities - */ - Set listLocations(); - - /** - * Returns the Location identified by the supplied Location ID - * - * @return null if location is not found - * - * @throws AuthorizationException - * code 401 if the user is not authorized - */ - Location getLocation(String id); - - /** - * - * @return the set of static IP addresses for the authenticated user. - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this information - */ - Set listAddresses(); - - /** - * - * Allocates a new static IP addresses for the authenticated user. - * - * @param locationId - * the id of the Location where this address will be allocated - * @param offeringID - * The offeringID which can be obtained from - * {@link #listAddressOfferings} - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to remove this IP address - *

- * code 402 if payment is required before more addresses may be - * allocated - * - * @throws IllegalStateException - * code 409 if there are not enough resources in the cloud to - * fulfill this request - */ - Address allocateAddressInLocation(String locationId, String offeringID); - - /** - * Used to retrieve the offerings of addresses for the authenticated user. - * - * @return offerings or empty set if none - * @throws AuthorizationException - * code 401 if the currently authenticated user is not authorized - * to view this information - */ - Set listAddressOfferings(); - - /** - * Used to release the specified static IP addresses for the authenticated - * user. - * - * @throws AuthorizationException - * code 401 if the user is not authorized to release this address - * @throws IllegalStateException - * code 412 address is in an invalid state to perform this - * operation - */ - void releaseAddress(String id); - - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java deleted file mode 100644 index cfff1633fe..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudContextBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.compute.ComputeServiceContextBuilder; -import org.jclouds.ibm.smartcloud.compute.config.IBMSmartCloudComputeServiceContextModule; -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudRestClientModule; - -import com.google.inject.Module; - -/** - * @author Adrian Cole - */ -public class IBMSmartCloudContextBuilder extends - ComputeServiceContextBuilder { - - public IBMSmartCloudContextBuilder(Properties props) { - super(IBMSmartCloudClient.class, IBMSmartCloudAsyncClient.class, props); - } - - protected void addClientModule(List modules) { - modules.add(new IBMSmartCloudRestClientModule()); - } - - @Override - protected void addContextModule(List modules) { - modules.add(new IBMSmartCloudComputeServiceContextModule()); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java deleted file mode 100644 index 137c90fd07..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/IBMSmartCloudPropertiesBuilder.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import static org.jclouds.Constants.PROPERTY_API_VERSION; -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; -import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; -import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_RUNNING; -import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES; - -import java.util.Properties; - -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in IBMSmartCloud Clients - * - * @author Adrian Cole - */ -public class IBMSmartCloudPropertiesBuilder extends PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ZONES, "41,61,82,101,121,141"); - properties.setProperty(PROPERTY_ISO3166_CODES, "US-NC,DE-BW,US-CO,CA-ON,JP-12,SG"); - properties.setProperty(PROPERTY_ZONE + ".41." + ISO3166_CODES, "US-NC"); - properties.setProperty(PROPERTY_ZONE + ".61." + ISO3166_CODES, "DE-BW"); - properties.setProperty(PROPERTY_ZONE + ".82." + ISO3166_CODES, "US-CO"); - properties.setProperty(PROPERTY_ZONE + ".101." + ISO3166_CODES, "CA-ON"); - properties.setProperty(PROPERTY_ZONE + ".121." + ISO3166_CODES, "JP-12"); - properties.setProperty(PROPERTY_ZONE + ".141." + ISO3166_CODES, "SG"); - properties.setProperty(PROPERTY_API_VERSION, IBMSmartCloudAsyncClient.VERSION); - properties.setProperty(PROPERTY_ENDPOINT, "https://www-147.ibm.com/computecloud/enterprise/api/rest"); - properties.setProperty(PROPERTY_TIMEOUT_NODE_RUNNING, (15 * 60 * 1000) + ""); - properties.setProperty(PROPERTY_SESSION_INTERVAL, 60 * 5 + ""); - return properties; - } - - public IBMSmartCloudPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java deleted file mode 100644 index dc61b3e570..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeStrategiesByClass.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.config; - -import org.jclouds.compute.config.BindComputeStrategiesByClass; -import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName; -import org.jclouds.compute.strategy.DestroyNodeStrategy; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.compute.strategy.ListNodesStrategy; -import org.jclouds.compute.strategy.RebootNodeStrategy; -import org.jclouds.compute.strategy.ResumeNodeStrategy; -import org.jclouds.compute.strategy.SuspendNodeStrategy; -import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudCreateNodeWithGroupEncodedIntoName; -import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudDestroyNodeStrategy; -import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudGetNodeMetadataStrategy; -import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudLifeCycleStrategy; -import org.jclouds.ibm.smartcloud.compute.strategy.IBMSmartCloudListNodesStrategy; - -/** - * @author Adrian Cole - */ -public class IBMSmartCloudBindComputeStrategiesByClass extends BindComputeStrategiesByClass { - - @Override - protected Class defineAddNodeWithTagStrategy() { - return IBMSmartCloudCreateNodeWithGroupEncodedIntoName.class; - } - - @Override - protected Class defineDestroyNodeStrategy() { - return IBMSmartCloudDestroyNodeStrategy.class; - } - - @Override - protected Class defineGetNodeMetadataStrategy() { - return IBMSmartCloudGetNodeMetadataStrategy.class; - } - - @Override - protected Class defineListNodesStrategy() { - return IBMSmartCloudListNodesStrategy.class; - } - - @Override - protected Class defineRebootNodeStrategy() { - return IBMSmartCloudLifeCycleStrategy.class; - } - - @Override - protected Class defineStartNodeStrategy() { - return IBMSmartCloudLifeCycleStrategy.class; - } - - @Override - protected Class defineStopNodeStrategy() { - return IBMSmartCloudLifeCycleStrategy.class; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java deleted file mode 100644 index 1a1d3a9daf..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudBindComputeSuppliersByClass.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.config; - -import java.util.Set; - -import org.jclouds.compute.config.BindComputeSuppliersByClass; -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.Image; -import org.jclouds.domain.Location; -import org.jclouds.ibm.smartcloud.compute.suppliers.IBMSmartCloudHardwareSupplier; -import org.jclouds.ibm.smartcloud.compute.suppliers.IBMSmartCloudImageSupplier; -import org.jclouds.ibm.smartcloud.compute.suppliers.IBMSmartCloudLocationSupplier; - -import com.google.common.base.Supplier; -/** - * @author Adrian Cole - */ -public class IBMSmartCloudBindComputeSuppliersByClass extends BindComputeSuppliersByClass { - @Override - protected Class>> defineHardwareSupplier() { - return IBMSmartCloudHardwareSupplier.class; - } - - @Override - protected Class>> defineImageSupplier() { - return IBMSmartCloudImageSupplier.class; - } - - @Override - protected Class>> defineLocationSupplier() { - return IBMSmartCloudLocationSupplier.class; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java deleted file mode 100644 index 241ab700e6..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceContextModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.config; - -import org.jclouds.compute.config.BaseComputeServiceContextModule; -import org.jclouds.compute.domain.TemplateBuilder; -import org.jclouds.compute.internal.BaseComputeService; - -import com.google.inject.Injector; - -/** - * Configures the {@link IBMSmartCloudComputeServiceContext}; requires - * {@link BaseComputeService} bound. - * - * @author Adrian Cole - */ -public class IBMSmartCloudComputeServiceContextModule extends BaseComputeServiceContextModule { - - @Override - protected void configure() { - install(new IBMSmartCloudComputeServiceDependenciesModule()); - install(new IBMSmartCloudBindComputeStrategiesByClass()); - install(new IBMSmartCloudBindComputeSuppliersByClass()); - super.configure(); - } - - /** - * cheapest image in most available datacenter - */ - @Override - protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { - return template.imageNameMatches("^SUSE Linux Enterprise Server 11 SP1 for x86.*").locationId("101"); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java deleted file mode 100644 index 8bae00bd0c..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/config/IBMSmartCloudComputeServiceDependenciesModule.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.config; - -import java.security.SecureRandom; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.NodeState; -import org.jclouds.compute.internal.ComputeServiceContextImpl; -import org.jclouds.compute.options.TemplateOptions; -import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet; -import org.jclouds.ibm.smartcloud.IBMSmartCloudAsyncClient; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.compute.functions.InstanceToNodeMetadata; -import org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions; -import org.jclouds.ibm.smartcloud.compute.strategy.CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.internal.RestContextImpl; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; -import com.google.inject.AbstractModule; -import com.google.inject.Provides; -import com.google.inject.Scopes; -import com.google.inject.TypeLiteral; - -/** - * @author Adrian Cole - */ -public class IBMSmartCloudComputeServiceDependenciesModule extends AbstractModule { - - @Override - protected void configure() { - bind(TemplateOptions.class).to(IBMSmartCloudTemplateOptions.class); - bind(new TypeLiteral>() { - }).to(InstanceToNodeMetadata.class); - bind(new TypeLiteral() { - }).to(new TypeLiteral>() { - }).in(Scopes.SINGLETON); - bind(new TypeLiteral>() { - }).to(new TypeLiteral>() { - }).in(Scopes.SINGLETON); - bind(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class).to( - CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.class); - } - - @Provides - @Singleton - Supplier provideSuffix() { - return new Supplier() { - final SecureRandom random = new SecureRandom(); - - @Override - public String get() { - return random.nextInt(100) + ""; - } - }; - - } - - @Provides - @Singleton - @Named("CREDENTIALS") - Map credentialsMap() { - return new ConcurrentHashMap(); - } - - @VisibleForTesting - static final Map instanceStatusToNodeState = ImmutableMap - . builder().put(Instance.Status.ACTIVE, NodeState.RUNNING)// - .put(Instance.Status.STOPPED, NodeState.SUSPENDED)// - .put(Instance.Status.REMOVED, NodeState.TERMINATED)// - .put(Instance.Status.DEPROVISIONING, NodeState.PENDING)// - .put(Instance.Status.FAILED, NodeState.ERROR)// - .put(Instance.Status.NEW, NodeState.PENDING)// - .put(Instance.Status.PROVISIONING, NodeState.PENDING)// - .put(Instance.Status.REJECTED, NodeState.ERROR)// - .put(Instance.Status.RESTARTING, NodeState.PENDING)// - .put(Instance.Status.STARTING, NodeState.PENDING)// - .put(Instance.Status.STOPPING, NodeState.PENDING)// - .put(Instance.Status.DEPROVISION_PENDING, NodeState.PENDING)// - .put(Instance.Status.UNKNOWN, NodeState.UNRECOGNIZED).build(); - - @Singleton - @Provides - Map provideServerToNodeState() { - return instanceStatusToNodeState; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java deleted file mode 100644 index d7d1de4c23..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/functions/InstanceToNodeMetadata.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.functions; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName; - -import java.util.Map; -import java.util.Set; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.NodeMetadataBuilder; -import org.jclouds.compute.domain.NodeState; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.Location; -import org.jclouds.ibm.smartcloud.domain.IP; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.logging.Logger; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Function; -import com.google.common.base.Predicates; -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -/** - * @author Adrian Cole - */ -@Singleton -public class InstanceToNodeMetadata implements Function { - - @VisibleForTesting - public static final Map instanceStatusToNodeState = ImmutableMap - . builder().put(Instance.Status.ACTIVE, NodeState.RUNNING)// - .put(Instance.Status.STOPPED, NodeState.SUSPENDED)// - .put(Instance.Status.REMOVED, NodeState.TERMINATED)// - .put(Instance.Status.DEPROVISIONING, NodeState.PENDING)// - .put(Instance.Status.FAILED, NodeState.ERROR)// - .put(Instance.Status.NEW, NodeState.PENDING)// - .put(Instance.Status.PROVISIONING, NodeState.PENDING)// - .put(Instance.Status.REJECTED, NodeState.ERROR)// - .put(Instance.Status.RESTARTING, NodeState.PENDING)// - .put(Instance.Status.STARTING, NodeState.PENDING)// - .put(Instance.Status.STOPPING, NodeState.PENDING)// - .put(Instance.Status.DEPROVISION_PENDING, NodeState.PENDING)// - .put(Instance.Status.UNKNOWN, NodeState.UNRECOGNIZED).build(); - @Resource - protected Logger logger = Logger.NULL; - private final Map instanceStateToNodeState; - private final Supplier> images; - private final Map credentialsMap; - private final Supplier> locations; - - @Inject - InstanceToNodeMetadata(Map instanceStateToNodeState, - Supplier> images, @Named("CREDENTIALS") Map credentialsMap, - Supplier> locations) { - this.instanceStateToNodeState = checkNotNull(instanceStateToNodeState, "instanceStateToNodeState"); - this.images = checkNotNull(images, "images"); - this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap"); - this.locations = checkNotNull(locations, "locations"); - } - - private static Function ipFromIP = new Function() { - - @Override - public String apply(IP arg0) { - return arg0 != null ? arg0.getIP() : null; - } - - }; - - @Override - public NodeMetadata apply(Instance from) { - // TODO hardware - String group = parseGroupFromName(from.getName()); - String ip = ipFromIP.apply(from.getPrimaryIP()); - Set ipSet = ip != null ? ImmutableSet.of(ip) : ImmutableSet. of(); - Image image = images.get().get(from.getImageId()); - String key = credentialsMap.get(from.getKeyName()); - return new NodeMetadataBuilder().ids(from.getId() + "").name(from.getName()).location( - locations.get().get(image.getLocation())).group(group).imageId(from.getImageId()).state( - instanceStateToNodeState.get(from.getStatus())).operatingSystem( - image != null ? image.getOperatingSystem() : null).publicAddresses(ipSet).privateAddresses( - Iterables.filter(Iterables.transform(from.getSecondaryIPs(), ipFromIP), Predicates.notNull())) - .credentials(new Credentials(image.getDefaultCredentials().identity, key)).build(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java deleted file mode 100644 index 857cb68bf3..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/options/IBMSmartCloudTemplateOptions.java +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.options; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -import java.util.Arrays; - -import org.jclouds.compute.options.TemplateOptions; -import org.jclouds.domain.Credentials; -import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions; -import org.jclouds.io.Payload; -import org.jclouds.scriptbuilder.domain.Statement; -import org.jclouds.util.Preconditions2; - -/** - * Contains options supported in the {@code ComputeService#runNode} operation on the - * "ibm.smartcloud" provider.

- * Usage

The recommended way to instantiate a IBMSmartCloudTemplateOptions object is to - * statically import IBMSmartCloudTemplateOptions.* and invoke a static creation method followed by - * an instance mutator (if needed): - *

- * - * import static org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions.Builder.*; - *

- * ComputeService client = // get connection - * templateBuilder.options(inboundPorts(22, 80, 8080, 443)); - * Set set = client.runNodesWithTag(tag, 2, templateBuilder.build()); - * - * - * @author Adrian Cole - */ -public class IBMSmartCloudTemplateOptions extends TemplateOptions implements Cloneable { - @Override - public IBMSmartCloudTemplateOptions clone() { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - copyTo(options); - return options; - } - - @Override - public void copyTo(TemplateOptions to) { - super.copyTo(to); - if (to instanceof IBMSmartCloudTemplateOptions) { - IBMSmartCloudTemplateOptions eTo = IBMSmartCloudTemplateOptions.class.cast(to); - if (getKeyPair() != null) - eTo.keyPair(getKeyPair()); - if (!shouldAutomaticallyCreateKeyPair()) - eTo.noKeyPair(); - if (!isMiniEphemeral) - eTo.isMiniEphemeral(false); - } - } - - private String keyPair = null; - private boolean noKeyPair; - private boolean isMiniEphemeral = true; - - public static final IBMSmartCloudTemplateOptions NONE = new IBMSmartCloudTemplateOptions(); - - /** - * @see CreateInstanceOptions#isMiniEphemeral - */ - public IBMSmartCloudTemplateOptions isMiniEphemeral(boolean isMiniEphemeral) { - this.isMiniEphemeral = isMiniEphemeral; - return this; - } - - /** - * Specifies the keypair used to run instances with - */ - public IBMSmartCloudTemplateOptions keyPair(String keyPair) { - checkNotNull(keyPair, "use noKeyPair option to request boot without a keypair"); - checkState(!noKeyPair, "you cannot specify both options keyPair and noKeyPair"); - Preconditions2.checkNotEmpty(keyPair, "keypair must be non-empty"); - this.keyPair = keyPair; - return this; - } - - /** - * Do not use a keypair on instances - */ - public IBMSmartCloudTemplateOptions noKeyPair() { - checkState(keyPair == null, "you cannot specify both options keyPair and noKeyPair"); - this.noKeyPair = true; - return this; - } - - public static class Builder { - - /** - * @see IBMSmartCloudTemplateOptions#isMiniEphemeral - */ - public static IBMSmartCloudTemplateOptions isMiniEphemeral(boolean isMiniEphemeral) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return options.isMiniEphemeral(isMiniEphemeral); - } - - /** - * @see IBMSmartCloudTemplateOptions#keyPair - */ - public static IBMSmartCloudTemplateOptions keyPair(String keyPair) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.keyPair(keyPair)); - } - - /** - * @see IBMSmartCloudTemplateOptions#noKeyPair - */ - public static IBMSmartCloudTemplateOptions noKeyPair() { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.noKeyPair()); - } - - - // methods that only facilitate returning the correct object type - /** - * @see TemplateOptions#inboundPorts - */ - public static IBMSmartCloudTemplateOptions inboundPorts(int... ports) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.inboundPorts(ports)); - } - - /** - * @see TemplateOptions#port - */ - public static IBMSmartCloudTemplateOptions blockOnPort(int port, int seconds) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds)); - } - - /** - * @see TemplateOptions#runScript - */ - public static IBMSmartCloudTemplateOptions runScript(byte[] script) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.runScript(script)); - } - - /** - * @see TemplateOptions#installPrivateKey - */ - public static IBMSmartCloudTemplateOptions installPrivateKey(String rsaKey) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.installPrivateKey(rsaKey)); - } - - /** - * @see TemplateOptions#authorizePublicKey - */ - public static IBMSmartCloudTemplateOptions authorizePublicKey(String rsaKey) { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.authorizePublicKey(rsaKey)); - } - - /** - * @see TemplateOptions#withDetails - */ - public static IBMSmartCloudTemplateOptions withDetails() { - IBMSmartCloudTemplateOptions options = new IBMSmartCloudTemplateOptions(); - return IBMSmartCloudTemplateOptions.class.cast(options.withMetadata()); - } - - } - - // methods that only facilitate returning the correct object type - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions blockOnPort(int port, int seconds) { - return IBMSmartCloudTemplateOptions.class.cast(super.blockOnPort(port, seconds)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions inboundPorts(int... ports) { - return IBMSmartCloudTemplateOptions.class.cast(super.inboundPorts(ports)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions authorizePublicKey(String publicKey) { - return IBMSmartCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey)); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public IBMSmartCloudTemplateOptions authorizePublicKey(Payload publicKey) { - return IBMSmartCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions installPrivateKey(String privateKey) { - return IBMSmartCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey)); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public IBMSmartCloudTemplateOptions installPrivateKey(Payload privateKey) { - return IBMSmartCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions runScript(Payload script) { - return IBMSmartCloudTemplateOptions.class.cast(super.runScript(script)); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public IBMSmartCloudTemplateOptions runScript(byte[] script) { - return IBMSmartCloudTemplateOptions.class.cast(super.runScript(script)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions withMetadata() { - return IBMSmartCloudTemplateOptions.class.cast(super.withMetadata()); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions blockUntilRunning(boolean blockUntilRunning) { - return IBMSmartCloudTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions dontAuthorizePublicKey() { - return IBMSmartCloudTemplateOptions.class.cast(super.dontAuthorizePublicKey()); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions nameTask(String name) { - return IBMSmartCloudTemplateOptions.class.cast(super.nameTask(name)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions runAsRoot(boolean runAsRoot) { - return IBMSmartCloudTemplateOptions.class.cast(super.runAsRoot(runAsRoot)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions runScript(Statement script) { - return IBMSmartCloudTemplateOptions.class.cast(super.runScript(script)); - } - - /** - * {@inheritDoc} - */ - @Override - public IBMSmartCloudTemplateOptions overrideCredentialsWith(Credentials overridingCredentials) { - return IBMSmartCloudTemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials)); - } - - /** - * @return keyPair to use when running the instance or null, to generate a keypair. - */ - public String getKeyPair() { - return keyPair; - } - - /** - * @return true (default) if we are supposed to use a keypair - */ - public boolean shouldAutomaticallyCreateKeyPair() { - return !noKeyPair; - } - - /** - * @see CreateInstanceOptions#isMiniEphemeral - */ - public boolean isMiniEphemeral() { - return isMiniEphemeral; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((keyPair == null) ? 0 : keyPair.hashCode()); - result = prime * result + (noKeyPair ? 1231 : 1237); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - IBMSmartCloudTemplateOptions other = (IBMSmartCloudTemplateOptions) obj; - if (keyPair == null) { - if (other.keyPair != null) - return false; - } else if (!keyPair.equals(other.keyPair)) - return false; - if (noKeyPair != other.noKeyPair) - return false; - return true; - } - - @Override - public String toString() { - return "[keyPair=" + keyPair + ", noKeyPair=" + noKeyPair + ", isMiniEphemeral=" + isMiniEphemeral - + ", inboundPorts=" + Arrays.toString(inboundPorts) + ", privateKey=" + (privateKey != null) - + ", publicKey=" + (publicKey != null) + ", runScript=" + (script != null) + ", port:seconds=" + port - + ":" + seconds + ", metadata/details: " + includeMetadata + "]"; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java deleted file mode 100644 index b5a54dafb9..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.Constants; -import org.jclouds.compute.config.CustomizationResponse; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.Template; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName; -import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap; -import org.jclouds.compute.strategy.ListNodesStrategy; -import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.logging.Logger; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Supplier; -import com.google.common.collect.Multimap; - -/** - * @author Adrian Cole - */ -@Singleton -public class CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet extends - CreateNodesWithGroupEncodedIntoNameThenAddToSet { - - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - - private final IBMSmartCloudClient client; - private final Map credentialsMap; - private final Supplier randomSuffix; - - @Inject - protected CreateKeyCreateNodesWithGroupEncodedIntoNameThenAddToSet( - CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy, - ListNodesStrategy listNodesStrategy, - @Named("NAMING_CONVENTION") String nodeNamingConvention, - @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, - CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory, - IBMSmartCloudClient client, @Named("CREDENTIALS") Map credentialsMap, - Supplier randomSuffix) { - super(addNodeWithTagStrategy, listNodesStrategy, nodeNamingConvention, executor, - customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory); - this.client = checkNotNull(client, "client"); - this.credentialsMap = checkNotNull(credentialsMap, "credentialsMap"); - this.randomSuffix = checkNotNull(randomSuffix, "randomSuffix"); - } - - @Override - public Map> execute(String group, int count, Template template, Set goodNodes, - Map badNodes, Multimap customizationResponses) { - IBMSmartCloudTemplateOptions options = template.getOptions().as(IBMSmartCloudTemplateOptions.class); - if (options.shouldAutomaticallyCreateKeyPair() && options.getKeyPair() == null) { - Key key = createNewKey(group); - options.keyPair(key.getName()); - credentialsMap.put(key.getName(), key.getKeyMaterial()); - } - return super.execute(group, count, template, goodNodes, badNodes, customizationResponses); - } - - @VisibleForTesting - Key createNewKey(String group) { - checkNotNull(group, "group"); - logger.debug(">> creating key group(%s)", group); - Key key = null; - while (key == null) { - try { - key = client.generateKeyPair(getNextName(group)); - logger.debug("<< created key(%s)", key.getName()); - } catch (IllegalStateException e) { - - } - } - return key; - } - - private String getNextName(String group) { - return String.format("jclouds#%s#%s", group, randomSuffix.get()); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java deleted file mode 100644 index 2172d92d0b..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudCreateNodeWithGroupEncodedIntoName.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.ibm.smartcloud.options.CreateInstanceOptions.Builder.authorizePublicKey; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.Template; -import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.compute.options.IBMSmartCloudTemplateOptions; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudCreateNodeWithGroupEncodedIntoName implements CreateNodeWithGroupEncodedIntoName { - - private final IBMSmartCloudClient client; - private final Function instanceToNodeMetadata; - - @Inject - protected IBMSmartCloudCreateNodeWithGroupEncodedIntoName(IBMSmartCloudClient client, - Function instanceToNodeMetadata) { - this.client = checkNotNull(client, "client"); - this.instanceToNodeMetadata = checkNotNull(instanceToNodeMetadata, "instanceToNodeMetadata"); - } - - @Override - public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) { - IBMSmartCloudTemplateOptions templateOptions = template.getOptions().as(IBMSmartCloudTemplateOptions.class); - CreateInstanceOptions options = authorizePublicKey(templateOptions.getKeyPair()).isMiniEphemeral( - IBMSmartCloudTemplateOptions.class.cast(template.getOptions()).isMiniEphemeral()); - Instance instance = client.createInstanceInLocation(template.getLocation().getId(), name, template.getImage() - .getProviderId(), template.getHardware().getProviderId(), options); - return instanceToNodeMetadata.apply(instance); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java deleted file mode 100644 index 18fe9b12d8..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudDestroyNodeStrategy.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.concurrent.TimeUnit; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.compute.strategy.DestroyNodeStrategy; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.predicates.InstanceActiveOrFailed; -import org.jclouds.logging.Logger; -import org.jclouds.predicates.RetryablePredicate; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudDestroyNodeStrategy implements DestroyNodeStrategy { - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - - private final IBMSmartCloudClient client; - private final GetNodeMetadataStrategy getNode; - - @Inject - protected IBMSmartCloudDestroyNodeStrategy(IBMSmartCloudClient client, GetNodeMetadataStrategy getNode) { - this.client = checkNotNull(client, "client"); - this.getNode = checkNotNull(getNode, "getNode"); - } - - @Override - public NodeMetadata destroyNode(String id) { - Instance instance = client.getInstance(id); - if (instance != null && instance.getStatus() != Instance.Status.DEPROVISIONING - && instance.getStatus() != Instance.Status.DEPROVISION_PENDING) { - // often it takes 8 minutes to finish provisioning a suse host - int timeout = (instance.getStatus() == Instance.Status.NEW || instance.getStatus() == Instance.Status.PROVISIONING) ? 600 - : 30; - logger.debug(">> awaiting up to %s seconds for instance %s to be ready for delete", timeout, id); - boolean ready = new RetryablePredicate(new InstanceActiveOrFailed(client), timeout, 2, - TimeUnit.SECONDS).apply(instance); - logger.debug(">> instance state is %sready, deleting", ready ? "" : "not ", id); - client.deleteInstance(instance.getId()); - } - return instance != null ? getNode.getNode(id) : null; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java deleted file mode 100644 index 3f7061de6c..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudGetNodeMetadataStrategy.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Instance; - -import com.google.common.base.Function; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy { - private final IBMSmartCloudClient client; - private final Function instanceToNodeMetadata; - - @Inject - protected IBMSmartCloudGetNodeMetadataStrategy(IBMSmartCloudClient client, - Function instanceToNodeMetadata) { - this.client = client; - this.instanceToNodeMetadata = instanceToNodeMetadata; - } - - @Override - public NodeMetadata getNode(String id) { - Instance instance = client.getInstance(checkNotNull(id, "id")); - return instance == null ? null : instanceToNodeMetadata.apply(instance); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java deleted file mode 100644 index 13772c0e78..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudLifeCycleStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.strategy.GetNodeMetadataStrategy; -import org.jclouds.compute.strategy.RebootNodeStrategy; -import org.jclouds.compute.strategy.ResumeNodeStrategy; -import org.jclouds.compute.strategy.SuspendNodeStrategy; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudLifeCycleStrategy implements RebootNodeStrategy, SuspendNodeStrategy, ResumeNodeStrategy { - - private final IBMSmartCloudClient client; - private final GetNodeMetadataStrategy getNode; - - @Inject - protected IBMSmartCloudLifeCycleStrategy(IBMSmartCloudClient client, GetNodeMetadataStrategy getNode) { - this.client = checkNotNull(client, "client"); - this.getNode = checkNotNull(getNode, "getNode"); - } - - @Override - public NodeMetadata rebootNode(String id) { - client.restartInstance(id); - return getNode.getNode(id); - } - - @Override - public NodeMetadata suspendNode(String id) { - throw new UnsupportedOperationException("suspend not supported"); - } - - @Override - public NodeMetadata resumeNode(String id) { - throw new UnsupportedOperationException("resume not supported"); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java deleted file mode 100644 index 700c59c107..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/strategy/IBMSmartCloudListNodesStrategy.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.strategy; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.ComputeMetadata; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.predicates.NodePredicates; -import org.jclouds.compute.strategy.ListNodesStrategy; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Instance; - -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudListNodesStrategy implements ListNodesStrategy { - private final IBMSmartCloudClient client; - private final Function instanceToNodeMetadata; - - @Inject - protected IBMSmartCloudListNodesStrategy(IBMSmartCloudClient client, - Function instanceToNodeMetadata) { - this.client = client; - this.instanceToNodeMetadata = instanceToNodeMetadata; - } - - @Override - public Iterable listNodes() { - return listDetailsOnNodesMatching(NodePredicates.all()); - } - - @Override - public Iterable listDetailsOnNodesMatching(Predicate filter) { - return Iterables.filter(Iterables.transform(client.listInstances(), instanceToNodeMetadata), filter); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java deleted file mode 100644 index f4f2d51760..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudHardwareSupplier.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.suppliers; - -import java.util.Map; -import java.util.Set; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Hardware; -import org.jclouds.compute.domain.HardwareBuilder; -import org.jclouds.compute.domain.Processor; -import org.jclouds.compute.domain.Volume; -import org.jclouds.compute.domain.internal.VolumeImpl; -import org.jclouds.compute.predicates.ImagePredicates; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.domain.Location; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.InstanceType; -import org.jclouds.logging.Logger; - -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Sets; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudHardwareSupplier implements Supplier> { - - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - private final IBMSmartCloudClient sync; - private final Supplier> locations; - - @Inject - IBMSmartCloudHardwareSupplier(IBMSmartCloudClient sync, Supplier> locations) { - this.sync = sync; - this.locations = locations; - } - - @Override - public Set get() { - final Set hardware = Sets.newHashSet(); - logger.debug(">> providing hardware"); - for (org.jclouds.ibm.smartcloud.domain.Image image : sync.listImages()) { - for (InstanceType instanceType : image.getSupportedInstanceTypes()) { - hardware.add(new HardwareBuilder() - .id(image.getId() + "/" + instanceType.getId()) - .providerId(instanceType.getId()) - .name(instanceType.getLabel()) - .location(locations.get().get(image.getLocation())) - .uri(image.getManifest()) - .processors(ImmutableList.of(new Processor((instanceType.getPrice().getRate() * 100), 1.0))) - .ram((int) instanceType.getPrice().getRate() * 1024) - .supportsImage(ImagePredicates.idEquals(image.getId())) - .volumes( - ImmutableList. of(new VolumeImpl((float) (instanceType.getPrice().getRate() * 100d), - true, true))).build()); - - } - } - logger.debug("<< hardware(%d)", hardware.size()); - return hardware; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java deleted file mode 100644 index 2f0b5a4c89..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudImageSupplier.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.suppliers; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; -import java.util.Set; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.ImageBuilder; -import org.jclouds.compute.domain.OperatingSystem; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.Location; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Image.Architecture; -import org.jclouds.logging.Logger; - -import com.google.common.base.Splitter; -import com.google.common.base.Supplier; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudImageSupplier implements Supplier> { - - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - private final IBMSmartCloudClient sync; - private final Supplier> locations; - - @Inject - IBMSmartCloudImageSupplier(final IBMSmartCloudClient sync, Supplier> locations) { - this.sync = sync; - this.locations = locations; - } - - @Override - public Set get() { - final Set images = Sets.newHashSet(); - logger.debug(">> providing images"); - - for (org.jclouds.ibm.smartcloud.domain.Image image : sync.listImages()) { - - OperatingSystem.Builder osBuilder = OperatingSystem.builder(); - Iterable osVersion = Splitter.on('/').split(checkNotNull(image.getPlatform(), "platform")); - osBuilder.version(Iterables.get(osVersion, 1)); - osBuilder.name(image.getPlatform()); - osBuilder.description(image.getPlatform()); - if ("Red Hat Enterprise Linux".equals(Iterables.get(osVersion, 0))) - osBuilder.family(OsFamily.RHEL); - else if ("SUSE Linux Enterprise Server".equals(Iterables.get(osVersion, 0))) - osBuilder.family(OsFamily.SUSE); - else if ("Windows".equals(Iterables.get(osVersion, 0))) - osBuilder.family(OsFamily.WINDOWS); - else - osBuilder.family(OsFamily.UNRECOGNIZED); - osBuilder.arch(image.getArchitecture().toString()); - osBuilder.is64Bit(image.getArchitecture() == Architecture.X86_64); - - // TODO manifest fails to parse due to encoding issues in the path - // TODO get correct default credentials - // http://www-180.ibm.com/cloud/enterprise/beta/ram/community/_rlvid.jsp.faces?_rap=pc_DiscussionForum.doDiscussionTopic&_rvip=/community/discussionForum.jsp&guid={DA689AEE-783C-6FE7-6F9F-DFEE9763F806}&v=1&submission=false&fid=1068&tid=1527 - images.add(new ImageBuilder().ids(image.getId()).name(image.getName()).location( - locations.get().get(image.getLocation())).operatingSystem(osBuilder.build()).description( - image.getName()).version(image.getCreatedTime().getTime() + "").defaultCredentials( - new Credentials("idcuser", null)).build()); - } - - logger.debug("<< images(%d)", images.size()); - return images; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java deleted file mode 100644 index cac22bc48a..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute.suppliers; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Map; -import java.util.Set; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.domain.Location; -import org.jclouds.domain.LocationBuilder; -import org.jclouds.domain.LocationScope; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Location.State; -import org.jclouds.location.Iso3166; -import org.jclouds.location.Provider; -import org.jclouds.location.suppliers.JustProvider; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.ImmutableSet.Builder; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class IBMSmartCloudLocationSupplier extends JustProvider { - - private final IBMSmartCloudClient sync; - private final Map> isoCodesById; - - @Inject - IBMSmartCloudLocationSupplier(@Iso3166 Set isoCodes, @Provider String providerName, @Provider URI endpoint, - IBMSmartCloudClient sync, @Iso3166 Map> isoCodesById) { - super(isoCodes, providerName, endpoint); - this.sync = checkNotNull(sync, "sync"); - this.isoCodesById = checkNotNull(isoCodesById, "isoCodesById"); - } - - @Override - public Set get() { - Builder locations = ImmutableSet.builder(); - Set list = sync.listLocations(); - Location provider = Iterables.getOnlyElement(super.get()); - if (list.size() == 0) - locations.add(provider); - else - for (org.jclouds.ibm.smartcloud.domain.Location from : list) { - if (from.getState() != State.OFFLINE) { - LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "") - .description(from.getName()).parent(provider); - if (isoCodesById.containsKey(from.getId() + "")) - builder.iso3166Codes(isoCodesById.get(from.getId() + "")); - locations.add(builder.build()); - } - } - return locations.build(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java deleted file mode 100644 index 4c318fe11f..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.config; - -import java.lang.reflect.Type; -import java.net.URI; -import java.util.Map; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpUtils; -import org.jclouds.json.config.GsonModule.DateAdapter; -import org.jclouds.json.config.GsonModule.LongDateAdapter; - -import com.google.common.collect.ImmutableMap; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.inject.AbstractModule; -import com.google.inject.Provides; - -/** - * - * - * @author Adrian Cole - */ -public class IBMSmartCloudParserModule extends AbstractModule { - @Singleton - public static class CurlyBraceCapableURIAdapter implements JsonDeserializer { - @Override - public URI deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) - throws JsonParseException { - String toParse = jsonElement.getAsJsonPrimitive().getAsString(); - URI toReturn = HttpUtils.createUri(toParse); - return toReturn; - } - } - - @Provides - @Singleton - public Map provideCustomAdapterBindings(CurlyBraceCapableURIAdapter adapter) { - return ImmutableMap. of(URI.class, adapter); - } - - @Override - protected void configure() { - bind(DateAdapter.class).to(LongDateAdapter.class); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java deleted file mode 100644 index d9fc016372..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.config; - -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.http.annotation.Redirection; -import org.jclouds.http.annotation.ServerError; -import org.jclouds.ibm.smartcloud.IBMSmartCloudAsyncClient; -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.handlers.IBMSmartCloudErrorHandler; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; - -/** - * Configures the IBMSmartCloud connection. - * - * @author Adrian Cole - */ -@RequiresHttp -@ConfiguresRestClient -public class IBMSmartCloudRestClientModule extends - RestClientModule { - - public IBMSmartCloudRestClientModule() { - super(IBMSmartCloudClient.class, IBMSmartCloudAsyncClient.class); - } - - @Override - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to( - IBMSmartCloudErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to( - IBMSmartCloudErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to( - IBMSmartCloudErrorHandler.class); - } - - @Override - protected void configure() { - install(new IBMSmartCloudParserModule()); - super.configure(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java deleted file mode 100644 index 10b21b5c18..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import javax.annotation.Nullable; - -/** - * - * The current state of a Address - * - * @author Adrian Cole - */ -public class Address implements Comparable

{ - - public static enum State { - NEW, ALLOCATING, FREE, ATTACHED, RELEASING, RELEASED, FAILED, RELEASE_PENDING; - public static State fromValue(int v) { - switch (v) { - case 0: - return NEW; - case 1: - return ALLOCATING; - case 2: - return FREE; - case 3: - return ATTACHED; - case 4: - return RELEASING; - case 5: - return RELEASED; - case 6: - return FAILED; - case 7: - return RELEASE_PENDING; - default: - throw new IllegalArgumentException("invalid state:" + v); - } - } - } - - private int state; - private String location; - private String ip; - private String id; - @Nullable - private String instanceId; - - public Address(int state, String location, String ip, String id, String instanceId) { - this.state = state; - this.location = location; - this.ip = ip; - this.id = id; - this.instanceId = instanceId; - } - - Address() { - - } - - public State getState() { - return State.fromValue(state); - } - - public String getLocation() { - return location; - } - - public String getIP() { - return "".equals(ip.trim()) ? null : ip.trim(); - } - - public String getId() { - return id; - } - - public String getInstanceId() { - return instanceId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode()); - result = prime * result + ((ip == null) ? 0 : ip.hashCode()); - result = prime * result + ((location == null) ? 0 : location.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Address other = (Address) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (instanceId == null) { - if (other.instanceId != null) - return false; - } else if (!instanceId.equals(other.instanceId)) - return false; - if (ip == null) { - if (other.ip != null) - return false; - } else if (!ip.equals(other.ip)) - return false; - if (location == null) { - if (other.location != null) - return false; - } else if (!location.equals(other.location)) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", ip=" + ip + ", location=" + location + ", state=" + getState() + ", instanceId=" - + instanceId + "]"; - } - - @Override - public int compareTo(Address arg0) { - return id.compareTo(arg0.getId()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java deleted file mode 100644 index 1b7da88e58..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.annotations.Beta; - -/** - * - * - * @author Adrian Cole - */ -public class IP { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String ip; - private String hostname; - private int type; - - public Builder ip(String ip) { - this.ip = ip; - return this; - } - - public Builder hostname(String hostname) { - this.hostname = hostname; - return this; - } - - public Builder type(int type) { - this.type = type; - return this; - } - - public IP build() { - return new IP(ip, hostname, type); - } - } - - private String ip; - private String hostname; - @Beta - private int type; - - IP() { - - } - - public IP(String ip, String hostname, int type) { - this.ip = checkNotNull(ip, "ip"); - this.hostname = checkNotNull(hostname, "hostname"); - this.type = type; - } - - // TODO custom parser to do this once - public String getHostname() { - return "".equals(hostname.trim()) ? null : hostname.trim(); - } - - public String getIP() { - return "".equals(ip.trim()) ? null : ip.trim(); - } - - public int getType() { - return type; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((hostname == null) ? 0 : hostname.hashCode()); - result = prime * result + ((ip == null) ? 0 : ip.hashCode()); - result = prime * result + type; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - IP other = (IP) obj; - if (hostname == null) { - if (other.hostname != null) - return false; - } else if (!hostname.equals(other.hostname)) - return false; - if (ip == null) { - if (other.ip != null) - return false; - } else if (!ip.equals(other.ip)) - return false; - if (type != other.type) - return false; - return true; - } - - @Override - public String toString() { - return String.format("[hostname=%s, ip=%s, type=%s]", hostname, ip, type); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java deleted file mode 100644 index e6deb043eb..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import java.net.URI; -import java.util.Date; -import java.util.Set; -import java.util.SortedSet; - -import com.google.common.collect.ImmutableSortedSet; -import com.google.common.collect.Sets; - -/** - * - * The current state of the image. - * - * @author Adrian Cole - */ -public class Image implements Comparable { - - public static enum State { - NEW, AVAILABLE, UNAVAILABLE, DELETED, CAPTURING, UNRECOGNIZED; - public static State fromValue(String v) { - switch (Integer.parseInt(v)) { - case 0: - return NEW; - case 1: - return AVAILABLE; - case 2: - return UNAVAILABLE; - case 3: - return DELETED; - case 4: - return CAPTURING; - default: - return UNRECOGNIZED; - } - } - } - - public static enum Visibility { - - PUBLIC, - - SHARED, - - PRIVATE; - } - - public static enum Architecture { - I386, X86_64, UNRECOGNIZED; - public String value() { - return name().toLowerCase(); - } - - public static Architecture fromValue(String v) { - try { - return valueOf(v.toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - } - - private String name; - - private URI manifest; - private State state; - private Visibility visibility; - private String owner; - private String platform; - private Architecture architecture; - private Date createdTime; - private String location; - // for testing to be the same order each time - private SortedSet supportedInstanceTypes = Sets.newTreeSet(); - private SortedSet productCodes = Sets.newTreeSet(); - private URI documentation; - private String id; - private String description; - - Image() { - - } - - public Image(String name, URI manifest, State state, Visibility visibility, String owner, String platform, - Architecture architecture, Date createdTime, String location, Set supportedInstanceTypes, - Set productCodes, URI documentation, String id, String description) { - this.name = name; - this.manifest = manifest; - this.state = state; - this.visibility = visibility; - this.owner = owner; - this.platform = platform; - this.architecture = architecture; - this.createdTime = createdTime; - this.location = location; - this.supportedInstanceTypes = ImmutableSortedSet.copyOf(supportedInstanceTypes); - this.productCodes = ImmutableSortedSet.copyOf(productCodes); - this.documentation = documentation; - this.id = id; - this.description = description; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((location == null) ? 0 : location.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Image other = (Image) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (location == null) { - if (other.location != null) - return false; - } else if (!location.equals(other.location)) - return false; - return true; - } - - @Override - public String toString() { - return String - .format( - "[id=%s, name=%s, architecture=%s, createdTime=%s, description=%s, documentation=%s, location=%s, manifest=%s, owner=%s, platform=%s, productCodes=%s, state=%s, supportedInstanceTypes=%s, visibility=%s]", - id, name, architecture, createdTime, description, documentation, location, manifest, owner, - platform, productCodes, state, supportedInstanceTypes, visibility); - } - - public String getName() { - return name; - } - - public URI getManifest() { - return manifest; - } - - public State getState() { - return state; - } - - public Visibility getVisibility() { - return visibility; - } - - public String getOwner() { - return owner; - } - - public String getPlatform() { - return platform; - } - - public Architecture getArchitecture() { - return architecture; - } - - public Date getCreatedTime() { - return createdTime; - } - - public String getLocation() { - return location; - } - - public Set getSupportedInstanceTypes() { - return supportedInstanceTypes; - } - - public Set getProductCodes() { - return productCodes; - } - - public URI getDocumentation() { - return documentation; - } - - public String getId() { - return id; - } - - public String getDescription() { - return description; - } - - @Override - public int compareTo(Image arg0) { - return id.compareTo(arg0.getId()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java deleted file mode 100644 index 2c885ad5d2..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java +++ /dev/null @@ -1,449 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Date; -import java.util.Set; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; -import com.google.gson.annotations.SerializedName; - -/** - * - * The current state of the instance. - * - * @author Adrian Cole - */ -public class Instance implements Comparable { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Date launchTime; - private Set software = Sets.newLinkedHashSet(); - private IP primaryIP; - private Set secondaryIPs = Sets.newLinkedHashSet(); - private String requestId; - private String keyName; - private String name; - private String instanceType; - private Status status; - private String owner; - private String location; - private String imageId; - private Set productCodes = Sets.newLinkedHashSet(); - private String requestName; - private String id; - private Date expirationTime; - private Vlan vlan; - private int diskSize; - - private boolean rootOnly; - private String antiCollocationInstance; - - public Builder launchTime(Date launchTime) { - this.launchTime = launchTime; - return this; - } - - public Builder software(Iterable software) { - this.software = ImmutableSet. copyOf(checkNotNull(software, "software")); - return this; - } - - public Builder primaryIP(IP primaryIP) { - this.primaryIP = primaryIP; - return this; - } - - public Builder secondaryIPs(Iterable secondaryIPs) { - this.secondaryIPs = ImmutableSet. copyOf(checkNotNull(secondaryIPs, "secondaryIPs")); - return this; - } - - public Builder requestId(String requestId) { - this.requestId = requestId; - return this; - } - - public Builder keyName(String keyName) { - this.keyName = keyName; - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder instanceType(String instanceType) { - this.instanceType = instanceType; - return this; - } - - public Builder status(Status status) { - this.status = status; - return this; - } - - public Builder owner(String owner) { - this.owner = owner; - return this; - } - - public Builder location(String location) { - this.location = location; - return this; - } - - public Builder imageId(String imageId) { - this.imageId = imageId; - return this; - } - - public Builder productCodes(Iterable productCodes) { - this.productCodes = ImmutableSet. copyOf(checkNotNull(productCodes, "productCodes")); - return this; - } - - public Builder requestName(String requestName) { - this.requestName = requestName; - return this; - } - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder expirationTime(Date expirationTime) { - this.expirationTime = expirationTime; - return this; - } - - public Builder vlan(Vlan vlan) { - this.vlan = vlan; - return this; - } - - public Builder diskSize(int diskSize) { - this.diskSize = diskSize; - return this; - } - - public Builder rootOnly(boolean rootOnly) { - this.rootOnly = rootOnly; - return this; - } - - public Builder antiCollocationInstance(String antiCollocationInstance) { - this.antiCollocationInstance = antiCollocationInstance; - return this; - } - - public Instance build() { - return new Instance(launchTime, software, primaryIP, secondaryIPs, requestId, keyName, name, instanceType, - status, owner, location, imageId, productCodes, requestName, id, expirationTime, vlan, diskSize, - rootOnly, antiCollocationInstance); - } - } - - public static enum Status { - NEW, PROVISIONING, FAILED, REMOVED, REJECTED, ACTIVE, UNKNOWN, DEPROVISIONING, RESTARTING, STARTING, STOPPING, STOPPED, DEPROVISION_PENDING, UNRECOGNIZED; - - public static Status fromValue(String v) { - switch (Integer.parseInt(v)) { - case 0: - return NEW; - case 1: - return PROVISIONING; - case 2: - return FAILED; - case 3: - return REMOVED; - case 4: - return REJECTED; - case 5: - return ACTIVE; - case 6: - return UNKNOWN; - case 7: - return DEPROVISIONING; - case 8: - return RESTARTING; - case 9: - return STARTING; - case 10: - return STOPPING; - case 11: - return STOPPED; - case 12: - return DEPROVISION_PENDING; - default: - return UNRECOGNIZED; - } - } - } - - public static class Software { - private String version; - private String type; - private String name; - - public Software(String name, String type, String version) { - this.version = version; - this.type = type; - this.name = name; - } - - public Software() { - - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Software other = (Software) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - if (version == null) { - if (other.version != null) - return false; - } else if (!version.equals(other.version)) - return false; - return true; - } - - public String getVersion() { - return version; - } - - public String getType() { - return type; - } - - public String getName() { - return name; - } - - @Override - public String toString() { - return "[name=" + name + ", type=" + type + ", version=" + version + "]"; - } - } - - private Date launchTime; - private Set software = Sets.newLinkedHashSet(); - private IP primaryIP; - @SerializedName("secondaryIP") - private Set secondaryIPs = Sets.newLinkedHashSet(); - private String requestId; - private String keyName; - private String name; - private String instanceType; - private Status status; - private String owner; - private String location; - private String imageId; - private Set productCodes = Sets.newLinkedHashSet(); - private String requestName; - private String id; - private Date expirationTime; - private Vlan vlan; - private int diskSize; - @SerializedName("root-only") - private boolean rootOnly; - private String antiCollocationInstance; - - Instance() { - } - - public Instance(Date launchTime, Iterable software, IP primaryIP, Iterable secondaryIPs, - String requestId, String keyName, String name, String instanceType, Status status, String owner, - String location, String imageId, Iterable productCodes, String requestName, String id, - Date expirationTime, Vlan vlan, int diskSize, boolean rootOnly, String antiCollocationInstance) { - this.launchTime = launchTime; - this.software = ImmutableSet.copyOf(software); - this.primaryIP = primaryIP; - this.secondaryIPs = ImmutableSet.copyOf(secondaryIPs); - this.requestId = requestId; - this.keyName = keyName; - this.name = name; - this.instanceType = instanceType; - this.status = status; - this.owner = owner; - this.location = location; - this.imageId = imageId; - this.productCodes = ImmutableSet.copyOf(productCodes); - this.requestName = requestName; - this.id = id; - this.expirationTime = expirationTime; - this.vlan = vlan; - this.diskSize = diskSize; - this.rootOnly = rootOnly; - this.antiCollocationInstance = antiCollocationInstance; - } - - public Date getLaunchTime() { - return launchTime; - } - - public Set getSoftware() { - return software; - } - - public IP getPrimaryIP() { - return primaryIP; - } - - public Set getSecondaryIPs() { - return secondaryIPs; - } - - public String getRequestId() { - return requestId; - } - - public String getKeyName() { - return keyName; - } - - public String getName() { - return name; - } - - public String getInstanceType() { - return instanceType; - } - - public Status getStatus() { - return status; - } - - public String getOwner() { - return owner; - } - - public String getLocation() { - return location; - } - - public String getImageId() { - return imageId; - } - - public Set getProductCodes() { - return productCodes; - } - - public String getRequestName() { - return requestName; - } - - public String getId() { - return id; - } - - public Date getExpirationTime() { - return expirationTime; - } - - public Vlan getVlan() { - return vlan; - } - - public int getDiskSize() { - return diskSize; - } - - public boolean isRootOnly() { - return rootOnly; - } - - public String getAntiCollocationInstance() { - return antiCollocationInstance; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Instance other = (Instance) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - return true; - } - - @Override - public String toString() { - return String - .format( - "[id=%s, instanceType=%s, owner=%s, name=%s, location=%s, status=%s, imageId=%s, primaryIP=%s, secondaryIPs=%s, diskSize=%s, keyName=%s, launchTime=%s, rootOnly=%s, vlan=%s, software=%s, expirationTime=%s, antiCollocationInstance=%s, requestId=%s, requestName=%s, productCodes=%s]", - id, instanceType, owner, name, location, status, imageId, primaryIP, secondaryIPs, diskSize, - keyName, launchTime, rootOnly, vlan, software, expirationTime, antiCollocationInstance, - requestId, requestName, productCodes); - } - - @Override - public int compareTo(Instance arg0) { - return id.compareTo(arg0.getId()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java deleted file mode 100644 index 4edd5aee4a..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import com.google.common.collect.ComparisonChain; - -/** - * - * - * @author Adrian Cole - */ -public class InstanceType implements Comparable { - - protected String label; - protected Price price; - protected String id; - - public InstanceType(String label, Price price, String id) { - super(); - this.label = label; - this.price = price; - this.id = id; - } - - InstanceType() { - super(); - } - - public String getLabel() { - return label; - } - - public Price getPrice() { - return price; - } - - public String getId() { - return id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((label == null) ? 0 : label.hashCode()); - result = prime * result + ((price == null) ? 0 : price.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - InstanceType other = (InstanceType) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (label == null) { - if (other.label != null) - return false; - } else if (!label.equals(other.label)) - return false; - if (price == null) { - if (other.price != null) - return false; - } else if (!price.equals(other.price)) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", label=" + label + ", price=" + price + "]"; - } - - @Override - public int compareTo(InstanceType o) { - return ComparisonChain.start().compare(this.getPrice().getRate(), o.getPrice().getRate()).result(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java deleted file mode 100644 index a4a9db9467..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import java.util.Date; -import java.util.Set; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; -import com.google.gson.annotations.SerializedName; - -/** - * - * The current state of a public or private key. - * - * @author Adrian Cole - */ -public class Key implements Comparable { - @SerializedName("default") - private boolean isDefault; - private Set instanceIds = Sets.newLinkedHashSet(); - private String keyMaterial; - @SerializedName("keyName") - private String name; - private Date lastModifiedTime; - - public Key(boolean isDefault, Iterable instanceIds, String keyMaterial, String name, Date lastModifiedTime) { - this.isDefault = isDefault; - Iterables.addAll(this.instanceIds, instanceIds); - this.keyMaterial = keyMaterial; - this.name = name; - this.lastModifiedTime = lastModifiedTime; - } - - public Key() { - - } - - public boolean isDefault() { - return isDefault; - } - - public void setDefault(boolean isDefault) { - this.isDefault = isDefault; - } - - public String getKeyMaterial() { - return keyMaterial; - } - - public void setKeyMaterial(String keyMaterial) { - this.keyMaterial = keyMaterial; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Date getLastModifiedTime() { - return lastModifiedTime; - } - - public void setLastModifiedTime(Date lastModifiedTime) { - this.lastModifiedTime = lastModifiedTime; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((instanceIds == null) ? 0 : instanceIds.hashCode()); - result = prime * result + (isDefault ? 1231 : 1237); - result = prime * result + ((keyMaterial == null) ? 0 : keyMaterial.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((lastModifiedTime == null) ? 0 : lastModifiedTime.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Key other = (Key) obj; - if (instanceIds == null) { - if (other.instanceIds != null) - return false; - } else if (!instanceIds.equals(other.instanceIds)) - return false; - if (isDefault != other.isDefault) - return false; - if (keyMaterial == null) { - if (other.keyMaterial != null) - return false; - } else if (!keyMaterial.equals(other.keyMaterial)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (lastModifiedTime == null) { - if (other.lastModifiedTime != null) - return false; - } else if (!lastModifiedTime.equals(other.lastModifiedTime)) - return false; - return true; - } - - @Override - public String toString() { - return "Key [isDefault=" + isDefault + ", instanceIds=" + instanceIds + ", name=" + name + ", keyMaterial=" - + keyMaterial + ", lastModifiedTime=" + lastModifiedTime + "]"; - } - - public Set getInstanceIds() { - return instanceIds; - } - - public void setInstanceIds(Set instanceIds) { - this.instanceIds = instanceIds; - } - - @Override - public int compareTo(Key arg0) { - return name.compareTo(arg0.name); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java deleted file mode 100644 index dd1ce5289f..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import java.util.Map; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - -/** - * - * The current state of a location (datacenter) - * - * @author Adrian Cole - */ -public class Location { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String name; - private String description; - private String location; - private State state; - private Map> capabilities = Maps.newLinkedHashMap(); - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder description(String description) { - this.description = description; - return this; - } - - public Builder location(String location) { - this.location = location; - return this; - } - - public Builder state(State state) { - this.state = state; - return this; - } - - public Builder capabilities(Map> capabilities) { - this.capabilities = ImmutableMap.copyOf(capabilities); - return this; - } - - public Builder capability(String id) { - return capability(id, ImmutableMap. of()); - } - - public Builder capability(String id, Map entries) { - this.capabilities.put(id, entries); - return this; - } - - public Location build() { - return new Location(id, name, description, location, state, capabilities); - } - } - - public static enum State { - OFFLINE, ONLINE; - @Override - public String toString() { - return this == OFFLINE ? "-1" : "1"; - } - - public static State fromValue(int state) { - return state == -1 ? OFFLINE : ONLINE; - } - - } - - private final String id; - private final String name; - private final String description; - private final String location; - private final State state; - private final Map> capabilities; - - public Location(String id, String name, String description, String location, State state, - Map> capabilities) { - this.id = id; - this.name = name; - this.description = description; - this.location = location; - this.state = state; - this.capabilities = ImmutableMap.copyOf(capabilities); - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public State getState() { - return state; - } - - public String getDescription() { - return description; - } - - public String getLocation() { - return location; - } - - public Map> getCapabilities() { - return capabilities; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Location other = (Location) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", name=" + name + ", description=" + description + ", location=" + location + ", state=" - + state + ", capabilities=" + capabilities + "]"; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java deleted file mode 100644 index 5134cf7922..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -/** - * - * - * @author Adrian Cole - */ -public class Offering implements Comparable { - - protected String location; - protected Price price; - protected String id; - - Offering() { - } - - public String getLocation() { - return location; - } - - public Price getPrice() { - return price; - } - - public String getId() { - return id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((location == null) ? 0 : location.hashCode()); - result = prime * result + ((price == null) ? 0 : price.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Offering other = (Offering) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (location == null) { - if (other.location != null) - return false; - } else if (!location.equals(other.location)) - return false; - if (price == null) { - if (other.price != null) - return false; - } else if (!price.equals(other.price)) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", location=" + location + ", price=" + price + "]"; - } - - @Override - public int compareTo(Offering arg0) { - return id.compareTo(arg0.id); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java deleted file mode 100644 index a942a30bdc..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import java.util.Date; - -/** - * - * - * @author Adrian Cole - */ -public class Price { - - private double rate; - private String unitOfMeasure; - private String countryCode; - private Date effectiveDate; - private String currencyCode; - private double pricePerQuantity; - - Price() { - - } - - public Price(double rate, String unitOfMeasure, String countryCode, Date effectiveDate, String currencyCode, - double pricePerQuantity) { - this.rate = rate; - this.unitOfMeasure = unitOfMeasure; - this.countryCode = countryCode; - this.effectiveDate = effectiveDate; - this.currencyCode = currencyCode; - this.pricePerQuantity = pricePerQuantity; - } - - public double getRate() { - return rate; - } - - public String getUnitOfMeasure() { - return unitOfMeasure; - } - - public String getCountryCode() { - return countryCode; - } - - public Date getEffectiveDate() { - return effectiveDate; - } - - public String getCurrencyCode() { - return currencyCode; - } - - public double getPricePerQuantity() { - return pricePerQuantity; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((countryCode == null) ? 0 : countryCode.hashCode()); - result = prime * result + ((currencyCode == null) ? 0 : currencyCode.hashCode()); - result = prime * result + ((effectiveDate == null) ? 0 : effectiveDate.hashCode()); - long temp; - temp = Double.doubleToLongBits(pricePerQuantity); - result = prime * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(rate); - result = prime * result + (int) (temp ^ (temp >>> 32)); - result = prime * result + ((unitOfMeasure == null) ? 0 : unitOfMeasure.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Price other = (Price) obj; - if (countryCode == null) { - if (other.countryCode != null) - return false; - } else if (!countryCode.equals(other.countryCode)) - return false; - if (currencyCode == null) { - if (other.currencyCode != null) - return false; - } else if (!currencyCode.equals(other.currencyCode)) - return false; - if (effectiveDate == null) { - if (other.effectiveDate != null) - return false; - } else if (!effectiveDate.equals(other.effectiveDate)) - return false; - if (Double.doubleToLongBits(pricePerQuantity) != Double.doubleToLongBits(other.pricePerQuantity)) - return false; - if (Double.doubleToLongBits(rate) != Double.doubleToLongBits(other.rate)) - return false; - if (unitOfMeasure == null) { - if (other.unitOfMeasure != null) - return false; - } else if (!unitOfMeasure.equals(other.unitOfMeasure)) - return false; - return true; - } - - @Override - public String toString() { - return "[countryCode=" + countryCode + ", currencyCode=" + currencyCode + ", effectiveDate=" + effectiveDate - + ", pricePerQuantity=" + pricePerQuantity + ", rate=" + rate + ", unitOfMeasure=" + unitOfMeasure + "]"; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java deleted file mode 100644 index 6f7144236c..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import java.util.Set; - -import com.google.common.collect.Sets; - -/** - * - * An Offering for Storage - * - * @author Adrian Cole - */ -public class StorageOffering extends Offering { - public static class Format { - private String label; - private String id; - - Format() { - - } - - public Format(String label, String id) { - this.label = label; - this.id = id; - } - - public String getLabel() { - return label; - } - - public String getId() { - return id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((label == null) ? 0 : label.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Format other = (Format) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (label == null) { - if (other.label != null) - return false; - } else if (!label.equals(other.label)) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", label=" + label + "]"; - } - } - - private long capacity; - private String name; - private Set formats = Sets.newLinkedHashSet(); - - StorageOffering() { - - } - - public StorageOffering(String location, Price price, long capacity, String name, String id, Set formats) { - this.location = location; - this.price = price; - this.capacity = capacity; - this.name = name; - this.id = id; - this.formats = formats; - } - - public long getCapacity() { - return capacity; - } - - public String getName() { - return name; - } - - public Set getFormats() { - return formats; - } - - @Override - public String toString() { - return "[capacity=" + capacity + ", formats=" + formats + ", id=" + id + ", location=" + location + ", name=" - + name + ", price=" + price + "]"; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java deleted file mode 100644 index 19c36cc5b9..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - - -/** - * - * - * @author Adrian Cole - */ -public class Vlan { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String id; - private String name; - private String location; - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder location(String location) { - this.location = location; - return this; - } - - public Vlan build() { - return new Vlan(location, name, id); - } - } - - private String location; - private String name; - private String id; - - Vlan() { - - } - - public Vlan(String location, String name, String id) { - this.location = location; - this.name = name; - this.id = id; - } - - public String getLocation() { - return location; - } - - public String getName() { - return name; - } - - public String getId() { - return id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((location == null) ? 0 : location.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Vlan other = (Vlan) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (location == null) { - if (other.location != null) - return false; - } else if (!location.equals(other.location)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", location=" + location + ", name=" + name + "]"; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java deleted file mode 100644 index b277f3ce8c..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.domain; - -import java.util.Date; -import java.util.Set; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; - -/** - * - * The current state of a Volume - * - * @author Adrian Cole - */ -public class Volume implements Comparable { - - public static enum State { - NEW, CREATING, DELETING, DELETED, UNMOUNTED, MOUNTED, FAILED; - public static State fromValue(int v) { - switch (v) { - case 0: - return NEW; - case 1: - return CREATING; - case 2: - return DELETING; - case 3: - return DELETED; - case 4: - return UNMOUNTED; - case 5: - return MOUNTED; - case 6: - return FAILED; - default: - throw new IllegalArgumentException("invalid state:" + v); - } - } - } - - private String instanceId; - private int state; - private int size; - private String owner; - private Date createdTime; - private String location; - private Set productCodes = Sets.newLinkedHashSet(); - private String format; - private String name; - private String id; - - public Volume(String instanceId, int state, int size, String owner, Date createdTime, - String location, Iterable productCodes, String format, String name, String id) { - this.instanceId = instanceId; - this.state = state; - this.size = size; - this.owner = owner; - this.createdTime = createdTime; - this.location = location; - Iterables.addAll(this.productCodes, productCodes); - this.format = format; - this.name = name; - this.id = id; - } - - public Volume() { - - } - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public State getState() { - return State.fromValue(state); - } - - public void setState(int state) { - this.state = state; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public Date getCreatedTime() { - return createdTime; - } - - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public Set getProductCodes() { - return productCodes; - } - - public void setProductCodes(Set productCodes) { - this.productCodes = productCodes; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((createdTime == null) ? 0 : createdTime.hashCode()); - result = prime * result + ((format == null) ? 0 : format.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode()); - result = prime * result + ((location == null) ? 0 : location.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((owner == null) ? 0 : owner.hashCode()); - result = prime * result + ((productCodes == null) ? 0 : productCodes.hashCode()); - result = prime * result + size; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Volume other = (Volume) obj; - if (createdTime == null) { - if (other.createdTime != null) - return false; - } else if (!createdTime.equals(other.createdTime)) - return false; - if (format == null) { - if (other.format != null) - return false; - } else if (!format.equals(other.format)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (instanceId == null) { - if (other.instanceId != null) - return false; - } else if (!instanceId.equals(other.instanceId)) - return false; - if (location == null) { - if (other.location != null) - return false; - } else if (!location.equals(other.location)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (owner == null) { - if (other.owner != null) - return false; - } else if (!owner.equals(other.owner)) - return false; - if (productCodes == null) { - if (other.productCodes != null) - return false; - } else if (!productCodes.equals(other.productCodes)) - return false; - if (size != other.size) - return false; - return true; - } - - @Override - public String toString() { - return "[id=" + id + ", name=" + name + ", size=" + size + ", state=" + getState() - + ", instanceId=" + instanceId + ", location=" + location + ", format=" + format - + ", owner=" + owner + ", createdTime=" + createdTime + ", productCodes=" - + productCodes + "]"; - } - - @Override - public int compareTo(Volume arg0) { - return id.compareTo(arg0.getId()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java deleted file mode 100644 index 6119db7623..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.functions; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Date; - -import com.google.common.base.Function; - -/** - * - * @author Adrian Cole - * - */ -public class ParseLongFromDate implements Function { - - @Override - public String apply(Object from) { - checkArgument(from instanceof Date, "this binder is only valid for Date!"); - return Date.class.cast(from).getTime()+""; - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java deleted file mode 100644 index b95416f6db..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.handlers; - -import static org.jclouds.http.HttpUtils.releasePayload; - -import java.io.IOException; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpResponseException; -import org.jclouds.logging.Logger; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; -import org.jclouds.util.Strings2; - -/** - * This will parse and set an appropriate exception on the command object. - * - * @author Adrian Cole - * - */ -@Singleton -public class IBMSmartCloudErrorHandler implements HttpErrorHandler { - @Resource - protected Logger logger = Logger.NULL; - - public void handleError(HttpCommand command, HttpResponse response) { - Exception exception = new HttpResponseException(command, response); - try { - // it is important to always read fully and close streams - String message = parseMessage(response); - exception = message != null ? new HttpResponseException(command, response, message) : exception; - message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), - response.getStatusLine()); - switch (response.getStatusCode()) { - case 401: - exception = new AuthorizationException(exception.getMessage(), exception); - break; - case 402: - case 403: - exception = new AuthorizationException(message, exception); - break; - case 404: - if (!command.getCurrentRequest().getMethod().equals("DELETE")) { - exception = new ResourceNotFoundException(message, exception); - } - break; - case 406: - case 409: - case 412: - exception = new IllegalStateException(message, exception); - break; - case 500: - if (message != null && message.indexOf("There is already a BlockStorageDevice object with name") != 1) - exception = new IllegalStateException(message, exception); - break; - } - } catch (IOException e) { - } finally { - releasePayload(response); - command.setException(exception); - } - } - - public String parseMessage(HttpResponse response) throws IOException { - if (response.getPayload() == null) - return null; - return Strings2.toString(response.getPayload()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/CreateInstanceOptions.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/CreateInstanceOptions.java deleted file mode 100644 index 7f855c89ae..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/CreateInstanceOptions.java +++ /dev/null @@ -1,207 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; -import java.util.Map.Entry; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -import com.google.common.collect.ImmutableSet; - -/** - * - * - * @author Adrian Cole - * - */ -public class CreateInstanceOptions extends BaseHttpRequestOptions { - - public CreateInstanceOptions() { - super(); - formParameters.put("publicKey", "DEFAULT"); - } - - /** - * - * @param id - * The ID of a storage volume to associate with this instance - * @param mountPoint - * The mount point in which to mount the attached storage volume - */ - public CreateInstanceOptions mountVolume(String id, String mountPoint) { - checkNotNull(id, "volume id"); - checkNotNull(mountPoint, "mountPoint"); - formParameters.replaceValues("volumeID", ImmutableSet.of(id)); - String mountParam = String.format("oss.storage.id.0.mnt", id); - formParameters.replaceValues(mountParam, ImmutableSet.of(mountPoint)); - return this; - } - - /** - * - * @param publicKeyName - * The public key to use for accessing the created instance - */ - public CreateInstanceOptions authorizePublicKey(String publicKeyName) { - checkNotNull(publicKeyName, "publicKeyName"); - formParameters.replaceValues("publicKey", ImmutableSet.of(publicKeyName)); - return this; - } - - /** - * - * @param configurationData - * extra configuration to pass to the instance - */ - public CreateInstanceOptions configurationData(Map configurationData) { - checkNotNull(configurationData, "configurationData"); - for (Entry entry : configurationData.entrySet()) { - formParameters.replaceValues(entry.getKey(), ImmutableSet.of(entry.getValue())); - } - return this; - } - - /** - * - * @param ip - * The ID of a static IP address to associate with this instance - */ - public CreateInstanceOptions staticIP(String ip) { - checkNotNull(ip, "ip"); - formParameters.replaceValues("ip", ImmutableSet.of(ip)); - return this; - } - - /** - * - * @param id - * The ID of a Vlan offering to associate with this instance. - */ - public CreateInstanceOptions vlanID(String id) { - checkNotNull(id, "id"); - formParameters.replaceValues("vlanID", ImmutableSet.of(id)); - return this; - } - - /** - * - * @param ip - * The ID of a static IP address to associate with this instance as secondary IP. - */ - public CreateInstanceOptions secondaryIP(String ip) { - checkNotNull(ip, "ip"); - formParameters.replaceValues("secondaryIP", ImmutableSet.of(ip)); - return this; - } - - /** - * - * @param id - * The ID of an existing anti-collocated instance. - */ - public CreateInstanceOptions antiCollocationInstance(String id) { - checkNotNull(id, "id"); - formParameters.replaceValues("antiCollocationInstance", ImmutableSet.of(id)); - return this; - } - - /** - * Whether or not the instance should be provisioned with the root segment only. Compared to - * standard server size, this option will provide less storage but same memory and CPU, and thus - * provision the instance faster. - * - * @param isMiniEphemeral - * true if root only provision, False: normal provision - */ - public CreateInstanceOptions isMiniEphemeral(boolean isMiniEphemeral) { - formParameters.replaceValues("isMiniEphemeral", ImmutableSet.of(isMiniEphemeral + "")); - return this; - } - - public static class Builder { - - /** - * @see CreateInstanceOptions#configurationData - */ - public static CreateInstanceOptions configurationData(Map configurationData) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.configurationData(configurationData); - } - - /** - * @see CreateInstanceOptions#mountVolume - */ - public static CreateInstanceOptions mountVolume(String id, String mountPoint) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.mountVolume(id, mountPoint); - } - - /** - * @see CreateInstanceOptions#staticIP - */ - public static CreateInstanceOptions staticIP(String ip) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.staticIP(ip); - } - - /** - * @see CreateInstanceOptions#secondaryIP - */ - public static CreateInstanceOptions secondaryIP(String ip) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.secondaryIP(ip); - } - - /** - * @see CreateInstanceOptions#vlanID - */ - public static CreateInstanceOptions vlanID(String id) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.vlanID(id); - } - - /** - * @see CreateInstanceOptions#antiCollocationInstance - */ - public static CreateInstanceOptions antiCollocationInstance(String id) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.antiCollocationInstance(id); - } - - /** - * @see CreateInstanceOptions#isMiniEphemeral - */ - public static CreateInstanceOptions isMiniEphemeral(boolean isMiniEphemeral) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.isMiniEphemeral(isMiniEphemeral); - } - - /** - * @see CreateInstanceOptions#authorizePublicKey - */ - public static CreateInstanceOptions authorizePublicKey(String publicKeyName) { - CreateInstanceOptions options = new CreateInstanceOptions(); - return options.authorizePublicKey(publicKeyName); - } - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/RestartInstanceOptions.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/RestartInstanceOptions.java deleted file mode 100644 index 63c93bdc6d..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/options/RestartInstanceOptions.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * - * - * @author Adrian Cole - * - */ -public class RestartInstanceOptions extends BaseHttpRequestOptions { - - /** - * - * @param keyName - * The name of the SSH Public Key to add to the instance during restart. - */ - public RestartInstanceOptions authorizePublicKey(String keyName) { - checkNotNull(keyName, "keyName"); - formParameters.removeAll("keyName"); - formParameters.put("keyName", keyName); - return this; - } - - public static class Builder { - - /** - * @see RestartInstanceOptions#authorizePublicKey(String ) - */ - public static RestartInstanceOptions authorizePublicKey(String keyName) { - RestartInstanceOptions options = new RestartInstanceOptions(); - return options.authorizePublicKey(keyName); - } - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/AddressFree.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/AddressFree.java deleted file mode 100644 index 97c32d45b7..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/AddressFree.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.predicates; - -import java.util.NoSuchElementException; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.logging.Logger; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.inject.Inject; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class AddressFree implements Predicate
{ - - private final IBMSmartCloudClient client; - - @Resource - protected Logger logger = Logger.NULL; - - @Inject - public AddressFree(IBMSmartCloudClient client) { - this.client = client; - } - - public boolean apply(Address address) { - logger.trace("looking for state on address %s", address); - final String id = address.getId(); - try { - address = Iterables.find(client.listAddresses(), new Predicate
() { - - @Override - public boolean apply(Address input) { - return input.getId().equals(id); - } - }); - } catch (NoSuchElementException e) { - return false; - } - logger.trace("%s: looking for address state %s: currently: %s", address.getId(), - Address.State.FREE, address.getState()); - return address.getState() == Address.State.FREE; - - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActive.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActive.java deleted file mode 100644 index 9feac00eea..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActive.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.predicates; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.logging.Logger; - -import com.google.common.base.Predicate; -import com.google.inject.Inject; - -/** - * Tests to see if a task succeeds. - * - * @author Adrian Cole - */ -@Singleton -public class InstanceActive implements Predicate { - - private final IBMSmartCloudClient client; - - @Resource - protected Logger logger = Logger.NULL; - - @Inject - public InstanceActive(IBMSmartCloudClient client) { - this.client = client; - } - - public boolean apply(Instance instance) { - logger.trace("looking for state on instance %s", instance); - instance = client.getInstance(instance.getId()); - if (instance == null) - return false; - logger.trace("%s: looking for instance state %s: currently: %s", instance - .getId(), Instance.Status.ACTIVE, instance.getStatus()); - if (instance.getStatus() == Instance.Status.FAILED) - throw new IllegalStateException("node " + instance.getId() - + " in location " + instance.getLocation() - + " is in a failed state"); - return instance.getStatus() == Instance.Status.ACTIVE; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActiveOrFailed.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActiveOrFailed.java deleted file mode 100644 index 47178b275d..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceActiveOrFailed.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.predicates; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.logging.Logger; - -import com.google.common.base.Predicate; -import com.google.inject.Inject; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class InstanceActiveOrFailed implements Predicate { - - private final IBMSmartCloudClient client; - - @Resource - protected Logger logger = Logger.NULL; - - @Inject - public InstanceActiveOrFailed(IBMSmartCloudClient client) { - this.client = client; - } - - public boolean apply(Instance instance) { - logger.trace("looking for state on instance %s", instance); - instance = client.getInstance(instance.getId()); - if (instance == null) - return false; - logger.trace("%s: looking for instance state %s: currently: %s", instance.getId(), String.format("%s or %s", - Instance.Status.ACTIVE, Instance.Status.FAILED), instance.getStatus()); - return instance.getStatus() == Instance.Status.ACTIVE || instance.getStatus() == Instance.Status.FAILED; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceRemovedOrNotFound.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceRemovedOrNotFound.java deleted file mode 100644 index 2e4e46f7aa..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/InstanceRemovedOrNotFound.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.predicates; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.logging.Logger; - -import com.google.common.base.Predicate; -import com.google.inject.Inject; - -/** - * - * - * @author Adrian Cole - */ -@Singleton -public class InstanceRemovedOrNotFound implements Predicate { - - private final IBMSmartCloudClient client; - - @Resource - protected Logger logger = Logger.NULL; - - @Inject - public InstanceRemovedOrNotFound(IBMSmartCloudClient client) { - this.client = client; - } - - public boolean apply(Instance instance) { - logger.trace("looking for state on instance %s", instance); - instance = client.getInstance(instance.getId()); - if (instance == null) - return true; - logger.trace("%s: looking for instance state %s: currently: %s", instance.getId(), Instance.Status.REMOVED, - instance.getStatus()); - return instance.getStatus() == Instance.Status.REMOVED; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/VolumeUnmounted.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/VolumeUnmounted.java deleted file mode 100644 index 68ea2641d1..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/predicates/VolumeUnmounted.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.predicates; - -import javax.annotation.Resource; -import javax.inject.Singleton; - -import org.jclouds.ibm.smartcloud.IBMSmartCloudClient; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.jclouds.logging.Logger; - -import com.google.common.base.Predicate; -import com.google.inject.Inject; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class VolumeUnmounted implements Predicate { - - private final IBMSmartCloudClient client; - - @Resource - protected Logger logger = Logger.NULL; - - @Inject - public VolumeUnmounted(IBMSmartCloudClient client) { - this.client = client; - } - - public boolean apply(Volume volume) { - logger.trace("looking for state on volume %s", volume); - volume = client.getVolume(volume.getId()); - if (volume == null) - return false; - logger.trace("%s: looking for volume state %s: currently: %s", volume.getId(), - Volume.State.UNMOUNTED, volume.getState()); - return volume.getState() == Volume.State.UNMOUNTED; - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/reference/Capabilities.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/reference/Capabilities.java deleted file mode 100644 index e805ac433b..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/reference/Capabilities.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.reference; - -/** - * Configuration properties and constants used in IBMSmartCloud connections. - * - * @author Adrian Cole - */ -public interface Capabilities { - public static final String CAPABILITY_CAPACITY = "oss.storage.capacity"; - public static final String CAPABILITY_FORMAT = "oss.storage.format"; - public static final String CAPABILITY_I386 = "oss.instance.spec.i386"; - public static final String CAPABILITY_x86_64 = "oss.instance.spec.x86_64"; - public static final String CAPABILITY_AVAILABILITYAREA = "oss.storage.availabilityarea"; - -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationHandler.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationHandler.java deleted file mode 100644 index 38c4860825..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationHandler.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.xml; - -import java.util.Map; - -import org.jclouds.http.functions.ParseSax; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.domain.Location.State; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.collect.Maps; - -/** - * @author Adrian Cole - */ -public class LocationHandler extends ParseSax.HandlerWithResult { - private StringBuilder currentText = new StringBuilder(); - - private String id; - private String name; - private String description; - private String location; - private Map> capabilities = Maps.newLinkedHashMap(); - private String capabilityName; - private String capabilityKey; - - private Location loc; - - private State state; - - public Location getResult() { - return loc; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - if (qName.equalsIgnoreCase("Capability")) { - capabilityName = attributes.getValue(attributes.getIndex("id")); - capabilities.put(capabilityName, Maps. newLinkedHashMap()); - } else if (qName.equalsIgnoreCase("Entry")) { - capabilityKey = attributes.getValue(attributes.getIndex("key")); - } - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - if (qName.equalsIgnoreCase("ID")) { - id = currentText.toString().trim(); - } else if (qName.equalsIgnoreCase("Name")) { - name = currentText.toString().trim(); - } else if (qName.equalsIgnoreCase("Description")) { - description = currentText.toString().trim(); - if (description.equals("")) - description = null; - } else if (qName.equalsIgnoreCase("State")) { - state = State.fromValue(Integer.parseInt(currentText.toString().trim())); - } else if (qName.equalsIgnoreCase("Value")) { - capabilities.get(capabilityName).put(capabilityKey, currentText.toString().trim()); - } else if (qName.equalsIgnoreCase("Location")) { - if (currentText.toString().trim().equals("")) { - this.loc = new Location(id, name, description, location, state, capabilities); - id = null; - name = null; - description = null; - location = null; - state = null; - capabilities = Maps.newLinkedHashMap(); - capabilityKey = null; - capabilityName = null; - } else { - location = currentText.toString().trim(); - } - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationsHandler.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationsHandler.java deleted file mode 100644 index 360831e393..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/xml/LocationsHandler.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.xml; - -import java.util.Set; - -import javax.inject.Inject; - -import org.jclouds.http.functions.ParseSax; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import com.google.common.collect.Sets; - -/** - * @author Adrian Cole - */ -public class LocationsHandler extends ParseSax.HandlerWithResult> { - private StringBuilder currentText = new StringBuilder(); - - private Set locations = Sets.newLinkedHashSet(); - private final LocationHandler locationHandler; - - @Inject - public LocationsHandler(LocationHandler locationHandler) { - this.locationHandler = locationHandler; - } - - public Set getResult() { - return locations; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) - throws SAXException { - locationHandler.startElement(uri, localName, qName, attributes); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - locationHandler.endElement(uri, localName, qName); - if (qName.equals("Location") && currentText.toString().trim().equals("")) { - this.locations.add(locationHandler.getResult()); - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - locationHandler.characters(ch, start, length); - currentText.append(ch, start, length); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/BaseIBMSmartCloudClientLiveTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/BaseIBMSmartCloudClientLiveTest.java deleted file mode 100644 index b755e6973b..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/BaseIBMSmartCloudClientLiveTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Map; -import java.util.Properties; - -import org.jclouds.Constants; -import org.jclouds.compute.ComputeTestUtils; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.sshj.config.SshjSshClientModule; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "BaseIBMSmartCloudClientLiveTest") -public abstract class BaseIBMSmartCloudClientLiveTest { - - protected RestContext context; - protected String provider = "ibm-smartcloud"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; - - protected IBMSmartCloudClient connection; - - protected Map keyPair; - - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider - + ".identity must be set. ex. apiKey"); - credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider - + ".credential must be set. ex. secretKey"); - endpoint = System.getProperty("test." + provider + ".endpoint"); - apiVersion = System.getProperty("test." + provider + ".api-version"); - } - - protected Properties setupProperties() { - Properties overrides = new Properties(); - overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); - overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); - overrides.setProperty(provider + ".identity", identity); - overrides.setProperty(provider + ".credential", credential); - if (endpoint != null) - overrides.setProperty(provider + ".endpoint", endpoint); - if (apiVersion != null) - overrides.setProperty(provider + ".api-version", apiVersion); - return overrides; - } - - @BeforeGroups(groups = "live") - public void setupClient() throws FileNotFoundException, IOException { - setupCredentials(); - Properties overrides = setupProperties(); - context = new RestContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule(), - new SshjSshClientModule()), overrides); - - connection = context.getApi(); - keyPair = ComputeTestUtils.setupKeyPair(); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClientTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClientTest.java deleted file mode 100644 index eae7c1feb7..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudAsyncClientTest.java +++ /dev/null @@ -1,658 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Date; -import java.util.Properties; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.http.functions.ParseSax; -import org.jclouds.http.functions.ReleasePayloadAndReturn; -import org.jclouds.http.functions.UnwrapOnlyJsonValue; -import org.jclouds.http.functions.UnwrapOnlyJsonValueInSet; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.options.CreateInstanceOptions; -import org.jclouds.ibm.smartcloud.options.RestartInstanceOptions; -import org.jclouds.ibm.smartcloud.xml.LocationHandler; -import org.jclouds.ibm.smartcloud.xml.LocationsHandler; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; -import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; -import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; -import com.google.inject.TypeLiteral; - -/** - * Tests annotation parsing of {@code IBMSmartCloudAsyncClient} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "IBMSmartCloudAsyncClientTest") -public class IBMSmartCloudAsyncClientTest extends RestClientTest { - - public void testListImages() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listImages"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/image HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - // now make sure request filters apply by replaying - httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); - httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/image HTTP/1.1"); - // for example, using basic authentication, we should get "only one" - // header - assertNonPayloadHeadersEqual(httpRequest, - "Accept: application/json\nAuthorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testGetImage() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("getImage", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/image/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testDeleteImage() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("deleteImage", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "DELETE https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/image/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testSetImageVisibility() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("setImageVisibility", String.class, - Image.Visibility.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1", Image.Visibility.PUBLIC); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/image/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "visibility=PUBLIC", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListInstances() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listInstances"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListInstancesFromRequest() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listInstancesFromRequest", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/requests/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testGetInstance() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("getInstance", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testExtendReservationForInstance() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class - .getMethod("extendReservationForInstance", String.class, Date.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1", new Date(123215235l)); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "expirationTime=123215235", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - } - - public void testRestartInstance() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("restartInstance", String.class, - RestartInstanceOptions[].class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, "state=restart", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - } - - public void testRestartInstanceNewKey() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("restartInstance", String.class, - RestartInstanceOptions[].class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1", new RestartInstanceOptions() - .authorizePublicKey("keyName")); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, "state=restart&keyName=keyName", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - } - - public void testSaveInstanceToImage() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("saveInstanceToImage", String.class, String.class, - String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1", "imageName", "imageDescription"); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "state=save&description=imageDescription&name=imageName", - "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - } - - public void testDeleteInstance() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("deleteInstance", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "DELETE https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListKeys() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listKeys"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testGetKey() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("getKey", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testGenerateKeyPair() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("generateKeyPair", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "key"); - - assertRequestLineEquals(httpRequest, - "POST https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "name=key", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testAddPublicKey() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("addPublicKey", String.class, String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "key", "publicbits"); - - assertRequestLineEquals(httpRequest, - "POST https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, "name=key&publicKey=publicbits", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testUpdatePublicKey() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("updatePublicKey", String.class, String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "key", "publicbits"); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys/key HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, "publicKey=publicbits", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testSetDefaultStatusOfKey() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("setDefaultStatusOfKey", String.class, boolean.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "key", true); - - assertRequestLineEquals(httpRequest, - "PUT https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys/key HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, "default=true", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testDeleteKey() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("deleteKey", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "DELETE https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/keys/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListVolumes() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listVolumes"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/storage HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testGetVolume() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("getVolume", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/storage/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testCreateVolumeInLocation() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("createVolumeInLocation", String.class, String.class, - String.class, String.class, String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "location", "name", "format", "size", "offering"); - - assertRequestLineEquals(httpRequest, - "POST https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/storage HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "location=location&format=format&name=name&size=size&offeringID=offering", - "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testCreateInstanceInLocation() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("createInstanceInLocation", String.class, String.class, - String.class, String.class, CreateInstanceOptions[].class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1", "name", "22", "instanceType"); - - assertRequestLineEquals(httpRequest, - "POST https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "location=1&imageID=22&name=name&instanceType=instanceType", - "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValueInSet.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testCreateInstanceInLocationWithOptions() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("createInstanceInLocation", String.class, String.class, - String.class, String.class, CreateInstanceOptions[].class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "location", "name", "22", "instanceType", - new CreateInstanceOptions().staticIP("1").authorizePublicKey("MOO").mountVolume("2", "/mnt") - .configurationData( - ImmutableMap.of("insight_admin_password", "myPassword1", "db2_admin_password", - "myPassword2", "report_user_password", "myPassword3"))); - - assertRequestLineEquals(httpRequest, - "POST https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/instances HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals( - httpRequest, - "location=location&imageID=22&name=name&instanceType=instanceType&ip=1&publicKey=MOO&volumeID=2&oss.storage.id.0.mnt=%2Fmnt&insight_admin_password=myPassword1&db2_admin_password=myPassword2&report_user_password=myPassword3", - "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValueInSet.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("deleteVolume", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "DELETE https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/storage/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListLocations() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listLocations"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/locations HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: text/xml\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseSax.class); - assertSaxResponseParserClassEquals(method, LocationsHandler.class); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testGetLocation() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("getLocation", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/locations/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: text/xml\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseSax.class); - assertSaxResponseParserClassEquals(method, LocationHandler.class); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListAddresses() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listAddresses"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/addresses HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testAllocateAddressInLocation() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("allocateAddressInLocation", String.class, String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1", "offering"); - - assertRequestLineEquals(httpRequest, - "POST https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/addresses HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, "location=1&offeringID=offering", "application/x-www-form-urlencoded", false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - public void testReleaseAddress() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("releaseAddress", String.class); - GeneratedHttpRequest httpRequest = processor.createRequest(method, "1"); - - assertRequestLineEquals(httpRequest, - "DELETE https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/addresses/1 HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, ""); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(httpRequest); - - } - - public void testListStorageOfferings() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listStorageOfferings"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/storage HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - } - - public void testListAddressOfferings() throws SecurityException, NoSuchMethodException, IOException { - Method method = IBMSmartCloudAsyncClient.class.getMethod("listAddressOfferings"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, - "GET https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331/offerings/address HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(httpRequest); - } - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), BasicAuthentication.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec("ibm-smartcloud", "identity", "credential", new Properties()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClientLiveTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClientLiveTest.java deleted file mode 100644 index ef7c4ec59d..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/IBMSmartCloudClientLiveTest.java +++ /dev/null @@ -1,515 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import static com.google.common.collect.Iterables.filter; -import static org.jclouds.ibm.smartcloud.options.CreateInstanceOptions.Builder.authorizePublicKey; -import static org.jclouds.ibm.smartcloud.options.CreateInstanceOptions.Builder.secondaryIP; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; - -import java.io.IOException; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import org.jclouds.compute.domain.ExecResponse; -import org.jclouds.domain.Credentials; -import org.jclouds.http.HttpResponseException; -import org.jclouds.http.handlers.BackoffLimitedRetryHandler; -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Instance.Software; -import org.jclouds.ibm.smartcloud.domain.InstanceType; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.domain.Offering; -import org.jclouds.ibm.smartcloud.domain.StorageOffering; -import org.jclouds.ibm.smartcloud.domain.StorageOffering.Format; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.jclouds.ibm.smartcloud.predicates.AddressFree; -import org.jclouds.ibm.smartcloud.predicates.InstanceActive; -import org.jclouds.ibm.smartcloud.predicates.InstanceActiveOrFailed; -import org.jclouds.ibm.smartcloud.predicates.InstanceRemovedOrNotFound; -import org.jclouds.ibm.smartcloud.predicates.VolumeUnmounted; -import org.jclouds.net.IPSocket; -import org.jclouds.predicates.InetSocketAddressConnect; -import org.jclouds.predicates.RetryablePredicate; -import org.jclouds.ssh.SshClient; -import org.jclouds.ssh.SshException; -import org.jclouds.sshj.SshjSshClient; -import org.testng.annotations.AfterTest; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Ordering; -import com.google.common.collect.Sets; - -/** - * Tests behavior of {@code IBMSmartCloudClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "IBMSmartCloudClientLiveTest") -public class IBMSmartCloudClientLiveTest extends BaseIBMSmartCloudClientLiveTest { - private static final String OS = "SUSE Linux Enterprise Server"; - private static final String VERSION = "11 SP1"; - - private static final String PLATFORM = OS + "/" + VERSION; - - private static final ImmutableSet SOFTWARE = ImmutableSet. of(new Software(OS, "OS", VERSION)); - - private static String FORMAT = "EXT3"; - - private Location location; - private Address ip; - private Key key; - private Volume volume; - - private Instance instance2; - private Instance instance; - private InstanceType instanceType; - private Image image; - - private StorageOffering cheapestStorage; - - private static final String GROUP = System.getProperty("user.name"); - - @Test - public void testGetLocation() throws Exception { - Set response = connection.listLocations(); - assertNotNull(response); - if (response.size() > 0) { - location = Iterables.find(response, new Predicate() { - - @Override - public boolean apply(Location arg0) { - // ontario is the least used - return "101".equals(arg0.getId()); - } - - }); - assertEquals(connection.getLocation(location.getId()).getId(), location.getId()); - } - } - - @Test(dependsOnMethods = "testGetLocation") - public void testAddPublicKey() throws Exception { - try { - connection.addPublicKey(GROUP, keyPair.get("public")); - key = connection.getKey(GROUP); - try { - assert key.getInstanceIds().equals(ImmutableSet. of()) : key; - } catch (AssertionError e) { - // inconsistency in the key api when recreating a key - // http://www-180.ibm.com/cloud/enterprise/beta/ram/community/discussionTopic.faces?guid={DA689AEE-783C-6FE7-6F9F-DFEE9763F806}&v=1&fid=1068&tid=1528 - } - } catch (IllegalStateException e) { - // must have been found - connection.updatePublicKey(GROUP, keyPair.get("public")); - key = connection.getKey(GROUP); - for (String instanceId : key.getInstanceIds()) { - Instance instance = connection.getInstance(instanceId); - if (instance.getStatus() == Instance.Status.FAILED || instance.getStatus() == Instance.Status.ACTIVE) { - killInstance(instance.getId()); - } - } - } - assertEquals(key.getName(), GROUP); - assert keyPair.get("public").indexOf(key.getKeyMaterial()) > 0; - assertNotNull(key.getLastModifiedTime()); - } - - @Test(dependsOnMethods = "resolveImageAndInstanceType") - public void testAllocateIpAddress() throws Exception { - - Offering offering = Iterables.find(connection.listAddressOfferings(), new Predicate() { - - @Override - public boolean apply(Offering arg0) { - return arg0.getLocation().equals(location.getId()); - } - }); - - try { - ip = connection.allocateAddressInLocation(location.getId(), offering.getId()); - System.out.println(ip); - assertEquals(ip.getIP(), null); - // wait up to 30 seconds for this to become "free" - new RetryablePredicate
(new AddressFree(connection), 30, 2, TimeUnit.SECONDS).apply(ip); - refreshIpAndReturnAllAddresses(); - assertEquals(ip.getInstanceId(), null); - } catch (IllegalStateException e) { - if (HttpResponseException.class.cast(e.getCause()).getResponse().getStatusCode() == 409) { - ip = Iterables.find(connection.listAddresses(), new Predicate
() { - - @Override - public boolean apply(Address input) { - return input.getState() == Address.State.FREE; - } - - }); - } else { - throw e; - } - } - assertEquals(ip.getInstanceId(), null); - assertEquals(ip.getLocation(), location.getId()); - - Set allAddresses = refreshIpAndReturnAllAddresses(); - - assert (allAddresses.contains(ip)) : String.format("ip %s not in %s", ip, allAddresses); - } - - @Test(dependsOnMethods = "testGetLocation") - public void testResolveVolumeOffering() throws Exception { - - Ordering cheapestOrdering = new Ordering() { - public int compare(StorageOffering left, StorageOffering right) { - return ComparisonChain.start().compare(left.getPrice().getRate(), right.getPrice().getRate()).result(); - } - }.reverse(); - - Iterable storageOfferingsThatAreInOurLocationAndCorrectFormat = filter(connection - .listStorageOfferings(), new Predicate() { - @Override - public boolean apply(StorageOffering arg0) { - - return arg0.getLocation().equals(location.getId()) - && Iterables.any(arg0.getFormats(), new Predicate() { - - @Override - public boolean apply(Format arg0) { - return arg0.getId().equals(FORMAT); - } - - }); - } - }); - cheapestStorage = cheapestOrdering.max(storageOfferingsThatAreInOurLocationAndCorrectFormat); - System.out.println(cheapestStorage); - } - - @Test(dependsOnMethods = "testResolveVolumeOffering") - public void testCreateVolume() throws Exception { - try { - volume = connection.createVolumeInLocation(location.getId(), GROUP, FORMAT, cheapestStorage.getName(), - cheapestStorage.getId()); - // wait up to 5 minutes for this to become "unmounted" - assert new RetryablePredicate(new VolumeUnmounted(connection), 300, 5, TimeUnit.SECONDS).apply(volume); - } catch (IllegalStateException e) { - int code = HttpResponseException.class.cast(e.getCause()).getResponse().getStatusCode(); - if (code == 409 || code == 500) { - Set volumes = connection.listVolumes(); - try { - volume = Iterables.find(volumes, new Predicate() { - - @Override - public boolean apply(Volume input) { - return input.getState() == Volume.State.UNMOUNTED; - } - - }); - } catch (NoSuchElementException ex) { - killInstance(GROUP + 1); - } - } else { - throw e; - } - } - assertEquals(volume.getInstanceId(), null); - assertEquals(volume.getLocation(), location.getId()); - - final String id = volume.getId(); - Set allVolumes = connection.listVolumes(); - - // refresh volume as it may have been just created - volume = Iterables.find(allVolumes, new Predicate() { - - @Override - public boolean apply(Volume input) { - return input.getId().equals(id); - } - - }); - - assert (allVolumes.contains(volume)) : String.format("volume %s not in %s", volume, volume); - } - - @Test(dependsOnMethods = "testGetLocation") - public void resolveImageAndInstanceType() throws Exception { - Iterable imagesThatAreInOurLocationAndNotBYOL = filter(connection.listImages(), - new Predicate() { - @Override - public boolean apply(Image arg0) { - return arg0.getLocation().equals(location.getId()) && arg0.getPlatform().equals(PLATFORM) - && arg0.getName().startsWith(OS); - } - }); - - Ordering cheapestOrdering = new Ordering() { - public int compare(InstanceType left, InstanceType right) { - return ComparisonChain.start().compare(left.getPrice().getRate(), right.getPrice().getRate()).result(); - } - }.reverse(); - - Set instanceTypes = Sets.newLinkedHashSet(); - - for (Image image : imagesThatAreInOurLocationAndNotBYOL) - Iterables.addAll(instanceTypes, image.getSupportedInstanceTypes()); - - instanceType = cheapestOrdering.max(instanceTypes); - - final InstanceType cheapestInstanceType = instanceType; - System.err.println(cheapestInstanceType); - - image = Iterables.find(imagesThatAreInOurLocationAndNotBYOL, new Predicate() { - - @Override - public boolean apply(Image arg0) { - return arg0.getSupportedInstanceTypes().contains(cheapestInstanceType); - } - - }); - System.err.println(image); - System.err.println(connection.getManifestOfImage(image.getId())); - } - - @Test(dependsOnMethods = { "testAddPublicKey", "resolveImageAndInstanceType" }) - public void testCreateInstance() throws Exception { - killInstance(GROUP); - - instance = connection.createInstanceInLocation(location.getId(), GROUP, image.getId(), instanceType.getId(), - authorizePublicKey(key.getName()).isMiniEphemeral(true)); - - assertBeginState(instance, GROUP); - assertIpHostNullAndStatusNEW(instance); - blockUntilRunning(instance); - instance = assertRunning(instance, GROUP); - sshAndDf(new IPSocket(instance.getPrimaryIP().getIP(), 22), new Credentials("idcuser", key.getKeyMaterial())); - } - - private void killInstance(final String nameToKill) { - Set instances = connection.listInstances(); - try { - Instance instance = Iterables.find(instances, new Predicate() { - - @Override - public boolean apply(Instance input) { - return input.getName().equals(nameToKill); - } - - }); - if (instance.getStatus() != Instance.Status.DEPROVISIONING - && instance.getStatus() != Instance.Status.DEPROVISION_PENDING) { - System.out.println("deleting instance: " + instance); - int timeout = (instance.getStatus() == Instance.Status.NEW || instance.getStatus() == Instance.Status.PROVISIONING) ? 300 - : 30; - assert new RetryablePredicate(new InstanceActiveOrFailed(connection), timeout, 2, - TimeUnit.SECONDS).apply(instance) : instance; - connection.deleteInstance(instance.getId()); - } - assert new RetryablePredicate(new InstanceRemovedOrNotFound(connection), 120, 2, TimeUnit.SECONDS) - .apply(instance) : instance; - } catch (NoSuchElementException ex) { - } - } - - private Instance assertRunning(Instance instance, String name) throws AssertionError { - instance = connection.getInstance(instance.getId()); - - try { - assertIpHostAndStatusACTIVE(instance); - assertConsistent(instance, name); - } catch (NullPointerException e) { - System.err.println(instance); - throw e; - } catch (AssertionError e) { - System.err.println(instance); - throw e; - } - System.err.println("RUNNING: " + instance); - return instance; - } - - private void blockUntilRunning(Instance instance) { - long start = System.currentTimeMillis(); - assert new RetryablePredicate(new InstanceActive(connection), 15 * 60 * 1000).apply(instance) : connection - .getInstance(instance.getId()); - - System.out.println(((System.currentTimeMillis() - start) / 1000) + " seconds"); - } - - private void assertBeginState(Instance instance, String name) throws AssertionError { - try { - assertConsistent(instance, name); - } catch (NullPointerException e) { - System.err.println(instance); - throw e; - } catch (AssertionError e) { - killInstance(instance.getId()); - throw e; - } - } - - private void assertConsistent(Instance instance, String name) { - assert (instance.getId() != null) : instance; - assertEquals(instance.getName(), name); - assertEquals(instance.getInstanceType(), instanceType.getId()); - assertEquals(instance.getLocation(), location.getId()); - assertEquals(instance.getImageId(), image.getId()); - assertEquals(instance.getSoftware(), SOFTWARE); - assertEquals(instance.getKeyName(), key.getName()); - assertNotNull(instance.getLaunchTime()); - assertNotNull(instance.getExpirationTime()); - assertEquals(instance.getOwner(), identity); - assertEquals(instance.getProductCodes(), ImmutableSet. of()); - assertEquals(instance.getRequestName(), name); - assertNotNull(instance.getRequestId()); - } - - private void assertIpHostNullAndStatusNEW(Instance instance) { - assertEquals(instance.getPrimaryIP(), null); - assertEquals(instance.getStatus(), Instance.Status.NEW); - } - - private void assertIpHostAndStatusNEW(Instance instance) { - assertNotNull(instance.getPrimaryIP()); - assertEquals(instance.getStatus(), Instance.Status.NEW); - } - - private void assertIpHostAndStatusACTIVE(Instance instance) { - assertNotNull(instance.getPrimaryIP()); - assertEquals(instance.getStatus(), Instance.Status.ACTIVE); - } - - @Test(dependsOnMethods = { "testAddPublicKey", "testAllocateIpAddress", "testCreateVolume", - "resolveImageAndInstanceType" }) - public void testCreateInstanceWithIpAndVolume() throws Exception { - String name = GROUP + "1"; - killInstance(name); - - instance2 = connection.createInstanceInLocation(location.getId(), name, image.getId(), instanceType.getId(), - secondaryIP(ip.getId()).isMiniEphemeral(true).authorizePublicKey(key.getName()).mountVolume( - volume.getId(), "/mnt")); - - assertBeginState(instance2, name); - assertIpHostAndStatusNEW(instance2); - blockUntilRunning(instance2); - instance2 = assertRunning(instance2, name); - - volume = connection.getVolume(volume.getId()); - assertEquals(volume.getInstanceId(), instance2.getId()); - - refreshIpAndReturnAllAddresses(); - assertEquals(ip.getInstanceId(), instance2.getId()); - assertEquals(ip.getIP(), instance2.getPrimaryIP().getIP()); - sshAndDf(new IPSocket(instance2.getPrimaryIP().getIP(), 22), new Credentials("idcuser", keyPair.get("private"))); - } - - private Set refreshIpAndReturnAllAddresses() { - Set allAddresses = connection.listAddresses(); - final String id = ip.getId(); - // refresh address as it may have been just created - ip = Iterables.find(allAddresses, new Predicate
() { - - @Override - public boolean apply(Address input) { - return input.getId().equals(id); - } - - }); - return allAddresses; - } - - @AfterTest(groups = { "live" }) - void tearDown() { - if (volume != null) - try { - connection.deleteVolume(volume.getId()); - } catch (Exception e) { - - } - if (ip != null) - try { - connection.releaseAddress(ip.getId()); - } catch (Exception e) { - - } - if (key != null) - try { - connection.deleteKey(key.getName()); - } catch (Exception e) { - - } - if (instance != null) - try { - connection.deleteInstance(instance.getId()); - } catch (Exception e) { - - } - if (instance2 != null) - try { - connection.deleteInstance(instance2.getId()); - } catch (Exception e) { - - } - } - - private void sshAndDf(IPSocket socket, Credentials credentials) throws IOException { - for (int i = 0; i < 5; i++) {// retry loop TODO replace with predicate. - try { - _sshAndDf(socket, credentials); - return; - } catch (SshException e) { - try { - Thread.sleep(10 * 1000); - } catch (InterruptedException e1) { - } - continue; - } - } - } - - private void _sshAndDf(IPSocket socket, Credentials credentials) { - RetryablePredicate socketOpen = new RetryablePredicate(new InetSocketAddressConnect(), 180, - 5, TimeUnit.SECONDS); - - socketOpen.apply(socket); - - SshClient ssh = new SshjSshClient(new BackoffLimitedRetryHandler(), socket, 60000, credentials.identity, null, - credentials.credential.getBytes()); - try { - ssh.connect(); - ExecResponse hello = ssh.exec("echo hello"); - assertEquals(hello.getOutput().trim(), "hello"); - ExecResponse exec = ssh.exec("df"); - assertTrue(exec.getOutput().contains("Filesystem"), - "The output should've contained filesystem information, but it didn't. Output: " + exec); - } finally { - if (ssh != null) - ssh.disconnect(); - } - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/ReadOnlyIBMSmartCloudClientLiveTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/ReadOnlyIBMSmartCloudClientLiveTest.java deleted file mode 100644 index 44bab06b35..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/ReadOnlyIBMSmartCloudClientLiveTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; - -import java.util.Set; - -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.testng.annotations.Test; - -import com.google.common.collect.Iterables; - -/** - * Tests behavior of {@code IBMSmartCloudClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ReadOnlyIBMSmartCloudClientLiveTest") -public class ReadOnlyIBMSmartCloudClientLiveTest extends BaseIBMSmartCloudClientLiveTest { - - @Test - public void testListImages() throws Exception { - Set response = connection.listImages(); - assertNotNull(response); - } - - @Test - public void testGetImage() throws Exception { - Set response = connection.listImages(); - assertNotNull(response); - if (response.size() > 0) { - Image image = Iterables.get(response, 0); - assertEquals(connection.getImage(image.getId()).getId(), image.getId()); - } - } - - @Test - public void testListInstances() throws Exception { - Set response = connection.listInstances(); - assertNotNull(response); - } - - @Test - public void testListInstancesFromRequestReturnsEmptySet() throws Exception { - Set response = connection.listInstancesFromRequest(Long.MAX_VALUE + ""); - assertEquals(response.size(), 0); - } - - @Test - public void testGetInstance() throws Exception { - Set response = connection.listInstances(); - assertNotNull(response); - if (response.size() > 0) { - Instance instance = Iterables.get(response, 0); - assertEquals(connection.getInstance(instance.getId()).getId(), instance.getId()); - } - } - - @Test - public void testListKeys() throws Exception { - Set response = connection.listKeys(); - assertNotNull(response); - } - - @Test - public void testGetKey() throws Exception { - Set response = connection.listKeys(); - assertNotNull(response); - if (response.size() > 0) { - Key key = Iterables.get(response, 0); - assertEquals(connection.getKey(key.getName()).getName(), key.getName()); - } - } - - @Test - public void testListVolumes() throws Exception { - Set response = connection.listVolumes(); - assertNotNull(response); - } - - @Test - public void testGetVolume() throws Exception { - Set response = connection.listVolumes(); - assertNotNull(response); - if (response.size() > 0) { - Volume image = Iterables.get(response, 0); - assertEquals(connection.getVolume(image.getId()).getId(), image.getId()); - } - } - - @Test - public void testListLocations() throws Exception { - Set response = connection.listLocations(); - assertNotNull(response); - } - - @Test - public void testListAddresss() throws Exception { - Set response = connection.listAddresses(); - assertNotNull(response); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudComputeServiceLiveTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudComputeServiceLiveTest.java deleted file mode 100644 index d6e4713373..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudComputeServiceLiveTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute; - -import org.jclouds.compute.BaseComputeServiceLiveTest; -import org.jclouds.sshj.config.SshjSshClientModule; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.inject.Module; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true, testName = "IBMSmartCloudComputeServiceLiveTest") -public class IBMSmartCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest { - - @BeforeClass - @Override - public void setServiceDefaults() { - provider = "ibm-smartcloud"; - } - - @Override - protected Module getSshModule() { - return new SshjSshClientModule(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudTemplateBuilderLiveTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudTemplateBuilderLiveTest.java deleted file mode 100644 index 3da56a2d1c..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/compute/IBMSmartCloudTemplateBuilderLiveTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.compute; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.util.Set; - -import org.jclouds.compute.BaseTemplateBuilderLiveTest; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.domain.OsFamilyVersion64Bit; -import org.jclouds.compute.domain.Template; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "IBMSmartCloudTemplateBuilderLiveTest") -public class IBMSmartCloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { - - public IBMSmartCloudTemplateBuilderLiveTest() { - provider = "ibm-smartcloud"; - } - - @Override - protected Predicate defineUnsupportedOperatingSystems() { - return new Predicate() { - - @Override - public boolean apply(OsFamilyVersion64Bit input) { - switch (input.family) { - case SUSE: - return !input.version.equals("") && !input.version.equals("11") && !input.version.equals("11 SP1"); - case RHEL: - return !input.version.equals("") && !input.version.equals("5.4") && !input.version.equals("5.5"); - case WINDOWS: - return !input.version.equals("") && !(input.version.equals("2008 R2") && input.is64Bit) - && !input.version.equals("2008 R1") && !input.version.equals("2003 R2"); - default: - return true; - } - } - - }; - } - - @Override - public void testDefaultTemplateBuilder() throws IOException { - Template defaultTemplate = context.getComputeService().templateBuilder().build(); - assertEquals(defaultTemplate.getLocation().getIso3166Codes(), ImmutableSet.of("CA-ON")); - assertEquals(defaultTemplate.getImage().getId(), "20015393"); - assertEquals(defaultTemplate.getHardware().getId(), "20015393/COP32.1/2048/60"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11 SP1"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.SUSE); - } - - @Override - protected Set getIso3166Codes() { - return ImmutableSet.of("US-NC", "DE-BW", "US-CO", "CA-ON", "JP-12", "SG"); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ExtendReservationForInstanceTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ExtendReservationForInstanceTest.java deleted file mode 100644 index a01ba259fc..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ExtendReservationForInstanceTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.io.Payload; -import org.jclouds.io.Payloads; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ExtendReservationForInstanceTest") -public class ExtendReservationForInstanceTest extends BaseItemParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - protected Payload payload() { - return Payloads.newStringPayload("{ \"expirationTime\":1249876800000 }"); - } - - @Override - @Unwrap - public Date expected() { - return new Date(1249876800000l); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetAddressTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetAddressTest.java deleted file mode 100644 index 988ca2372b..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetAddressTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.json.BaseItemParserTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "GetAddressTest") -public class GetAddressTest extends BaseItemParserTest
{ - - @Override - public String resource() { - return "/address.json"; - } - - @Override - public Address expected() { - return new Address(2, "1", "129.33.196.243", "1217", "1"); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetImageTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetImageTest.java deleted file mode 100644 index c4189eadf3..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetImageTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; - -import org.jclouds.http.HttpUtils; -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.domain.InstanceType; -import org.jclouds.ibm.smartcloud.domain.Price; -import org.jclouds.ibm.smartcloud.domain.Image.Visibility; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "GetImageTest") -public class GetImageTest extends BaseItemParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/image.json"; - } - - @Override - public Image expected() { - return new Image( - "SUSE Linux Enterprise Server 11 for x86", - HttpUtils - .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/parameters.xml"), - Image.State.AVAILABLE, - Visibility.PUBLIC, - "SYSTEM", - "SUSE Linux Enterprise Server/11", - Image.Architecture.I386, - new Date(1216944000000l), - "41", - ImmutableSet. of(new InstanceType("Bronze 32 bit", new Price(0.17, "UHR ", "897", null, - "USD", 1), "BRZ32.1/2048/175"), new InstanceType("Gold 32 bit", new Price(0.41, "UHR ", "897", - null, "USD", 1), "GLD32.4/4096/350"), new InstanceType("Silver 32 bit", new Price(0.265, - "UHR ", "897", null, "USD", 1), "SLV32.2/4096/350")), - ImmutableSet. of("ifeE7VOzRG6SGvoDlRPTQw"), - HttpUtils - .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/GettingStarted.html"), - "20001150", "SUSE Linux Enterprise Server 11 for x86 Base OS 32-bit with pay for use licensing"); - - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetInstanceTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetInstanceTest.java deleted file mode 100644 index 4f574fb2de..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetInstanceTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.IP; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Instance.Software; -import org.jclouds.ibm.smartcloud.domain.Instance.Status; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "GetInstanceTest") -public class GetInstanceTest extends BaseItemParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/instance.json"; - } - - @Override - public Instance expected() { - return Instance.builder().launchTime(new Date(1305351683883l)).software( - ImmutableSet.of(new Software("SUSE Linux Enterprise Server", "OS", "11 SP1"))).primaryIP( - new IP(" ", " ", 0)).requestId("80890").keyName("adriancole").name( - "adriancole").instanceType("COP32.1/2048/60").status(Status.NEW).owner("adrian@cloudconscious.com") - .location("101").imageId("20015393").rootOnly(true).requestName("adriancole").id("80590") - .expirationTime(new Date(1368423692824l)).diskSize(60).build(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetKeyTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetKeyTest.java deleted file mode 100644 index 62ee1439b1..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetKeyTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "GetKeyTest") -public class GetKeyTest extends BaseItemParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/key.json"; - } - - @Override - public Key expected() { - return new Key(true, ImmutableSet. of("1"), "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...", "DEFAULT", - new Date(1260428507510l)); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetVolumeTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetVolumeTest.java deleted file mode 100644 index cf916c3d4d..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/GetVolumeTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -@Test(groups = "unit", testName = "GetVolumeTest") -public class GetVolumeTest extends BaseItemParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/volume.json"; - } - - @Override - public Volume expected() { - return new Volume("2", 5, 50, "aadelucc@us.ibm.com", new Date(1260469075119l), "1", ImmutableSet. of(), - "ext3", "New Storage", "67"); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListAddressesTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListAddressesTest.java deleted file mode 100644 index fa691f7a57..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListAddressesTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Set; - -import org.jclouds.ibm.smartcloud.domain.Address; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ListAddressesTest") -public class ListAddressesTest extends BaseSetParserTest
{ - - @Override - public String resource() { - return "/addresses.json"; - } - - @Override - @Unwrap - public Set
expected() { - return ImmutableSet.of(new Address(2, "1", "129.33.196.243", "1217", "1"), new Address(3, "2", "129.33.196.244", - "1218", null)); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListImagesTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListImagesTest.java deleted file mode 100644 index 3a55b00185..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListImagesTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.http.HttpUtils; -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Image; -import org.jclouds.ibm.smartcloud.domain.InstanceType; -import org.jclouds.ibm.smartcloud.domain.Price; -import org.jclouds.ibm.smartcloud.domain.Image.Visibility; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", singleThreaded = true, testName = "ListImagesTest") -public class ListImagesTest extends BaseSetParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/images.json"; - } - - @Override - @Unwrap - public Set expected() { - return ImmutableSet - .of(new Image( - "SUSE Linux Enterprise Server 11 for x86", - HttpUtils - .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/parameters.xml"), - Image.State.AVAILABLE, - Visibility.PUBLIC, - "SYSTEM", - "SUSE Linux Enterprise Server/11", - Image.Architecture.X86_64, - new Date(1216944000000l), - "41", - ImmutableSet. of(new InstanceType("Bronze 32 bit", new Price(0.17, "UHR ", - "897", null, "USD", 1), "BRZ32.1/2048/175"), new InstanceType("Gold 32 bit", - new Price(0.41, "UHR ", "897", null, "USD", 1), "GLD32.4/4096/350"), - new InstanceType("Silver 32 bit", new Price(0.265, "UHR ", "897", null, "USD", 1), - "SLV32.2/4096/350")), - ImmutableSet. of("ifeE7VOzRG6SGvoDlRPTQw"), - HttpUtils - .createUri("https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/GettingStarted.html"), - "20001150", "SUSE Linux Enterprise Server 11 for x86 Base OS 32-bit with pay for use licensing")); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListInstancesTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListInstancesTest.java deleted file mode 100644 index d0c1b12f14..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListInstancesTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.IP; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Instance.Software; -import org.jclouds.ibm.smartcloud.domain.Instance.Status; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ListInstancesTest") -public class ListInstancesTest extends BaseSetParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/instances.json"; - } - - @Override - @Unwrap - public Set expected() { - - return ImmutableSet.of(Instance.builder().launchTime(new Date(1305351683883l)).software( - ImmutableSet.of(new Software("SUSE Linux Enterprise Server", "OS", "11 SP1"))).primaryIP( - new IP(" ", " ", 0)).requestId("80890").keyName("adriancole").name("adriancole").instanceType( - "COP32.1/2048/60").status(Status.NEW).owner("adrian@cloudconscious.com").location("101").imageId( - "20015393").rootOnly(true).requestName("adriancole").id("80590") - .expirationTime(new Date(1368423692824l)).diskSize(60).build()); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListKeysTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListKeysTest.java deleted file mode 100644 index f8fa7671f0..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListKeysTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Key; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ListKeyesTest") -public class ListKeysTest extends BaseSetParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/keys.json"; - } - - @Override - @Unwrap - public Set expected() { - return ImmutableSet.of(new Key(true, ImmutableSet. of("1"), "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...", - "DEFAULT", new Date(1260428507510l)), new Key(false, ImmutableSet. of(), - "AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+", "BEAR", new Date(1260428507511l))); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListStorageOfferingsTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListStorageOfferingsTest.java deleted file mode 100644 index 78bbde9b1a..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListStorageOfferingsTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Price; -import org.jclouds.ibm.smartcloud.domain.StorageOffering; -import org.jclouds.ibm.smartcloud.domain.StorageOffering.Format; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ListStorageOfferingsTest") -public class ListStorageOfferingsTest extends BaseSetParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/storage-offerings.json"; - } - - @Override - @Unwrap - public Set expected() { - return ImmutableSet.of(// - new StorageOffering("41", new Price(0.039, "UHR", "897", new Date(1279497600000l), "USD", 1), 256, - "Small", "20001208", ImmutableSet.of(new Format("ext3", "EXT3"))),// - new StorageOffering("41", new Price(0.312, "UHR", "897", new Date(1279497600000l), "USD", 1), 2048, - "Large", "20001210", ImmutableSet.of(new Format("ext3", "EXT3"))),// - new StorageOffering("41", new Price(0.078, "UHR", "897", new Date(1279497600000l), "USD", 1), 512, - "Medium", "20001209", ImmutableSet.of(new Format("ext3", "EXT3")))// - ); - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListVolumesTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListVolumesTest.java deleted file mode 100644 index dae398c532..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/ListVolumesTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Volume; -import org.jclouds.json.BaseSetParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ListVolumesTest") -public class ListVolumesTest extends BaseSetParserTest { - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/volumes.json"; - } - - @Override - @Unwrap - public Set expected() { - return ImmutableSet.of(new Volume("2", 5, 50, "aadelucc@us.ibm.com", new Date(1260469075119l), "1", ImmutableSet - . of(), "ext3", "New Storage", "67"), new Volume(null, 6, 51, "aadelucc@us.ibm.com", new Date( - 1260469075120l), "2", ImmutableSet. of("abrad"), "ext3", "New Storage1", "68")); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/NewInstanceTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/NewInstanceTest.java deleted file mode 100644 index 6788f0b448..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/parse/NewInstanceTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.parse; - -import java.util.Date; -import java.util.Set; - -import org.jclouds.ibm.smartcloud.config.IBMSmartCloudParserModule; -import org.jclouds.ibm.smartcloud.domain.Instance; -import org.jclouds.ibm.smartcloud.domain.Instance.Software; -import org.jclouds.ibm.smartcloud.domain.Instance.Status; -import org.jclouds.json.BaseItemParserTest; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.Unwrap; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "GetInstanceTest") -public class NewInstanceTest extends BaseItemParserTest { - - protected Injector injector() { - return Guice.createInjector(new GsonModule(), new IBMSmartCloudParserModule()); - } - - @Override - public String resource() { - return "/new_instance.json"; - } - - @Override - @Unwrap(depth = 2, edgeCollection = Set.class) - public Instance expected() { - return Instance.builder().launchTime(new Date(1305359078796l)).software( - ImmutableSet.of(new Software("SUSE Linux Enterprise Server", "OS", "11 SP1"))).requestId("80904") - .keyName("adriancole").name("adriancole").instanceType("COP32.1/2048/60").status(Status.NEW).owner( - "adrian@cloudconscious.com").location("101").imageId("20015393").requestName("adriancole").id( - "80604").expirationTime(new Date(1368431087355l)).build(); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationHandlerTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationHandlerTest.java deleted file mode 100644 index 9cb56d95ea..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationHandlerTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; - -import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.reference.Capabilities; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; - -/** - * Tests behavior of {@code LocationHandler} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "LocationHandlerTest") -public class LocationHandlerTest extends BaseHandlerTest { - - public void testApplyInputStream() { - InputStream is = getClass().getResourceAsStream("/location.xml"); - - Location result = factory.create(injector.getInstance(LocationHandler.class)).parse(is); - - Location expects = Location.builder().id("41").name("RTP").description("RTP usrdtsa0a1ccxra").location("RTP") - .state(Location.State.ONLINE).capability(Capabilities.CAPABILITY_FORMAT, - ImmutableMap. of("EXT3", "ext3", "RAW", "raw")).capability( - Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64) - .capability(Capabilities.CAPABILITY_AVAILABILITYAREA).build(); - - assertEquals(result.toString(), expects.toString()); - } -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationsHandlerTest.java b/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationsHandlerTest.java deleted file mode 100644 index 061748cd54..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/java/org/jclouds/ibm/smartcloud/xml/LocationsHandlerTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ibm.smartcloud.xml; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.util.Set; - -import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ibm.smartcloud.domain.Location; -import org.jclouds.ibm.smartcloud.reference.Capabilities; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code LocationsHandler} - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "ibm.smartcloud.LocationsHandlerTest") -public class LocationsHandlerTest extends BaseHandlerTest { - - @Test - public void testAllLocations() { - InputStream is = getClass().getResourceAsStream("/locations.xml"); - - Set result = factory.create(injector.getInstance(LocationsHandler.class)).parse(is); - - Set expects = ImmutableSet.of(Location.builder().id("41").name("RTP").description( - "RTP usrdtsa0a1ccxra").location("RTP").state(Location.State.ONLINE).capability( - Capabilities.CAPABILITY_FORMAT, ImmutableMap. of("EXT3", "ext3", "RAW", "raw")) - .capability(Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64).capability( - Capabilities.CAPABILITY_AVAILABILITYAREA).build(), - - Location.builder().id("61").name("EHN").location("EHN").state(Location.State.ONLINE) - .capability(Capabilities.CAPABILITY_FORMAT, - ImmutableMap. of("EXT3", "ext3", "RAW", "raw")).capability( - Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64).capability( - Capabilities.CAPABILITY_AVAILABILITYAREA).build(), - - Location.builder().id("82").name("us-co-dc1").description("BLD main DC").location("us-co-dc1").state( - Location.State.ONLINE).capability(Capabilities.CAPABILITY_FORMAT, - ImmutableMap. of("EXT3", "ext3", "RAW", "raw")).capability( - Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64).capability( - Capabilities.CAPABILITY_AVAILABILITYAREA).build(), - - Location.builder().id("101").name("ca-on-dc1").description("Data Center 1 at Ontario, Canada").location( - "ca-on-dc1").state(Location.State.ONLINE).capability(Capabilities.CAPABILITY_FORMAT, - ImmutableMap. of("EXT3", "ext3", "RAW", "raw")).capability( - Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64).capability( - Capabilities.CAPABILITY_AVAILABILITYAREA).build(), - - Location.builder().id("121").name("ap-jp-dc1").description("Data Center 1 at Makuhari, Japan").location( - "ap-jp-dc1").state(Location.State.ONLINE).capability(Capabilities.CAPABILITY_FORMAT, - ImmutableMap. of("EXT3", "ext3", "RAW", "raw")).capability( - Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64).capability( - Capabilities.CAPABILITY_AVAILABILITYAREA).build(), - - Location.builder().id("141").name("ap-sg-dc1").description("Data Center 1 at Singapore").location( - "ap-sg-dc1").state(Location.State.ONLINE).capability(Capabilities.CAPABILITY_FORMAT, - ImmutableMap. of("EXT3", "ext3", "RAW", "raw")).capability( - Capabilities.CAPABILITY_I386).capability(Capabilities.CAPABILITY_x86_64).capability( - Capabilities.CAPABILITY_AVAILABILITYAREA).build() - - ); - - assertEquals(result.toString(), expects.toString()); - - } - -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/address.json b/sandbox-providers/ibm-smartcloud/src/test/resources/address.json deleted file mode 100644 index 3cbae65dc9..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/address.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -"state":2, -"location":"1", -"ip": "129.33.196.243", -"id":"1217", -"instanceId":"1" -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/addresses.json b/sandbox-providers/ibm-smartcloud/src/test/resources/addresses.json deleted file mode 100644 index e23b8ee5cd..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/addresses.json +++ /dev/null @@ -1,16 +0,0 @@ -{"addresses": [ -{ -"state":2, -"location":"1", -"ip": "129.33.196.243", -"id":"1217", -"instanceId":"1" -}, -{ -"state":3, -"location":"2", -"ip": "129.33.196.244", -"id":"1218" -} -] -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/image.json b/sandbox-providers/ibm-smartcloud/src/test/resources/image.json deleted file mode 100644 index 7d68ce59fa..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/image.json +++ /dev/null @@ -1,51 +0,0 @@ - { - "name": "SUSE Linux Enterprise Server 11 for x86", - "manifest": "https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/parameters.xml", - "state": 1, - "visibility": "PUBLIC", - "owner": "SYSTEM", - "architecture": "i386", - "platform": "SUSE Linux Enterprise Server/11", - "createdTime": 1216944000000, - "location": "41", - "supportedInstanceTypes": [{ - "label": "Bronze 32 bit", - "price": { - "rate": 0.17, - "unitOfMeasure": "UHR ", - "countryCode": "897", - "effectiveDate": -1, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "id": "BRZ32.1/2048/175" - }, - { - "label": "Gold 32 bit", - "price": { - "rate": 0.41, - "unitOfMeasure": "UHR ", - "countryCode": "897", - "effectiveDate": -1, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "id": "GLD32.4/4096/350" - }, - { - "label": "Silver 32 bit", - "price": { - "rate": 0.265, - "unitOfMeasure": "UHR ", - "countryCode": "897", - "effectiveDate": -1, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "id": "SLV32.2/4096/350" - }], - "productCodes": ["ifeE7VOzRG6SGvoDlRPTQw"], - "documentation": "https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/GettingStarted.html", - "id": "20001150", - "description": "SUSE Linux Enterprise Server 11 for x86 Base OS 32-bit with pay for use licensing" - } \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/images.json b/sandbox-providers/ibm-smartcloud/src/test/resources/images.json deleted file mode 100644 index f68f1a69e2..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/images.json +++ /dev/null @@ -1,55 +0,0 @@ -{"images": - [{ - - "name": "SUSE Linux Enterprise Server 11 for x86", - "manifest": "https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/parameters.xml", - "state": 1, - "visibility": "PUBLIC", - "owner": "SYSTEM", - "architecture": "x86_64", - "platform": "SUSE Linux Enterprise Server/11", - "createdTime": 1216944000000, - "location": "41", - "supportedInstanceTypes": [{ - "label": "Bronze 32 bit", - "price": { - "rate": 0.17, - "unitOfMeasure": "UHR ", - "countryCode": "897", - "effectiveDate": -1, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "id": "BRZ32.1/2048/175" - }, - { - "label": "Gold 32 bit", - "price": { - "rate": 0.41, - "unitOfMeasure": "UHR ", - "countryCode": "897", - "effectiveDate": -1, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "id": "GLD32.4/4096/350" - }, - { - "label": "Silver 32 bit", - "price": { - "rate": 0.265, - "unitOfMeasure": "UHR ", - "countryCode": "897", - "effectiveDate": -1, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "id": "SLV32.2/4096/350" - }], - "productCodes": ["ifeE7VOzRG6SGvoDlRPTQw"], - "documentation": "https://www-147.ibm.com/cloud/enterprise/ram.ws/RAMSecure/artifact/{F006D027-02CC-9D08-D389-6C729D939D44}/1.0/GettingStarted.html", - "id": "20001150", - "description": "SUSE Linux Enterprise Server 11 for x86 Base OS 32-bit with pay for use licensing" - } - ] -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/instance.json b/sandbox-providers/ibm-smartcloud/src/test/resources/instance.json deleted file mode 100644 index e453a80894..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/instance.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "launchTime": 1305351683883, - "software": [{ - "version": "11 SP1", - "type": "OS", - "name": "SUSE Linux Enterprise Server" - }], - "primaryIP": { - "hostname": " ", - "ip": " ", - "type": 0 - }, - "requestId": "80890", - "keyName": "adriancole", - "name": "adriancole", - "instanceType": "COP32.1/2048/60", - "status": 0, - "owner": "adrian@cloudconscious.com", - "location": "101", - "imageId": "20015393", - "root-only": "true", - "productCodes": [], - "volumes": [], - "requestName": "adriancole", - "id": "80590", - "secondaryIP": [], - "expirationTime": 1368423692824, - "diskSize": "60" - } \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/instances.json b/sandbox-providers/ibm-smartcloud/src/test/resources/instances.json deleted file mode 100644 index c842afee74..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/instances.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "instances": [{ - "launchTime": 1305351683883, - "software": [{ - "version": "11 SP1", - "type": "OS", - "name": "SUSE Linux Enterprise Server" - }], - "primaryIP": { - "hostname": " ", - "ip": " ", - "type": 0 - }, - "requestId": "80890", - "keyName": "adriancole", - "name": "adriancole", - "instanceType": "COP32.1/2048/60", - "status": 0, - "owner": "adrian@cloudconscious.com", - "location": "101", - "imageId": "20015393", - "root-only": "true", - "productCodes": [], - "volumes": [], - "requestName": "adriancole", - "id": "80590", - "secondaryIP": [], - "expirationTime": 1368423692824, - "diskSize": "60" - }] -} diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/key.json b/sandbox-providers/ibm-smartcloud/src/test/resources/key.json deleted file mode 100644 index e6dfefc3f2..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/key.json +++ /dev/null @@ -1,7 +0,0 @@ -{ -"default":true, -"instanceIds":["1"], -"keyMaterial":"AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...", -"keyName":"DEFAULT", -"lastModifiedTime":1260428507510 -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/keys.json b/sandbox-providers/ibm-smartcloud/src/test/resources/keys.json deleted file mode 100644 index bd119d618d..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/keys.json +++ /dev/null @@ -1,18 +0,0 @@ -{ -"keys":[ -{ -"default":true, -"instanceIds":["1"], -"keyMaterial":"AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+...", -"keyName":"DEFAULT", -"lastModifiedTime":1260428507510 -}, -{ -"default":false, -"instanceIds":[], -"keyMaterial":"AAAB3NzaC1yc2EAAAADAQABAAABAQCqBw7a+", -"keyName":"BEAR", -"lastModifiedTime":1260428507511 -} -] -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/location.xml b/sandbox-providers/ibm-smartcloud/src/test/resources/location.xml deleted file mode 100644 index 1e09cd783e..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/location.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - 41 - RTP - RTP usrdtsa0a1ccxra - RTP - - - - ext3 - - - raw - - - - - - - 1 - - \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/locations.xml b/sandbox-providers/ibm-smartcloud/src/test/resources/locations.xml deleted file mode 100644 index 321329f644..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/locations.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - 41 - RTP - RTP usrdtsa0a1ccxra - RTP - - - - ext3 - - - raw - - - - - - - 1 - - - 61 - EHN - - EHN - - - - ext3 - - - raw - - - - - - - 1 - - - 82 - us-co-dc1 - BLD main DC - us-co-dc1 - - - - ext3 - - - raw - - - - - - - 1 - - - 101 - ca-on-dc1 - Data Center 1 at Ontario, Canada - ca-on-dc1 - - - - ext3 - - - raw - - - - - - - 1 - - - 121 - ap-jp-dc1 - Data Center 1 at Makuhari, Japan - ap-jp-dc1 - - - - ext3 - - - raw - - - - - - - 1 - - - 141 - ap-sg-dc1 - Data Center 1 at Singapore - ap-sg-dc1 - - - - ext3 - - - raw - - - - - - - 1 - - \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/log4j.xml b/sandbox-providers/ibm-smartcloud/src/test/resources/log4j.xml deleted file mode 100644 index 63810d3ca0..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/log4j.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/new_instance.json b/sandbox-providers/ibm-smartcloud/src/test/resources/new_instance.json deleted file mode 100644 index 4388aa839b..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/new_instance.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "instances": [{ - "launchTime": 1305359078796, - "software": [{ - "version": "11 SP1", - "type": "OS", - "name": "SUSE Linux Enterprise Server" - }], - "requestId": "80904", - "keyName": "adriancole", - "name": "adriancole", - "instanceType": "COP32.1/2048/60", - "status": 0, - "owner": "adrian@cloudconscious.com", - "location": "101", - "imageId": "20015393", - "productCodes": [], - "volumes": [], - "requestName": "adriancole", - "id": "80604", - "secondaryIP": [], - "expirationTime": 1368431087355 - }] -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/storage-offerings.json b/sandbox-providers/ibm-smartcloud/src/test/resources/storage-offerings.json deleted file mode 100644 index a6edca1c42..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/storage-offerings.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "addresses": [{ - "location": "41", - "price": { - "rate": 0.039, - "unitOfMeasure": "UHR", - "countryCode": "897", - "effectiveDate": 1279497600000, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "capacity": 256, - "name": "Small", - "id": "20001208", - "formats": [{ - "label": "ext3", - "id": "EXT3" - }] - }, - { - "location": "41", - "price": { - "rate": 0.078, - "unitOfMeasure": "UHR", - "countryCode": "897", - "effectiveDate": 1279497600000, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "capacity": 512, - "name": "Medium", - "id": "20001209", - "formats": [{ - "label": "ext3", - "id": "EXT3" - }] - }, - { - "location": "41", - "price": { - "rate": 0.312, - "unitOfMeasure": "UHR", - "countryCode": "897", - "effectiveDate": 1279497600000, - "currencyCode": "USD", - "pricePerQuantity": 1 - }, - "capacity": 2048, - "name": "Large", - "id": "20001210", - "formats": [{ - "label": "ext3", - "id": "EXT3" - }] - }] -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/volume.json b/sandbox-providers/ibm-smartcloud/src/test/resources/volume.json deleted file mode 100644 index b68b52078b..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/volume.json +++ /dev/null @@ -1,12 +0,0 @@ -{ -"instanceId":"2", -"state":5, -"size":"50", -"owner":"aadelucc@us.ibm.com", -"createdTime":1260469075119, -"location":"1", -"productCodes":[], -"format":"ext3", -"name":"New Storage", -"id":"67" -} \ No newline at end of file diff --git a/sandbox-providers/ibm-smartcloud/src/test/resources/volumes.json b/sandbox-providers/ibm-smartcloud/src/test/resources/volumes.json deleted file mode 100644 index 83a40a093e..0000000000 --- a/sandbox-providers/ibm-smartcloud/src/test/resources/volumes.json +++ /dev/null @@ -1,26 +0,0 @@ -{"volumes": [ -{ -"instanceId":"2", -"state":5, -"size":"50", -"owner":"aadelucc@us.ibm.com", -"createdTime":1260469075119, -"location":"1", -"productCodes":[], -"format":"ext3", -"name":"New Storage", -"id":"67" -}, -{ -"state":6, -"size":"51", -"owner":"aadelucc@us.ibm.com", -"createdTime":1260469075120, -"location":"2", -"productCodes":["abrad"], -"format":"ext3", -"name":"New Storage1", -"id":"68" -} - -]} \ No newline at end of file diff --git a/sandbox-providers/scaleup-storage/README.txt b/sandbox-providers/scaleup-storage/README.txt deleted file mode 100644 index 36cfb1ad42..0000000000 --- a/sandbox-providers/scaleup-storage/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -# -# The jclouds provider for ScaleUp's Secure Cloud Storage (http://www.scaleupstorage.com/). -# -# Expects the jclouds s3 API to be present on your application's classpath. -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. \ No newline at end of file diff --git a/sandbox-providers/scaleup-storage/pom.xml b/sandbox-providers/scaleup-storage/pom.xml deleted file mode 100644 index 1694679290..0000000000 --- a/sandbox-providers/scaleup-storage/pom.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - scaleup-storage - jclouds ScaleUp Cloud Storage provider - Scality RING (ScalityRS2) implementation targeted to ScaleUp Cloud Storage - bundle - - - org.jclouds.scaleup.storage.blobstore.ScaleUpStorageTestInitializer - https://scs.scaleupstorage.com - 2006-03-01 - - FIX_ME - FIX_ME - - org.jclouds.scaleup.storage*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - scality-rs2 - ${project.version} - jar - - - org.jclouds.api - scality-rs2 - ${project.version} - test-jar - test - - - org.jclouds.api - s3 - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.scaleup-storage.endpoint} - ${test.scaleup-storage.api-version} - ${test.scaleup-storage.build-version} - ${test.scaleup-storage.identity} - ${test.scaleup-storage.credential} - ${test.initializer} - ${jclouds.blobstore.httpstream.url} - ${jclouds.blobstore.httpstream.md5} - - - - - - - - - - - - diff --git a/sandbox-providers/scaleup-storage/src/main/java/org/jclouds/scaleup/storage/ScaleUpStoragePropertiesBuilder.java b/sandbox-providers/scaleup-storage/src/main/java/org/jclouds/scaleup/storage/ScaleUpStoragePropertiesBuilder.java deleted file mode 100644 index 6317ae9c98..0000000000 --- a/sandbox-providers/scaleup-storage/src/main/java/org/jclouds/scaleup/storage/ScaleUpStoragePropertiesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage; - -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; - -import java.util.Properties; - -import org.jclouds.scality.rs2.ScalityRS2PropertiesBuilder; - -/** - * Builds properties used in ScaleUp Storage - * - * @author Adrian Cole - */ -public class ScaleUpStoragePropertiesBuilder extends ScalityRS2PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ISO3166_CODES, "DE"); - properties.setProperty(PROPERTY_ENDPOINT, "https://scs.scaleupstorage.com"); - return properties; - } - - public ScaleUpStoragePropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/ScaleUpStorageClientLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/ScaleUpStorageClientLiveTest.java deleted file mode 100644 index e8d9525aa2..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/ScaleUpStorageClientLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage; - -import org.jclouds.scality.rs2.ScalityRS2ClientLiveTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code ScalityRS2Client} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "ScaleUpStorageClientLiveTest") -public class ScaleUpStorageClientLiveTest extends ScalityRS2ClientLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobIntegrationLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobIntegrationLiveTest.java deleted file mode 100644 index acd6bb9e3c..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobIntegrationLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageBlobIntegrationLiveTest") -public class ScaleUpStorageBlobIntegrationLiveTest extends ScalityRS2BlobIntegrationLiveTest { - - - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobLiveTest.java deleted file mode 100644 index ab5966a27a..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageBlobLiveTest") -public class ScaleUpStorageBlobLiveTest extends ScalityRS2BlobLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobMapIntegrationLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobMapIntegrationLiveTest.java deleted file mode 100644 index eb3a70b72d..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageBlobMapIntegrationLiveTest") -public class ScaleUpStorageBlobMapIntegrationLiveTest extends ScalityRS2BlobMapIntegrationLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobSignerLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobSignerLiveTest.java deleted file mode 100644 index 377e3760f3..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageBlobSignerLiveTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobSignerLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageBlobSignerLiveTest") -public class ScaleUpStorageBlobSignerLiveTest extends ScalityRS2BlobSignerLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerIntegrationLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerIntegrationLiveTest.java deleted file mode 100644 index 4b0a550309..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ContainerIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageContainerIntegrationLiveTest") -public class ScaleUpStorageContainerIntegrationLiveTest extends ScalityRS2ContainerIntegrationLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerLiveTest.java deleted file mode 100644 index 955f1c4a54..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageContainerLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ContainerLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageContainerLiveTest") -public class ScaleUpStorageContainerLiveTest extends ScalityRS2ContainerLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageInputStreamMapIntegrationLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageInputStreamMapIntegrationLiveTest.java deleted file mode 100644 index 83da72bcb9..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageInputStreamMapIntegrationLiveTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2InputStreamMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageInputStreamMapIntegrationLiveTest") -public class ScaleUpStorageInputStreamMapIntegrationLiveTest extends ScalityRS2InputStreamMapIntegrationLiveTest { - -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageServiceIntegrationLiveTest.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageServiceIntegrationLiveTest.java deleted file mode 100644 index bb10c3f509..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageServiceIntegrationLiveTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import java.util.Set; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ServiceIntegrationLiveTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "ScaleUpStorageServiceIntegrationLiveTest") -public class ScaleUpStorageServiceIntegrationLiveTest extends ScalityRS2ServiceIntegrationLiveTest { - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("DE"); - } -} diff --git a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageTestInitializer.java b/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageTestInitializer.java deleted file mode 100644 index e3874b6eb1..0000000000 --- a/sandbox-providers/scaleup-storage/src/test/java/org/jclouds/scaleup/storage/blobstore/ScaleUpStorageTestInitializer.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.scaleup.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2TestInitializer; - - -/** - * - * @author Adrian Cole - */ -public class ScaleUpStorageTestInitializer extends ScalityRS2TestInitializer { - - public ScaleUpStorageTestInitializer() { - provider = "scaleup-storage"; - } - - -} diff --git a/sandbox-providers/tiscali-storage/pom.xml b/sandbox-providers/tiscali-storage/pom.xml deleted file mode 100644 index 7a15d539a4..0000000000 --- a/sandbox-providers/tiscali-storage/pom.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - tiscali-storage - jclouds Tisali Cloud Storage provider - Scality RING (ScalityRS2) implementation targeted to Tisali Cloud Storage - bundle - - - org.jclouds.tiscali.storage.blobstore.TiscaliStorageTestInitializer - https://storage.tiscali.it - 2006-03-01 - - FIX_ME - FIX_ME - - org.jclouds.tiscali.storage*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - scality-rs2 - ${project.version} - jar - - - org.jclouds.api - scality-rs2 - ${project.version} - test-jar - test - - - org.jclouds.api - s3 - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - 1 - - ${test.tiscali-storage.endpoint} - ${test.tiscali-storage.api-version} - ${test.tiscali-storage.build-version} - ${test.tiscali-storage.identity} - ${test.tiscali-storage.credential} - ${test.initializer} - ${jclouds.blobstore.httpstream.url} - ${jclouds.blobstore.httpstream.md5} - - - - - - - - - - - diff --git a/sandbox-providers/tiscali-storage/src/main/java/org/jclouds/tiscali/storage/TiscaliStoragePropertiesBuilder.java b/sandbox-providers/tiscali-storage/src/main/java/org/jclouds/tiscali/storage/TiscaliStoragePropertiesBuilder.java deleted file mode 100644 index 77bc38063e..0000000000 --- a/sandbox-providers/tiscali-storage/src/main/java/org/jclouds/tiscali/storage/TiscaliStoragePropertiesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage; - -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; - -import java.util.Properties; - -import org.jclouds.scality.rs2.ScalityRS2PropertiesBuilder; - -/** - * Builds properties used in Tiscali Storage - * - * @author Adrian Cole - */ -public class TiscaliStoragePropertiesBuilder extends ScalityRS2PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ISO3166_CODES, "IT"); - properties.setProperty(PROPERTY_ENDPOINT, "https://storage.tiscali.it"); - return properties; - } - - public TiscaliStoragePropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/TiscaliStorageClientLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/TiscaliStorageClientLiveTest.java deleted file mode 100644 index 696727d31b..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/TiscaliStorageClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage; - -import org.jclouds.scality.rs2.ScalityRS2ClientLiveTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code ScalityRS2Client} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true, testName = "TiscaliStorageClientLiveTest") -public class TiscaliStorageClientLiveTest extends ScalityRS2ClientLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobIntegrationLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobIntegrationLiveTest.java deleted file mode 100644 index 13945c2a8c..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobIntegrationLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageBlobIntegrationLiveTest") -public class TiscaliStorageBlobIntegrationLiveTest extends ScalityRS2BlobIntegrationLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobLiveTest.java deleted file mode 100644 index dc06b210b2..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageBlobLiveTest") -public class TiscaliStorageBlobLiveTest extends ScalityRS2BlobLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobMapIntegrationLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobMapIntegrationLiveTest.java deleted file mode 100644 index e6db3e38dc..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobMapIntegrationLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageBlobMapIntegrationLiveTest") -public class TiscaliStorageBlobMapIntegrationLiveTest extends ScalityRS2BlobMapIntegrationLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobSignerLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobSignerLiveTest.java deleted file mode 100644 index 23d1d617d3..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageBlobSignerLiveTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2BlobSignerLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageBlobSignerLiveTest") -public class TiscaliStorageBlobSignerLiveTest extends ScalityRS2BlobSignerLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerIntegrationLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerIntegrationLiveTest.java deleted file mode 100644 index a114e5c232..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerIntegrationLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ContainerIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageContainerIntegrationLiveTest") -public class TiscaliStorageContainerIntegrationLiveTest extends ScalityRS2ContainerIntegrationLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerLiveTest.java deleted file mode 100644 index 4db59b807e..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageContainerLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ContainerLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageContainerLiveTest") -public class TiscaliStorageContainerLiveTest extends ScalityRS2ContainerLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageInputStreamMapIntegrationLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageInputStreamMapIntegrationLiveTest.java deleted file mode 100644 index 58e31e6691..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageInputStreamMapIntegrationLiveTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2InputStreamMapIntegrationLiveTest; -import org.testng.annotations.Test; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageInputStreamMapIntegrationLiveTest") -public class TiscaliStorageInputStreamMapIntegrationLiveTest extends ScalityRS2InputStreamMapIntegrationLiveTest { - static { - containerCount = 4; - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageServiceIntegrationLiveTest.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageServiceIntegrationLiveTest.java deleted file mode 100644 index 7703c2d669..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageServiceIntegrationLiveTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import java.util.Set; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2ServiceIntegrationLiveTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * @author Adrian Cole - */ -@Test(groups = "live", testName = "TiscaliStorageServiceIntegrationLiveTest") -public class TiscaliStorageServiceIntegrationLiveTest extends ScalityRS2ServiceIntegrationLiveTest { - static { - containerCount = 4; - } - - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("IT"); - } -} diff --git a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageTestInitializer.java b/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageTestInitializer.java deleted file mode 100644 index de3198a7b8..0000000000 --- a/sandbox-providers/tiscali-storage/src/test/java/org/jclouds/tiscali/storage/blobstore/TiscaliStorageTestInitializer.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.tiscali.storage.blobstore; - -import org.jclouds.scality.rs2.blobstore.ScalityRS2TestInitializer; - - -/** - * - * @author Adrian Cole - */ -public class TiscaliStorageTestInitializer extends ScalityRS2TestInitializer { - - public TiscaliStorageTestInitializer() { - provider = "tiscali-storage"; - } - - -} diff --git a/sandbox-providers/twitter/.gitignore b/sandbox-providers/twitter/.gitignore deleted file mode 100644 index 0432445082..0000000000 --- a/sandbox-providers/twitter/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# use glob syntax. -syntax: glob -target -.settings -.classpath -.project -jclouds-twitter.iml -jclouds-twitter.ipr -jclouds-twitter.iws \ No newline at end of file diff --git a/sandbox-providers/twitter/README.txt b/sandbox-providers/twitter/README.txt deleted file mode 100644 index 34db9816e8..0000000000 --- a/sandbox-providers/twitter/README.txt +++ /dev/null @@ -1,25 +0,0 @@ -==== - Licensed to jclouds, Inc. (jclouds) under one or more - contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. jclouds licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -# -# The jclouds provider for Twitter (http://twitter.com/). -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. diff --git a/sandbox-providers/twitter/pom.xml b/sandbox-providers/twitter/pom.xml deleted file mode 100644 index d02550ae39..0000000000 --- a/sandbox-providers/twitter/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - twitter - jclouds twitter core - jclouds components to access twitter - bundle - - - - - jclouds-sona-snapshots-nexus - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - - - http://api.twitter.com - 1.0 - - FIXME - FIXME - - org.jclouds.twitter*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - org.jclouds - jclouds-core - ${project.version} - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - log4j - log4j - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.twitter.endpoint} - ${test.twitter.api-version} - ${test.twitter.build-version} - ${test.twitter.identity} - ${test.twitter.credential} - - - - - - - - - - diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/Twitter.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/Twitter.java deleted file mode 100644 index 1cdc42d950..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/Twitter.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Related to a Twitter resource. - * - * @author Adrian Cole - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Twitter { - -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterAsyncClient.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterAsyncClient.java deleted file mode 100644 index e3c9de6206..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterAsyncClient.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import java.util.SortedSet; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.MediaType; - -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.twitter.domain.Status; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Twitter via their REST API. - *

- * - * @see TwitterClient - * @see - * @author Adrian Cole - */ -@RequestFilters(BasicAuthentication.class) -public interface TwitterAsyncClient { - - /** - * @see TwitterClient#getMyMentions() - */ - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/statuses/mentions.json") - ListenableFuture> getMyMentions(); - -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterClient.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterClient.java deleted file mode 100644 index 1dded41497..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterClient.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import java.util.SortedSet; -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.Timeout; -import org.jclouds.twitter.domain.Status; - -/** - * Provides access to Twitter via their REST API. - *

- * - * @see - * @see TwitterAsyncClient - * @author Adrian Cole - */ -@Timeout(duration = 4, timeUnit = TimeUnit.SECONDS) -public interface TwitterClient { - - SortedSet getMyMentions(); - -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java deleted file mode 100644 index a2fed55371..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.rest.RestContextBuilder; -import org.jclouds.twitter.config.TwitterRestClientModule; - -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - */ -public class TwitterContextBuilder extends - RestContextBuilder { - - public TwitterContextBuilder(Properties props) { - super(TwitterClient.class, TwitterAsyncClient.class, props); - } - - protected void addClientModule(List modules) { - modules.add(new TwitterRestClientModule()); - } - -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java deleted file mode 100644 index 0a13556e43..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import static org.jclouds.Constants.PROPERTY_API_VERSION; -import static org.jclouds.Constants.PROPERTY_ENDPOINT; - -import java.util.Properties; - -import org.jclouds.PropertiesBuilder; - -/** - * Builds properties used in twitter Clients - * - * @author Adrian Cole - */ -public class TwitterPropertiesBuilder extends PropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ENDPOINT, "https://api.twitter.com"); - properties.setProperty(PROPERTY_API_VERSION, "1.0"); - return properties; - } - - public TwitterPropertiesBuilder(Properties properties) { - super(properties); - } - -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java deleted file mode 100644 index 81df896071..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter.config; - -import org.jclouds.http.RequiresHttp; -import org.jclouds.json.config.GsonModule.CDateAdapter; -import org.jclouds.json.config.GsonModule.DateAdapter; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; -import org.jclouds.twitter.TwitterAsyncClient; -import org.jclouds.twitter.TwitterClient; - -/** - * Configures the twitter connection. - * - * @author Adrian Cole - */ -@RequiresHttp -@ConfiguresRestClient -public class TwitterRestClientModule extends RestClientModule { - - public TwitterRestClientModule() { - super(TwitterClient.class, TwitterAsyncClient.class); - } - - @Override - protected void configure() { - super.configure(); - bind(DateAdapter.class).to(CDateAdapter.class); - } - - @Override - protected void bindErrorHandlers() { -// bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(TwitterErrorHandler.class); -// bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(TwitterErrorHandler.class); -// bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(TwitterErrorHandler.class); - } - - @Override - protected void bindRetryHandlers() { - // TODO - } - -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/Status.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/Status.java deleted file mode 100644 index 44a51faf05..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/Status.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter.domain; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; - -/** - * - * @author Adrian Cole - * - */ -public class Status implements Comparable { - @SerializedName("created_at") - private Date createdAt; - private boolean favorited; - private String geo; - private long id; - @SerializedName("in_reply_to_screen_name") - private String inReplyToScreenName; - @SerializedName("in_reply_to_status_id") - private Integer inReplyToStatusId; - @SerializedName("in_reply_to_user_id") - private Integer inReplyToUserId; - private String source; - private String text; - private boolean truncated; - private User user; - - public Status() { - } - - public Status(Date createdAt, boolean favorited, String geo, long id, - String inReplyToScreenName, Integer inReplyToStatusId, Integer inReplyToUserId, - String source, String text, boolean truncated, User user) { - this.createdAt = createdAt; - this.favorited = favorited; - this.geo = geo; - this.id = id; - this.inReplyToScreenName = inReplyToScreenName; - this.inReplyToStatusId = inReplyToStatusId; - this.inReplyToUserId = inReplyToUserId; - this.source = source; - this.text = text; - this.truncated = truncated; - this.user = user; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode()); - result = prime * result + (int) (id ^ (id >>> 32)); - result = prime * result + ((text == null) ? 0 : text.hashCode()); - result = prime * result + ((user == null) ? 0 : user.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Status other = (Status) obj; - if (createdAt == null) { - if (other.createdAt != null) - return false; - } else if (!createdAt.equals(other.createdAt)) - return false; - if (id != other.id) - return false; - if (text == null) { - if (other.text != null) - return false; - } else if (!text.equals(other.text)) - return false; - if (user == null) { - if (other.user != null) - return false; - } else if (!user.equals(other.user)) - return false; - return true; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public boolean isTruncated() { - return truncated; - } - - public void setTruncated(boolean truncated) { - this.truncated = truncated; - } - - public Integer getInReplyToStatusId() { - return inReplyToStatusId; - } - - public void setInReplyToStatusId(Integer inReplyToStatusId) { - this.inReplyToStatusId = inReplyToStatusId; - } - - public Integer getInReplyToUserId() { - return inReplyToUserId; - } - - public void setInReplyToUserId(Integer inReplyToUserId) { - this.inReplyToUserId = inReplyToUserId; - } - - public boolean isFavorited() { - return favorited; - } - - public void setFavorited(boolean favorited) { - this.favorited = favorited; - } - - public String getInReplyToScreenName() { - return inReplyToScreenName; - } - - public void setInReplyToScreenName(String inReplyToScreenName) { - this.inReplyToScreenName = inReplyToScreenName; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public int compareTo(Status o) { - return (int) ((this == o) ? 0 : id + "".compareTo(o.id + "")); - } - - public void setGeo(String geo) { - this.geo = geo; - } - - public String getGeo() { - return geo; - } -} diff --git a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/User.java b/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/User.java deleted file mode 100644 index a920a4f70f..0000000000 --- a/sandbox-providers/twitter/src/main/java/org/jclouds/twitter/domain/User.java +++ /dev/null @@ -1,363 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter.domain; - -import java.net.URI; -import java.util.Date; - -import com.google.gson.annotations.SerializedName; - -/** - * - * @author Adrian Cole - */ -public class User implements Comparable { - @SerializedName("created_at") - private Date createdAt; - private String description; - @SerializedName("favourites_count") - private int favouritesCount; - @SerializedName("followers_count") - private int followersCount; - private boolean following; - @SerializedName("friends_count") - private int friendsCount; - @SerializedName("geo_enabled") - private boolean geoEnabled; - private long id; - private String location; - private String name; - private boolean notifications; - @SerializedName("profile_background_color") - private String profileBackgroundColor; - @SerializedName("profile_background_image_url") - private URI profileBackgroundImageUrl; - @SerializedName("profile_background_tile") - private boolean profileBackgroundTile; - @SerializedName("profile_image_url") - private URI profileImageUrl; - @SerializedName("profile_link_color") - private String profileLinkColor; - @SerializedName("profile_sidebar_border_color") - private String profileSidebarBorderColor; - @SerializedName("profile_sidebar_fill_color") - private String profileSidebarFillColor; - @SerializedName("profile_text_color") - private String profileTextColor; - @SerializedName("protected") - private boolean isProtected; - @SerializedName("screen_name") - private String screenName; - @SerializedName("statuses_count") - private int statusesCount; - @SerializedName("time_zone") - private String timeZone; - private URI url; - @SerializedName("utc_offset") - private int utcOffset; - private boolean verified; - - public User() { - - } - - public User(Date createdAt, String description, int favouritesCount, int followersCount, - boolean following, int friendsCount, boolean geoEnabled, long id, String location, - String name, boolean notifications, String profileBackgroundColor, - URI profileBackgroundImageUrl, boolean profileBackgroundTile, URI profileImageUrl, - String profileLinkColor, String profileSidebarBorderColor, - String profileSidebarFillColor, String profileTextColor, boolean isProtected, - String screenName, int statusesCount, String timeZone, URI url, int utcOffset, - boolean verified) { - this.createdAt = createdAt; - this.description = description; - this.favouritesCount = favouritesCount; - this.followersCount = followersCount; - this.following = following; - this.friendsCount = friendsCount; - this.setGeoEnabled(geoEnabled); - this.id = id; - this.location = location; - this.name = name; - this.notifications = notifications; - this.profileBackgroundColor = profileBackgroundColor; - this.profileBackgroundImageUrl = profileBackgroundImageUrl; - this.profileBackgroundTile = profileBackgroundTile; - this.profileImageUrl = profileImageUrl; - this.profileLinkColor = profileLinkColor; - this.profileSidebarBorderColor = profileSidebarBorderColor; - this.profileSidebarFillColor = profileSidebarFillColor; - this.profileTextColor = profileTextColor; - this.isProtected = isProtected; - this.screenName = screenName; - this.statusesCount = statusesCount; - this.timeZone = timeZone; - this.url = url; - this.utcOffset = utcOffset; - this.verified = verified; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (int) (id ^ (id >>> 32)); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((screenName == null) ? 0 : screenName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - User other = (User) obj; - if (id != other.id) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (screenName == null) { - if (other.screenName != null) - return false; - } else if (!screenName.equals(other.screenName)) - return false; - return true; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getScreenName() { - return screenName; - } - - public void setScreenName(String screenName) { - this.screenName = screenName; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public URI getProfileImageUrl() { - return profileImageUrl; - } - - public void setProfileImageUrl(URI profileImageUrl) { - this.profileImageUrl = profileImageUrl; - } - - public URI getUrl() { - return url; - } - - public void setUrl(URI url) { - this.url = url; - } - - public boolean isProtected() { - return isProtected; - } - - public void setProtected(boolean isProtected) { - this.isProtected = isProtected; - } - - public int getFollowersCount() { - return followersCount; - } - - public void setFollowersCount(int followersCount) { - this.followersCount = followersCount; - } - - public String getProfileBackgroundColor() { - return profileBackgroundColor; - } - - public void setProfileBackgroundColor(String profileBackgroundColor) { - this.profileBackgroundColor = profileBackgroundColor; - } - - public String getProfileTextColor() { - return profileTextColor; - } - - public void setProfileTextColor(String profileTextColor) { - this.profileTextColor = profileTextColor; - } - - public String getProfileLinkColor() { - return profileLinkColor; - } - - public void setProfileLinkColor(String profileLinkColor) { - this.profileLinkColor = profileLinkColor; - } - - public String getProfileSidebarFillColor() { - return profileSidebarFillColor; - } - - public void setProfileSidebarFillColor(String profileSidebarFillColor) { - this.profileSidebarFillColor = profileSidebarFillColor; - } - - public String getProfileSidebarBorderColor() { - return profileSidebarBorderColor; - } - - public void setProfileSidebarBorderColor(String profileSidebarBorderColor) { - this.profileSidebarBorderColor = profileSidebarBorderColor; - } - - public int getFriendsCount() { - return friendsCount; - } - - public void setFriendsCount(int friendsCount) { - this.friendsCount = friendsCount; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public int getFavouritesCount() { - return favouritesCount; - } - - public void setFavouritesCount(int favouritesCount) { - this.favouritesCount = favouritesCount; - } - - public int getUtcOffset() { - return utcOffset; - } - - public void setUtcOffset(int utcOffset) { - this.utcOffset = utcOffset; - } - - public String getTimeZone() { - return timeZone; - } - - public void setTimeZone(String timeZone) { - this.timeZone = timeZone; - } - - public URI getProfileBackgroundImageUrl() { - return profileBackgroundImageUrl; - } - - public void setProfileBackgroundImageUrl(URI profileBackgroundImageUrl) { - this.profileBackgroundImageUrl = profileBackgroundImageUrl; - } - - public boolean isProfileBackgroundTile() { - return profileBackgroundTile; - } - - public void setProfileBackgroundTile(boolean profileBackgroundTile) { - this.profileBackgroundTile = profileBackgroundTile; - } - - public int getStatusesCount() { - return statusesCount; - } - - public void setStatusesCount(int statusesCount) { - this.statusesCount = statusesCount; - } - - public boolean isNotifications() { - return notifications; - } - - public void setNotifications(boolean notifications) { - this.notifications = notifications; - } - - public boolean isFollowing() { - return following; - } - - public void setFollowing(boolean following) { - this.following = following; - } - - public boolean isVerified() { - return verified; - } - - public void setVerified(boolean verified) { - this.verified = verified; - } - - public int compareTo(User o) { - if (screenName == null) - return -1; - return (this == o) ? 0 : screenName.compareTo(o.screenName); - } - - public void setGeoEnabled(boolean geoEnabled) { - this.geoEnabled = geoEnabled; - } - - public boolean isGeoEnabled() { - return geoEnabled; - } -} diff --git a/sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterAsyncClientTest.java b/sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterAsyncClientTest.java deleted file mode 100644 index f0dfbaa8e0..0000000000 --- a/sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterAsyncClientTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.Properties; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.RequiresHttp; -import org.jclouds.http.filters.BasicAuthentication; -import org.jclouds.http.functions.ParseJson; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RestClientTest; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.rest.RestContextSpec; -import org.jclouds.rest.internal.RestAnnotationProcessor; -import org.jclouds.twitter.config.TwitterRestClientModule; -import org.testng.annotations.Test; - -import com.google.common.collect.Iterables; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; - -/** - * Tests annotation parsing of {@code TwitterAsyncClient} - * - * @author Adrian Cole - */ -@Test(groups = "unit") -public class TwitterAsyncClientTest extends RestClientTest { - public void testGetMyMentions() throws SecurityException, NoSuchMethodException, IOException { - Method method = TwitterAsyncClient.class.getMethod("getMyMentions"); - GeneratedHttpRequest httpRequest = processor.createRequest(method); - - assertRequestLineEquals(httpRequest, "GET http://api.twitter.com/statuses/mentions.json HTTP/1.1"); - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); - assertPayloadEquals(httpRequest, null, null, false); - - // now make sure request filters apply by replaying - httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); - httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); - - assertRequestLineEquals(httpRequest, "GET http://api.twitter.com/statuses/mentions.json HTTP/1.1"); - // for example, using basic authentication, we should get "only one" - // header - assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nAuthorization: Basic Zm9vOmJhcg==\n"); - assertPayloadEquals(httpRequest, null, null, false); - - assertResponseParserClassEquals(method, httpRequest, ParseJson.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(httpRequest); - - } - - @Override - protected void checkFilters(HttpRequest request) { - assertEquals(request.getFilters().size(), 1); - assertEquals(request.getFilters().get(0).getClass(), BasicAuthentication.class); - } - - @Override - protected TypeLiteral> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - protected Module createModule() { - return new TwitterRestClientModuleExtension(); - } - - @RequiresHttp - @ConfiguresRestClient - public static class TwitterRestClientModuleExtension extends TwitterRestClientModule { - - // Override here - } - - @Override - public RestContextSpec createContextSpec() { - // TODO take this out, when the service is registered in jclouds-core/rest.properties - Properties restProperties = new Properties(); - restProperties.setProperty("twitter.contextbuilder", "org.jclouds.twitter.TwitterContextBuilder"); - restProperties.setProperty("twitter.propertiesbuilder", "org.jclouds.twitter.TwitterPropertiesBuilder"); - - Properties props = new Properties(); - props.setProperty("twitter.endpoint", "http://api.twitter.com"); - return new RestContextFactory(restProperties).createContextSpec("twitter", "foo", "bar", props); - } -} diff --git a/sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java b/sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java deleted file mode 100644 index 0ac3cf809b..0000000000 --- a/sandbox-providers/twitter/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.twitter; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertTrue; - -import java.util.Properties; -import java.util.SortedSet; - -import org.jclouds.Constants; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; -import org.jclouds.twitter.domain.Status; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Tests behavior of {@code TwitterClient} - * - * @author Adrian Cole - */ -@Test(groups = "live", sequential = true) -public class TwitterClientLiveTest { - - protected TwitterClient client; - protected RestContext context; - - protected String provider = "twitter"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; - - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); - credential = System.getProperty("test." + provider + ".credential"); - endpoint = System.getProperty("test." + provider + ".endpoint"); - apiVersion = System.getProperty("test." + provider + ".api-version"); - } - - protected Properties setupProperties() { - Properties overrides = new Properties(); - overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); - overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); - overrides.setProperty(provider + ".identity", identity); - if (credential != null) - overrides.setProperty(provider + ".credential", credential); - if (endpoint != null) - overrides.setProperty(provider + ".endpoint", endpoint); - if (apiVersion != null) - overrides.setProperty(provider + ".api-version", apiVersion); - return overrides; - } - - @BeforeGroups(groups = "live") - public void setupClient() { - setupCredentials(); - Properties overrides = setupProperties(); - - //TODO take this out, when the service is registered in jclouds-core/rest.properties - Properties restProperties = new Properties(); - restProperties.setProperty("twitter.contextbuilder", "org.jclouds.twitter.TwitterContextBuilder"); - restProperties.setProperty("twitter.propertiesbuilder", "org.jclouds.twitter.TwitterPropertiesBuilder"); - - context = new RestContextFactory(restProperties).createContext(provider, ImmutableSet. of(new Log4JLoggingModule()), - overrides); - - client = context.getApi(); - } - - @AfterGroups(groups = "live") - void tearDown() { - if (context != null) - context.close(); - } - - public void testGetMyMentions() throws Exception { - SortedSet response = client.getMyMentions(); - assert null != response; - long mentions = response.size(); - assertTrue(mentions >= 0); - } - -} diff --git a/sandbox-providers/twitter/src/test/resources/log4j.xml b/sandbox-providers/twitter/src/test/resources/log4j.xml deleted file mode 100644 index 34f9bf6995..0000000000 --- a/sandbox-providers/twitter/src/test/resources/log4j.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox-providers/twitter/src/test/resources/test_mentions.json b/sandbox-providers/twitter/src/test/resources/test_mentions.json deleted file mode 100644 index 19e6deb04a..0000000000 --- a/sandbox-providers/twitter/src/test/resources/test_mentions.json +++ /dev/null @@ -1,77 +0,0 @@ -[ { "created_at" : "Sat Oct 31 09:35:27 +0000 2009", - "favorited" : false, - "geo" : null, - "id" : 5310690603, - "in_reply_to_screen_name" : null, - "in_reply_to_status_id" : null, - "in_reply_to_user_id" : null, - "source" : "TweetDeck", - "text" : "RT @jclouds: live multi #cloud demo of jclouds connecting to 3 storage clouds from google appengine http://is.gd/4IXMh", - "truncated" : false, - "user" : { "created_at" : "Tue Apr 28 15:29:42 +0000 2009", - "description" : "Some random guy who seems to care about cloud collisions at siliconANGLE.com", - "favourites_count" : 245, - "followers_count" : 572, - "following" : false, - "friends_count" : 325, - "geo_enabled" : false, - "id" : 36093693, - "location" : "San Francisco ", - "name" : "James Watters", - "notifications" : false, - "profile_background_color" : "C6E2EE", - "profile_background_image_url" : "http://a1.twimg.com/profile_background_images/24067016/17361976.jpg", - "profile_background_tile" : true, - "profile_image_url" : "http://a3.twimg.com/profile_images/445071063/tiktaalik-transitional-fossil_normal.png", - "profile_link_color" : "1F98C7", - "profile_sidebar_border_color" : "C6E2EE", - "profile_sidebar_fill_color" : "DAECF4", - "profile_text_color" : "663B12", - "protected" : false, - "screen_name" : "wattersjames", - "statuses_count" : 1964, - "time_zone" : "Pacific Time (US & Canada)", - "url" : "http://siliconangle.net/ver2/author/jwatters/", - "utc_offset" : -28800, - "verified" : false - } - }, - { "created_at" : "Sat Oct 31 01:45:14 +0000 2009", - "favorited" : false, - "geo" : null, - "id" : 5303839785, - "in_reply_to_screen_name" : null, - "in_reply_to_status_id" : null, - "in_reply_to_user_id" : null, - "source" : "TweetDeck", - "text" : "RT @jclouds: come find out about #cloud storage and how to access it from #java in palo alto this Tuesday: http://is.gd/4IFA9", - "truncated" : false, - "user" : { "created_at" : "Sat Apr 26 06:13:08 +0000 2008", - "description" : "Jack of All Trades: Dad to anZel and Arden, VMware, vCloud, Security, Compliance, Former Developer", - "favourites_count" : 0, - "followers_count" : 474, - "following" : false, - "friends_count" : 199, - "geo_enabled" : false, - "id" : 14540593, - "location" : "Bay Area, CA", - "name" : "Jian Zhen", - "notifications" : false, - "profile_background_color" : "C6E2EE", - "profile_background_image_url" : "http://s.twimg.com/a/1256778767/images/themes/theme2/bg.gif", - "profile_background_tile" : false, - "profile_image_url" : "http://a3.twimg.com/profile_images/64445411/30b8b19_bigger_normal.jpg", - "profile_link_color" : "1F98C7", - "profile_sidebar_border_color" : "C6E2EE", - "profile_sidebar_fill_color" : "DAECF4", - "profile_text_color" : "663B12", - "protected" : false, - "screen_name" : "zhenjl", - "statuses_count" : 1981, - "time_zone" : "Pacific Time (US & Canada)", - "url" : "http://zhen.org", - "utc_offset" : -28800, - "verified" : false - } - } -] \ No newline at end of file diff --git a/sandbox-providers/virtacore-publiccloud-lax/pom.xml b/sandbox-providers/virtacore-publiccloud-lax/pom.xml deleted file mode 100644 index 2c9a3a6808..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.7.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - virtacore-publiccloud-lax - jclouds Virtacore Public Cloud LAX provider - vCloud implementation targeted to Virtacore's LAX datacenter - - - https://cloud.lax.virtacore.com/api/ - 1.0 - 1.5.0.464915 - FIXME_IDENTITY - FIXME_CREDENTIAL - - - org.jclouds.virtacore.publiccloud*;version="${project.version}" - org.jclouds*;version="${project.version}",* - - - - - org.jclouds.api - vcloud - ${project.version} - - - org.jclouds.api - vcloud - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-compute - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - org.jclouds.driver - jclouds-sshj - ${project.version} - test - - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.virtacore-publiccloud-lax.endpoint} - ${test.virtacore-publiccloud-lax.api-version} - ${test.virtacore-publiccloud-lax.build-version} - ${test.virtacore-publiccloud-lax.identity} - ${test.virtacore-publiccloud-lax.credential} - ${test.virtacore-publiccloud-lax.image-id} - ${test.virtacore-publiccloud-lax.image-id} - ${test.virtacore-publiccloud-lax.image.login-user} - ${test.virtacore-publiccloud-lax.image.authenticate-sudo} - - - - - - - - - - - - diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXContextBuilder.java b/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXContextBuilder.java deleted file mode 100644 index 15ce9efcd2..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXContextBuilder.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud; - -import java.util.List; -import java.util.Properties; - -import org.jclouds.vcloud.VCloudContextBuilder; -import org.jclouds.virtacore.publiccloud.config.VirtacorePublicCloudLAXComputeServiceContextModule; -import org.jclouds.virtacore.publiccloud.config.VirtacorePublicCloudLAXRestClientModule; - -import com.google.inject.Module; - -/** - * - * @author Adrian Cole - * - */ -public class VirtacorePublicCloudLAXContextBuilder extends VCloudContextBuilder { - - public VirtacorePublicCloudLAXContextBuilder(Properties props) { - super(props); - } - - @Override - protected void addContextModule(List modules) { - modules.add(new VirtacorePublicCloudLAXComputeServiceContextModule()); - } - - @Override - protected void addClientModule(List modules) { - modules.add(new VirtacorePublicCloudLAXRestClientModule()); - } - -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXPropertiesBuilder.java b/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXPropertiesBuilder.java deleted file mode 100644 index 804de5c84c..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXPropertiesBuilder.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud; - -import static org.jclouds.Constants.PROPERTY_BUILD_VERSION; -import static org.jclouds.Constants.PROPERTY_ENDPOINT; -import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; -import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG; -import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK; - -import java.util.Properties; - -import org.jclouds.vcloud.VCloudPropertiesBuilder; - -/** - * - * @author Adrian Cole - */ -public class VirtacorePublicCloudLAXPropertiesBuilder extends VCloudPropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ISO3166_CODES, "US-CA"); - properties.setProperty(PROPERTY_ENDPOINT, "https://cloud.lax.virtacore.com/api"); - properties.setProperty(PROPERTY_BUILD_VERSION, "1.5.0.464915"); - properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, ".*-Public"); - properties.setProperty(PROPERTY_VCLOUD_DEFAULT_CATALOG, "Virtacore Templates - .*"); - return properties; - } - - public VirtacorePublicCloudLAXPropertiesBuilder(Properties properties) { - super(properties); - } -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderMetadata.java b/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderMetadata.java deleted file mode 100644 index 1f06295497..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderMetadata.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud; - -import com.google.common.collect.ImmutableSet; - -import java.net.URI; -import java.util.Set; - -import org.jclouds.providers.BaseProviderMetadata; -import org.jclouds.providers.ProviderMetadata; - -/** - * Implementation of {@link org.jclouds.types.ProviderMetadata} for Virtacore Public Cloud LAX - * - * @author Adrian Cole - */ -public class VirtacorePublicCloudLAXProviderMetadata extends BaseProviderMetadata { - - /** - * {@inheritDoc} - */ - @Override - public String getId() { - return "virtacore-publiccloud-lax"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getType() { - return ProviderMetadata.COMPUTE_TYPE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return "Virtacore Public Cloud LAX"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getIdentityName() { - return "User at Organization (user@org)"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getCredentialName() { - return "Password"; - } - - /** - * {@inheritDoc} - */ - @Override - public URI getHomepage() { - return URI.create("http://www.virtacore.com/vcloud_express.cfm"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getConsole() { - return URI.create("https://www.virtacore.com/vcloudlogin.cfm"); - } - - /** - * {@inheritDoc} - */ - @Override - public URI getApiDocumentation() { - return URI.create("http://kb.virtacore.com/questions/100/Does+the+Virtacore+Public+Cloud+have+an+API%3F"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getLinkedServices() { - return ImmutableSet.of("virtacore-publiccloud-lax", "virtacore-publiccloud-iad"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getIso3166Codes() { - return ImmutableSet.of("US-CA"); - } - -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXComputeServiceContextModule.java b/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXComputeServiceContextModule.java deleted file mode 100644 index d139aafe4c..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXComputeServiceContextModule.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud.config; - -import static org.jclouds.compute.domain.OsFamily.RHEL; - -import org.jclouds.compute.domain.TemplateBuilder; -import org.jclouds.compute.options.TemplateOptions; -import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule; -import org.jclouds.vcloud.compute.options.VCloudTemplateOptions; -import org.jclouds.vcloud.domain.network.IpAddressAllocationMode; - -import com.google.inject.Injector; - -/** - * - * @author Adrian Cole - */ -public class VirtacorePublicCloudLAXComputeServiceContextModule extends VCloudComputeServiceContextModule { - - // CIM ostype does not include version info - @Override - protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { - return template.osFamily(RHEL).os64Bit(true); - } - - @Override - protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) { - return options.as(VCloudTemplateOptions.class).ipAddressAllocationMode(IpAddressAllocationMode.POOL); - } -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXRestClientModule.java b/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXRestClientModule.java deleted file mode 100644 index e089e92928..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/main/java/org/jclouds/virtacore/publiccloud/config/VirtacorePublicCloudLAXRestClientModule.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud.config; - -import org.jclouds.http.RequiresHttp; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.vcloud.config.VCloudRestClientModule; - -/** - * - * @author Adrian Cole - */ -@RequiresHttp -@ConfiguresRestClient -public class VirtacorePublicCloudLAXRestClientModule extends VCloudRestClientModule { - - @Override - protected void configure() { - super.configure(); - } - -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/sandbox-providers/virtacore-publiccloud-lax/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index 5290e8f3d0..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.virtacore.publiccloud.VirtacorePublicCloudLAXProviderMetadata diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderTest.java b/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderTest.java deleted file mode 100644 index 687b7d91f9..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/VirtacorePublicCloudLAXProviderTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud; - -import org.jclouds.providers.BaseProviderMetadataTest; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.virtacore.publiccloud.VirtacorePublicCloudLAXProviderMetadata; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "VirtacorePublicCloudLAXProviderTest") -public class VirtacorePublicCloudLAXProviderTest extends BaseProviderMetadataTest { - - public VirtacorePublicCloudLAXProviderTest() { - super(new VirtacorePublicCloudLAXProviderMetadata(), ProviderMetadata.COMPUTE_TYPE); - } -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXComputeServiceLiveTest.java b/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXComputeServiceLiveTest.java deleted file mode 100644 index ae8c1531b7..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXComputeServiceLiveTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud.compute; - -import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest; -import org.testng.annotations.Test; - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, singleThreaded = true) -public class VirtacorePublicCloudLAXComputeServiceLiveTest extends VCloudComputeServiceLiveTest { - public VirtacorePublicCloudLAXComputeServiceLiveTest() { - provider = "virtacore-publiccloud-lax"; - } - -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXTemplateBuilderLiveTest.java b/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXTemplateBuilderLiveTest.java deleted file mode 100644 index 4f8b410ce6..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/test/java/org/jclouds/virtacore/publiccloud/compute/VirtacorePublicCloudLAXTemplateBuilderLiveTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.virtacore.publiccloud.compute; - -import static org.jclouds.compute.util.ComputeServiceUtils.getCores; -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.util.Set; - -import org.jclouds.compute.BaseTemplateBuilderLiveTest; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.domain.OsFamilyVersion64Bit; -import org.jclouds.compute.domain.Template; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableSet; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live") -public class VirtacorePublicCloudLAXTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { - - public VirtacorePublicCloudLAXTemplateBuilderLiveTest() { - provider = "virtacore-publiccloud-lax"; - } - - @Override - protected Predicate defineUnsupportedOperatingSystems() { - return Predicates.not(new Predicate() { - - @Override - public boolean apply(OsFamilyVersion64Bit input) { - switch (input.family) { - case RHEL: - return input.version.equals(""); - case SUSE: - // vCloud Connector - return input.version.equals("") && input.is64Bit; - default: - return false; - } - } - - }); - } - - // NOTE: almost all virtacore templates are dual-network - @Override - public void testDefaultTemplateBuilder() throws IOException { - Template defaultTemplate = context.getComputeService().templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getName(), "RHEL 5.6 64bit"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), ""); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.RHEL); - assertEquals(getCores(defaultTemplate.getHardware()), 2.0d); - } - - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("US-CA"); - } -} diff --git a/sandbox-providers/virtacore-publiccloud-lax/src/test/resources/log4j.xml b/sandbox-providers/virtacore-publiccloud-lax/src/test/resources/log4j.xml deleted file mode 100644 index 63810d3ca0..0000000000 --- a/sandbox-providers/virtacore-publiccloud-lax/src/test/resources/log4j.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -