JCLOUDS-740 GCE doesn't always return id, selfLink on lists. Also, internally buffering an Iterable with a Set < with a List.

This commit is contained in:
Adrian Cole 2014-10-02 19:32:15 -07:00 committed by Adrian Cole
parent d4c7c838e8
commit 308e3d1e49
3 changed files with 5 additions and 9 deletions

View File

@ -30,6 +30,7 @@ import org.jclouds.googlecloudstorage.domain.Resource.Kind;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -47,7 +48,7 @@ public class ListPage<T> extends IterableWithMarker<T> {
this.kind = checkNotNull(kind, "kind"); this.kind = checkNotNull(kind, "kind");
this.nextPageToken = nextPageToken; this.nextPageToken = nextPageToken;
this.items = items != null ? ImmutableSet.copyOf(items) : ImmutableSet.<T> of(); this.items = items != null ? ImmutableList.copyOf(items) : ImmutableList.<T> of();
this.prefixes = prefixes != null ? prefixes : ImmutableSet.<String> of(); this.prefixes = prefixes != null ? prefixes : ImmutableSet.<String> of();
} }
@ -110,7 +111,7 @@ public class ListPage<T> extends IterableWithMarker<T> {
private Kind kind; private Kind kind;
private String nextPageToken; private String nextPageToken;
private ImmutableSet.Builder<T> items = ImmutableSet.builder(); private ImmutableList.Builder<T> items = ImmutableList.builder();
private ImmutableSet.Builder<String> prefixes = ImmutableSet.builder(); private ImmutableSet.Builder<String> prefixes = ImmutableSet.builder();
public Builder<T> kind(Kind kind) { public Builder<T> kind(Kind kind) {

View File

@ -27,8 +27,6 @@ import org.jclouds.googlecloudstorage.domain.internal.ProjectTeam;
import org.jclouds.googlecloudstorage.domain.internal.ProjectTeam.Team; import org.jclouds.googlecloudstorage.domain.internal.ProjectTeam.Team;
import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest; import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
import com.google.common.collect.ImmutableSet;
public class DefaultObjectAclListTest extends BaseGoogleCloudStorageParseTest<ListDefaultObjectAccessControls> { public class DefaultObjectAclListTest extends BaseGoogleCloudStorageParseTest<ListDefaultObjectAccessControls> {
private DefaultObjectAccessControls item_1 = DefaultObjectAccessControls.builder() private DefaultObjectAccessControls item_1 = DefaultObjectAccessControls.builder()
@ -44,7 +42,6 @@ public class DefaultObjectAclListTest extends BaseGoogleCloudStorageParseTest<Li
@Override @Override
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public ListDefaultObjectAccessControls expected() { public ListDefaultObjectAccessControls expected() {
return ListDefaultObjectAccessControls.builder().kind(Kind.OBJECT_ACCESS_CONTROLS).items(ImmutableSet.of(item_1)) return ListDefaultObjectAccessControls.builder().kind(Kind.OBJECT_ACCESS_CONTROLS).addItems(item_1).build();
.build();
} }
} }

View File

@ -27,8 +27,6 @@ import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
import org.jclouds.googlecloudstorage.domain.Resource.Kind; import org.jclouds.googlecloudstorage.domain.Resource.Kind;
import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest; import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
import com.google.common.collect.ImmutableSet;
public class ObjectAclListTest extends BaseGoogleCloudStorageParseTest<ListObjectAccessControls> { public class ObjectAclListTest extends BaseGoogleCloudStorageParseTest<ListObjectAccessControls> {
private ObjectAccessControls item1 = ObjectAccessControls private ObjectAccessControls item1 = ObjectAccessControls
@ -49,7 +47,7 @@ public class ObjectAclListTest extends BaseGoogleCloudStorageParseTest<ListObjec
@Override @Override
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public ListObjectAccessControls expected() { public ListObjectAccessControls expected() {
return ListObjectAccessControls.builder().kind(Kind.OBJECT_ACCESS_CONTROLS).items(ImmutableSet.of(item1)).build(); return ListObjectAccessControls.builder().kind(Kind.OBJECT_ACCESS_CONTROLS).addItems(item1).build();
} }
} }