[ 
https://issues.apache.org/jira/browse/JCLOUDS-1146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ryan MacDowell updated JCLOUDS-1146:
------------------------------------
    Attachment: ReflexiveTest.java

> BlobStoreContext and BlobStore break reflexive propety of object equals
> -----------------------------------------------------------------------
>
>                 Key: JCLOUDS-1146
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1146
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 1.9.2
>            Reporter: Ryan MacDowell
>         Attachments: ReflexiveTest.java
>
>
> Create a BlobStoreContext, call the equals method on it and pass in itself, 
> the result should be true but it is false.  
> Get the BlobStore from a context and call the equals method on it and pass in 
> itself, the result should be true but is false with certain providers e.g. 
> "transient", "azureBlob".
> From the javadoc
> {quote}
> Indicates whether some other object is "equal to" this one.
> The equals method implements an equivalence relation on non-null object 
> references:
> It is reflexive: for any non-null reference value x, x.equals\(x\) should 
> return true.
> {quote}
> {code:java|title=ReflexiveTest.java|borderStyle=solid}
> import org.jclouds.ContextBuilder;
> import org.jclouds.blobstore.BlobStore;
> import org.jclouds.blobstore.BlobStoreContext;
> //Test for equals behavior
> public class ReflexiveTest {
>       public static void main(String[] args) {
>               BlobStoreContext context = 
> ContextBuilder.newBuilder("azureblob")
>                               .credentials("someId", "someKey")
>                               .build(BlobStoreContext.class);
>               System.out.println("Context should equal itself " + 
> context.equals(context));
>               BlobStore store = context.getBlobStore();
>               System.out.println("Store should equal itself " + 
> store.equals(store));
>       }
> }
> {code}
> From my tests azureBlob and transient never equals itself, yet somehow aws-s3 
> BlobStores equal themselves, but not BlobStoreContext.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to