LocalStorageHelper UnsupportedOperationException
See original GitHub issueHi,
I try to create some basic testing for Google Cloud Storage. I followed the instructions and tried to create a new bucket.
Storage storage = LocalStorageHelper.getOptions().getService();
storage.create(BucketInfo.newBuilder(BUCKET_NAME).build());
This throws:
com.google.cloud.storage.StorageException: java.lang.UnsupportedOperationException
at com.google.cloud.storage.StorageException.translateAndThrow(StorageException.java:71)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:114)
at DbAnalyzerTest.testAnalyzer(DbAnalyzerTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.UnsupportedOperationException
at com.google.cloud.storage.contrib.nio.testing.FakeStorageRpc.create(FakeStorageRpc.java:96)
at com.google.cloud.storage.StorageImpl$2.call(StorageImpl.java:110)
at com.google.cloud.storage.StorageImpl$2.call(StorageImpl.java:107)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:93)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:49)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:106)
... 29 more
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
com.google.cloud.storage.contrib.nio.testing.FakeStorageRpc ...
LocalStorageHelper $2.create(...) ... ID)) { throw new UnsupportedOperationException(); } String key = fullname(object); if (metadata.
Read more >Class CloudStorageFileSystemProvider (0.124.19) | Java ...
Throws UnsupportedOperationException because this feature hasn't been implemented yet. Parameter. Name, Description. path, Path. Returns ...
Read more >UnsupportedOperationException (Java Platform SE 8 )
Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class...
Read more >LocalStorageHelper (Google Cloud 0.90.0-alpha API)
public final class LocalStorageHelper extends Object. Utility to create an in-memory storage configuration for testing. Storage options can be obtained via ...
Read more >java.nio.file.FileSystem Example - Program Talk
catch (UnsupportedOperationException e) {. if (log.isDebugEnabled()) { ... setDefault(StorageOptions. class , LocalStorageHelper.options());. tester.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Answering my own question:
Is there is single example somewhere what should actually work? It would be awesome to expand https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/TESTING.md#on-your-machine-2 a bit. I don’t understand how I will be able to get any object, if I can get the bucket first. Typical code is:
Having an example or a test for this under https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-contrib/google-cloud-nio/src would also help. Maybe you can also comment on my the api operates on classes from
com.google.api.services.storage.model.*
; instead ofcom.google.cloud.storage.*
(e.g. StorageObject).