You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Ryan MacDowell (JIRA)" <ji...@apache.org> on 2016/07/29 23:24:20 UTC

[jira] [Created] (JCLOUDS-1146) BlobStoreContext and BlobStore break reflexive propety of object equals

Ryan MacDowell created JCLOUDS-1146:
---------------------------------------

             Summary: 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


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)