You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2013/08/02 23:30:25 UTC
[4/6] Removing OpenStack modules from Labs repo (now in
jclouds-labs-openstack)
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java
deleted file mode 100644
index 02ac8d3..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApi.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0;
-
-import java.util.Set;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.Zone;
-import org.jclouds.location.functions.ZoneToEndpoint;
-import org.jclouds.openstack.quantum.v1_0.features.NetworkApi;
-import org.jclouds.openstack.quantum.v1_0.features.PortApi;
-import org.jclouds.openstack.v2_0.features.ExtensionApi;
-import org.jclouds.rest.annotations.Delegate;
-import org.jclouds.rest.annotations.EndpointParam;
-
-import com.google.inject.Provides;
-
-import java.io.Closeable;
-
-/**
- * Provides access to Quantum.
- * <p/>
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content">api doc</a>
- */
-public interface QuantumApi extends Closeable {
- /**
- * @return the Zone codes configured
- */
- @Provides
- @Zone
- Set<String> getConfiguredZones();
-
- /**
- * Provides access to Extension features.
- */
- @Delegate
- ExtensionApi getExtensionApiForZone(
- @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides access to Network features.
- */
- @Delegate
- NetworkApi getNetworkApiForZone(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
-
- /**
- * Provides access to Port features.
- */
- @Delegate
- @Path("/networks/{net}")
- PortApi getPortApiForZoneAndNetwork(@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone,
- @PathParam("net") String networkId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java
deleted file mode 100644
index de79814..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0;
-
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
-import java.net.URI;
-import java.util.Properties;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
-import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
-import org.jclouds.openstack.quantum.v1_0.config.QuantumHttpApiModule;
-import org.jclouds.openstack.v2_0.ServiceType;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for Quantum 1.0 API
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- */
-public class QuantumApiMetadata extends BaseHttpApiMetadata<QuantumApi> {
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public QuantumApiMetadata() {
- this(new Builder());
- }
-
- protected QuantumApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseHttpApiMetadata.defaultProperties();
- properties.setProperty(SERVICE_TYPE, ServiceType.NETWORK);
- properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS);
- return properties;
- }
-
- public static class Builder extends BaseHttpApiMetadata.Builder<QuantumApi, Builder> {
-
- protected Builder() {
- id("openstack-quantum")
- .name("OpenStack Quantum API")
- .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant")
- .credentialName("${password}")
- .endpointName("KeyStone base url ending in /v2.0/")
- .documentation(URI.create("http://docs.openstack.org/api/openstack-network/1.0/content/"))
- .version("1.0")
- .defaultEndpoint("http://localhost:5000/v2.0/")
- .defaultProperties(QuantumApiMetadata.defaultProperties())
- .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(AuthenticationApiModule.class)
- .add(KeystoneAuthenticationModule.class)
- .add(ZoneModule.class)
- .add(QuantumHttpApiModule.class).build());
- }
-
- @Override
- public QuantumApiMetadata build() {
- return new QuantumApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java
deleted file mode 100644
index 384f6b2..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumHttpApiModule.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.config;
-
-import java.net.URI;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.openstack.quantum.v1_0.QuantumApi;
-import org.jclouds.openstack.quantum.v1_0.handlers.QuantumErrorHandler;
-import org.jclouds.openstack.v2_0.domain.Extension;
-import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.config.HttpApiModule;
-import org.jclouds.rest.functions.ImplicitOptionalConverter;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-import com.google.inject.Provides;
-
-/**
- * Configures the Quantum connection.
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- */
-@ConfiguresHttpApi
-public class QuantumHttpApiModule extends HttpApiModule<QuantumApi> {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
- super.configure();
- }
-
- @Provides
- @Singleton
- public Multimap<URI, URI> aliases() {
- return ImmutableMultimap.<URI, URI>builder()
- .build();
- }
-
- @Provides
- @Singleton
- public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<QuantumApi> quantumApi) {
- return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
- .build(new CacheLoader<String, Set<? extends Extension>>() {
- @Override
- public Set<? extends Extension> load(String key) throws Exception {
- return quantumApi.get().getExtensionApiForZone(key).list();
- }
- });
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(QuantumErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(QuantumErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(QuantumErrorHandler.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java
deleted file mode 100644
index 48e7dec..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/config/QuantumProperties.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.config;
-
-/**
- * Configuration properties and constants used in openstack Quantum connections.
- *
- * @author Adam Lowe
- */
-public class QuantumProperties {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java
deleted file mode 100644
index 42d41b5..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Attachment.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import java.beans.ConstructorProperties;
-
-/**
- * A Quantum attachment
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Attachments.html">api doc</a>
-*/
-public class Attachment extends Reference {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromAttachment(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Reference.Builder<T> {
-
- public Attachment build() {
- return new Attachment(id);
- }
-
- public T fromAttachment(Attachment in) {
- return super.fromReference(in);
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
-
- @ConstructorProperties({
- "id"
- })
- protected Attachment(String id) {
- super(id);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java
deleted file mode 100644
index 6012b09..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Network.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A Quantum network
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Networks.html">api doc</a>
-*/
-public class Network extends Reference {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromNetwork(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Reference.Builder<T> {
- protected String name;
-
- /**
- * @see Network#getName()
- */
- public T name(String name) {
- this.name = name;
- return self();
- }
-
- public Network build() {
- return new Network(id, name);
- }
-
- public T fromNetwork(Network in) {
- return super.fromReference(in)
- .name(in.getName());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String name;
-
- @ConstructorProperties({
- "id", "name"
- })
- protected Network(String id, String name) {
- super(id);
- this.name = checkNotNull(name, "name");
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), name);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Network that = Network.class.cast(obj);
- return super.equals(that) && Objects.equal(this.name, that.name);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("name", name);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java
deleted file mode 100644
index 54808d0..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/NetworkDetails.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Details of a Quantum network
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Networks.html">api doc</a>
-*/
-public class NetworkDetails extends Network {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromNetworkDetails(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Network.Builder<T> {
- protected Set<Port> ports = ImmutableSet.of();
-
- /**
- * @see NetworkDetails#getPorts()
- */
- public T ports(Set<Port> ports) {
- this.ports = ImmutableSet.copyOf(checkNotNull(ports, "ports"));
- return self();
- }
-
- public T ports(Port... in) {
- return ports(ImmutableSet.copyOf(in));
- }
-
- public NetworkDetails build() {
- return new NetworkDetails(id, name, ports);
- }
-
- public T fromNetworkDetails(NetworkDetails in) {
- return super.fromNetwork(in)
- .ports(in.getPorts());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Set<Port> ports;
-
- @ConstructorProperties({
- "id", "name", "ports"
- })
- protected NetworkDetails(String id, String name, Set<Port> ports) {
- super(id, name);
- this.ports = ImmutableSet.copyOf(checkNotNull(ports, "ports"));
- }
-
- public Set<Port> getPorts() {
- return this.ports;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(ports);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- NetworkDetails that = NetworkDetails.class.cast(obj);
- return super.equals(that) && Objects.equal(this.ports, that.ports);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("ports", ports);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java
deleted file mode 100644
index 53c5fc4..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Port.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A Quantum port
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api doc</a>
-*/
-public class Port extends Reference {
-
- /**
- */
- public static enum State {
- ACTIVE, DOWN
- }
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromPort(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Reference.Builder<T> {
- protected Port.State state;
-
- /**
- * @see Port#getState()
- */
- public T state(Port.State state) {
- this.state = state;
- return self();
- }
-
- public Port build() {
- return new Port(id, state);
- }
-
- public T fromPort(Port in) {
- return super.fromReference(in)
- .state(in.getState());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Port.State state;
-
- @ConstructorProperties({
- "id", "state"
- })
- protected Port(String id, Port.State state) {
- super(id);
- this.state = checkNotNull(state, "state");
- }
-
- public Port.State getState() {
- return this.state;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(state);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Port that = Port.class.cast(obj);
- return super.equals(that) && Objects.equal(this.state, that.state);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("state", state);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java
deleted file mode 100644
index d02275e..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/PortDetails.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import java.beans.ConstructorProperties;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Details of a Quantum Port
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api doc</a>
-*/
-public class PortDetails extends Port {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromPortDetails(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Port.Builder<T> {
- protected Attachment attachment;
-
- /**
- * @see PortDetails#getAttachment()
- */
- public T attachment(Attachment attachment) {
- this.attachment = attachment;
- return self();
- }
-
- public PortDetails build() {
- return new PortDetails(id, state, attachment);
- }
-
- public T fromPortDetails(PortDetails in) {
- return super.fromPort(in)
- .attachment(in.getAttachment());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final Attachment attachment;
-
- @ConstructorProperties({
- "id", "state", "attachment"
- })
- protected PortDetails(String id, Port.State state, @Nullable Attachment attachment) {
- super(id, state);
- this.attachment = attachment;
- }
-
- @Nullable
- public Attachment getAttachment() {
- return this.attachment;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(attachment);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- PortDetails that = PortDetails.class.cast(obj);
- return super.equals(that) && Objects.equal(this.attachment, that.attachment);
- }
-
- protected ToStringHelper string() {
- return super.string()
- .add("attachment", attachment);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Reference.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Reference.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Reference.java
deleted file mode 100644
index 9b34bd6..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/domain/Reference.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.beans.ConstructorProperties;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * A wrapper around an id in the quantum api
- *
- * @author Adam Lowe
- * @see <a href="http://docs.openstack.org/api/openstack-network/1.0/content/Networks.html">api doc</a>
-*/
-public class Reference {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromReference(this);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String id;
-
- /**
- * @see Reference#getId()
- */
- public T id(String id) {
- this.id = id;
- return self();
- }
-
- public Reference build() {
- return new Reference(id);
- }
-
- public T fromReference(Reference in) {
- return this
- .id(in.getId());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String id;
-
- @ConstructorProperties({
- "id"
- })
- protected Reference(String id) {
- this.id = checkNotNull(id, "id");
- }
-
- public String getId() {
- return this.id;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- Reference that = Reference.class.cast(obj);
- return Objects.equal(this.id, that.id);
- }
-
- protected ToStringHelper string() {
- return Objects.toStringHelper(this)
- .add("id", id);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java
deleted file mode 100644
index 5076687..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.features;
-
-import javax.ws.rs.Consumes;
-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 javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.quantum.v1_0.domain.Network;
-import org.jclouds.openstack.quantum.v1_0.domain.NetworkDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Reference;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Network operations on the openstack quantum API.
- * <p/>
- * Each tenant can define one or more networks. A network is a virtual isolated layer-2 broadcast domain reserved to the
- * tenant. A tenant can create several ports for a network, and plug virtual interfaces into these ports.
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-network/1.0/content/Networks.html">api doc</a>
- */
-
-@RequestFilters(AuthenticateRequest.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/networks")
-public interface NetworkApi {
-
- /**
- * Returns the list of all networks currently defined in Quantum for the current tenant. The list provides the unique
- * identifier of each network configured for the tenant.
- */
- @GET
- @SelectJson("networks")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- FluentIterable<? extends Reference> listReferences();
-
- /**
- * Returns all networks currently defined in Quantum for the current tenant.
- */
- @GET
- @SelectJson("networks")
- @Path("/detail")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- FluentIterable<? extends Network> list();
-
- /**
- * Returns the specific network.
- */
- @GET
- @SelectJson("network")
- @Path("/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- Network get(@PathParam("id") String id);
-
- /**
- * Returns the details of the specific network.
- */
- @GET
- @SelectJson("network")
- @Path("/{id}/detail")
- @Fallback(NullOnNotFoundOr404.class)
- NetworkDetails getDetails(@PathParam("id") String id);
-
- /**
- * Create a new network with the specified symbolic name
- */
- @POST
- @SelectJson("network")
- @Produces(MediaType.APPLICATION_JSON)
- @WrapWith("network")
- Reference create(@PayloadParam("name") String name);
-
- /**
- * Adjusts the symbolic name of a network
- *
- * @param id the id of the Network to modify
- * @param name the new name for the Network
- */
- @PUT
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/{id}")
- @WrapWith("network")
- boolean rename(@PathParam("id") String id, @PayloadParam("name") String name);
-
- /**
- * Deletes the specified network
- */
- @DELETE
- @Path("/{id}")
- boolean delete(@PathParam("id") String id);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java
deleted file mode 100644
index 209449e..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.features;
-
-import javax.ws.rs.Consumes;
-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.core.MediaType;
-import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.quantum.v1_0.domain.Attachment;
-import org.jclouds.openstack.quantum.v1_0.domain.Port;
-import org.jclouds.openstack.quantum.v1_0.domain.PortDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Reference;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.WrapWith;
-
-import com.google.common.collect.FluentIterable;
-
-/**
- * Provides synchronous access to Port operations on the openstack quantum API.
- * <p/>
- * A port represents a virtual switch port on a logical network switch where all the interfaces attached to a given network are connected.
- * <p/>
- * A port has an administrative state which is either 'DOWN' or 'ACTIVE'. Ports which are administratively down will not be able to receive/send traffic.
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-network/1.0/content/Ports.html">api doc</a>
- */
-@RequestFilters(AuthenticateRequest.class)
-@Consumes(MediaType.APPLICATION_JSON)
-@Path("/ports")
-public interface PortApi {
- /**
- * Returns the list of all ports currently defined in Quantum for the requested network
- */
- @GET
- @SelectJson("ports")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- FluentIterable<? extends Reference> listReferences();
-
- /**
- * Returns the set of ports currently defined in Quantum for the requested network.
- */
- @GET
- @SelectJson("ports")
- @Path("/detail")
- @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
- FluentIterable<? extends Port> list();
-
- /**
- * Returns a specific port.
- */
- @GET
- @SelectJson("port")
- @Path("/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- Port get(@PathParam("id") String id);
-
- /**
- * Returns a specific port in detail.
- */
- @GET
- @SelectJson("port")
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/{id}/detail")
- @Fallback(NullOnNotFoundOr404.class)
- PortDetails getDetails(@PathParam("id") String id);
-
- /**
- * Create a new port on the specified network
- */
- @POST
- @SelectJson("port")
- Reference create();
-
- /**
- * Create a new port on the specified network, with the requested state
- */
- @POST
- @SelectJson("port")
- @WrapWith("port")
- Reference create(@PayloadParam("state") Port.State state);
-
- /**
- * Updates the state of a port
- */
- @PUT
- @Path("/{id}")
- @WrapWith("port")
- boolean updateState(@PathParam("id") String id, @PayloadParam("state") Port.State state);
-
- /**
- * Deletes a port from a network
- */
- @DELETE
- @Path("/{id}")
- boolean delete(@PathParam("id") String id);
-
- /**
- * Returns the attachment for the specified port.
- */
- @GET
- @SelectJson("attachment")
- @Path("/{id}/attachment")
- @Fallback(NullOnNotFoundOr404.class)
- Attachment showAttachment(@PathParam("id") String portId);
-
- /**
- * Plugs an attachment into the specified port
- */
- @PUT
- @Path("/{id}/attachment")
- @WrapWith("attachment")
- boolean plugAttachment(@PathParam("id") String portId, @PayloadParam("id") String attachmentId);
-
- /**
- * Unplugs the attachment currently plugged into the specified port
- */
- @DELETE
- @Path("{id}/attachment")
- boolean unplugAttachment(@PathParam("id") String portId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/handlers/QuantumErrorHandler.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/handlers/QuantumErrorHandler.java b/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/handlers/QuantumErrorHandler.java
deleted file mode 100644
index f0845de..0000000
--- a/openstack/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/handlers/QuantumErrorHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.handlers;
-
-import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
-
-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.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- *
- * @author Adam Lowe
- *
- */
-// TODO: is there error spec someplace? let's type errors, etc.
-@Singleton
-public class QuantumErrorHandler implements HttpErrorHandler {
- public void handleError(HttpCommand command, HttpResponse response) {
- // it is important to always read fully and close streams
- byte[] data = closeClientButKeepContentStream(response);
- String message = data != null ? new String(data) : null;
-
- Exception exception = message != null ? new HttpResponseException(command, response, message)
- : new HttpResponseException(command, response);
- message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
- response.getStatusLine());
- switch (response.getStatusCode()) {
- case 400:
- break;
- case 401:
- case 403:
- exception = new AuthorizationException(message, exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- }
- command.setException(exception);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/openstack/openstack-quantum/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
deleted file mode 100644
index ebd176c..0000000
--- a/openstack/openstack-quantum/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.openstack.quantum.v1_0.QuantumApiMetadata
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadataTest.java b/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadataTest.java
deleted file mode 100644
index 888f03f..0000000
--- a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadataTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0;
-
-import org.jclouds.View;
-import org.jclouds.apis.internal.BaseApiMetadataTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
-
-/**
- *
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "QuantumApiMetadataTest")
-public class QuantumApiMetadataTest extends BaseApiMetadataTest {
- public QuantumApiMetadataTest() {
- super(new QuantumApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java b/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java
deleted file mode 100644
index 7b19d6b..0000000
--- a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.quantum.v1_0.domain.Network;
-import org.jclouds.openstack.quantum.v1_0.domain.NetworkDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Reference;
-import org.jclouds.openstack.quantum.v1_0.internal.BaseQuantumApiExpectTest;
-import org.jclouds.openstack.quantum.v1_0.parse.ParseNetworkDetailsTest;
-import org.jclouds.openstack.quantum.v1_0.parse.ParseNetworkTest;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests parsing and Guice wiring of NetworkApi
- *
- * @author Adam Lowe
- */
-@Test(groups="unit", testName = "NetworkApiExpectTest")
-public class NetworkApiExpectTest extends BaseQuantumApiExpectTest {
-
- public void testListReferencesReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_network_refs.json", APPLICATION_JSON)).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- Set<? extends Reference> nets = api.listReferences().toSet();
- assertEquals(nets, listOfNetworkRefs());
- }
-
- public void testListReferencesReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks").build(),
- HttpResponse.builder().statusCode(404).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- assertTrue(api.listReferences().isEmpty());
- }
-
- public void testListReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/detail").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- Set<? extends Network> nets = api.list().toSet();
- assertEquals(nets, listOfNetworks());
- }
-
- public void testListReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/detail").build(),
- HttpResponse.builder().statusCode(404).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- assertTrue(api.list().isEmpty());
- }
-
- public void testShowReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/network.json", APPLICATION_JSON)).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- Network net = api.get("16dba3bc-f3fa-4775-afdc-237e12c72f6a");
- assertEquals(net, new ParseNetworkTest().expected());
- }
-
- public void testShowReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
- HttpResponse.builder().statusCode(404).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- assertNull(api.get("16dba3bc-f3fa-4775-afdc-237e12c72f6a"));
- }
-
- public void testShowDetailsReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/detail").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/network_details.json", APPLICATION_JSON)).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- NetworkDetails net = api.getDetails("16dba3bc-f3fa-4775-afdc-237e12c72f6a");
- assertEquals(net, new ParseNetworkDetailsTest().expected());
- }
-
- public void testShowDetailsReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/detail").build(),
- HttpResponse.builder().statusCode(404).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- assertNull(api.getDetails("16dba3bc-f3fa-4775-afdc-237e12c72f6a"));
- }
-
- public void testCreateReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks").method("POST")
- .payload(payloadFromStringWithContentType("{\"network\":{\"name\":\"another-test\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"network\":{\"id\":\"12345\"}}", APPLICATION_JSON)).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- Reference net = api.create("another-test");
- assertEquals(net, Reference.builder().id("12345").build());
- }
-
- @Test(expectedExceptions = AuthorizationException.class)
- public void testCreateReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks").method("POST")
- .payload(payloadFromStringWithContentType("{\"network\":{\"name\":\"another-test\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(401).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- api.create("another-test");
- }
-
- public void testUpdateReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/12345").method("PUT")
- .payload(payloadFromStringWithContentType("{\"network\":{\"name\":\"another-test\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- assertTrue(api.rename("12345", "another-test"));
- }
-
- @Test(expectedExceptions = ResourceNotFoundException.class)
- public void testUpdateReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/12345").method("PUT")
- .payload(payloadFromStringWithContentType("{\"network\":{\"name\":\"another-test\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(404).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- api.rename("12345", "another-test");
- }
-
- public void testDeleteReturns2xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/12345").method("DELETE").build(),
- HttpResponse.builder().statusCode(200).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- assertTrue(api.delete("12345"));
- }
-
- @Test(expectedExceptions = AuthorizationException.class)
- public void testDeleteReturns4xx() {
- NetworkApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/12345").method("DELETE").build(),
- HttpResponse.builder().statusCode(403).build())
- .getNetworkApiForZone("region-a.geo-1");
-
- api.delete("12345");
- }
-
- protected Set<Reference> listOfNetworkRefs() {
- return ImmutableSet.of(
- Reference.builder().id("16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
- Reference.builder().id("1a104cf5-cb18-4d35-9407-2fd2646d9d0b").build(),
- Reference.builder().id("31083ae2-420d-48b2-ac98-9f7a4fd8dbdc").build(),
- Reference.builder().id("49c6d6fa-ff2a-459d-b975-75a8d31c9a89").build(),
- Reference.builder().id("5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e").build(),
- Reference.builder().id("5d51d012-3491-4db7-b1b5-6f254015015d").build(),
- Reference.builder().id("5f9cf7dc-22ca-4097-8e49-1cc8b23faf17").build(),
- Reference.builder().id("6319ecad-6bff-48b2-9b53-02ede8cb7588").build(),
- Reference.builder().id("6ba4c788-661f-49ab-9bf8-5f10cbbb2f57").build(),
- Reference.builder().id("74ed170b-5069-4353-ab38-9719766dc57e").build(),
- Reference.builder().id("b71fcac1-e864-4031-8c5b-edbecd9ece36").build(),
- Reference.builder().id("c7681895-d84d-4650-9ca0-82c72036b855").build()
- );
- }
-
- protected Set<Network> listOfNetworks() {
- return ImmutableSet.of(
- Network.builder().name("jclouds-port-test").id("16dba3bc-f3fa-4775-afdc-237e12c72f6a").build(),
- Network.builder().name("wibble").id("1a104cf5-cb18-4d35-9407-2fd2646d9d0b").build(),
- Network.builder().name("jclouds-test").id("31083ae2-420d-48b2-ac98-9f7a4fd8dbdc").build(),
- Network.builder().name("jclouds-test").id("49c6d6fa-ff2a-459d-b975-75a8d31c9a89").build(),
- Network.builder().name("wibble").id("5cb3d6f4-62cb-41c9-b964-ba7d9df79e4e").build(),
- Network.builder().name("jclouds-port-test").id("5d51d012-3491-4db7-b1b5-6f254015015d").build(),
- Network.builder().name("wibble").id("5f9cf7dc-22ca-4097-8e49-1cc8b23faf17").build(),
- Network.builder().name("jclouds-test").id("6319ecad-6bff-48b2-9b53-02ede8cb7588").build(),
- Network.builder().name("jclouds-port-test").id("6ba4c788-661f-49ab-9bf8-5f10cbbb2f57").build(),
- Network.builder().name("jclouds-test").id("74ed170b-5069-4353-ab38-9719766dc57e").build(),
- Network.builder().name("wibble").id("b71fcac1-e864-4031-8c5b-edbecd9ece36").build(),
- Network.builder().name("jclouds-port-test").id("c7681895-d84d-4650-9ca0-82c72036b855").build()
- );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java b/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java
deleted file mode 100644
index 8cfe56a..0000000
--- a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.jclouds.openstack.quantum.v1_0.domain.Network;
-import org.jclouds.openstack.quantum.v1_0.domain.NetworkDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Reference;
-import org.jclouds.openstack.quantum.v1_0.internal.BaseQuantumApiLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Tests NetworkApi
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- */
-@Test(groups = "live", testName = "NetworkApiLiveTest", singleThreaded = true)
-public class NetworkApiLiveTest extends BaseQuantumApiLiveTest {
-
- public void testListNetworks() {
- for (String zoneId : api.getConfiguredZones()) {
- Set<? extends Reference> ids = api.getNetworkApiForZone(zoneId).listReferences().toSet();
- Set<? extends Network> networks = api.getNetworkApiForZone(zoneId).list().toSet();
- assertNotNull(ids);
- assertEquals(ids.size(), networks.size());
- for (Network network : networks) {
- assertNotNull(network.getName());
- assertTrue(ids.contains(Reference.builder().id(network.getId()).build()));
- }
- }
- }
-
- public void testCreateUpdateAndDeleteNetwork() {
- for (String zoneId : api.getConfiguredZones()) {
- NetworkApi netApi = api.getNetworkApiForZone(zoneId);
- Reference net = netApi.create("jclouds-test");
- assertNotNull(net);
-
- Network network = netApi.get(net.getId());
- NetworkDetails details = netApi.getDetails(net.getId());
-
- for(Network checkme : ImmutableList.of(network, details)) {
- assertEquals(checkme.getId(), net.getId());
- assertEquals(checkme.getName(), "jclouds-test");
- }
-
- assertTrue(details.getPorts().isEmpty());
-
- assertTrue(netApi.rename(net.getId(), "jclouds-live-test"));
-
- // Grab the updated metadata
- network = netApi.get(net.getId());
- details = netApi.getDetails(net.getId());
-
- for(Network checkme : ImmutableList.of(network, details)) {
- assertEquals(checkme.getId(), net.getId());
- assertEquals(checkme.getName(), "jclouds-live-test");
- }
-
- assertTrue(details.getPorts().isEmpty());
-
- Reference net2 = netApi.create("jclouds-test2");
- assertNotNull(net2);
-
- assertTrue(netApi.delete(net.getId()));
- assertTrue(netApi.delete(net2.getId()));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java b/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java
deleted file mode 100644
index 1c37b4a..0000000
--- a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.quantum.v1_0.domain.Attachment;
-import org.jclouds.openstack.quantum.v1_0.domain.Port;
-import org.jclouds.openstack.quantum.v1_0.domain.PortDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Reference;
-import org.jclouds.openstack.quantum.v1_0.internal.BaseQuantumApiExpectTest;
-import org.jclouds.openstack.quantum.v1_0.parse.ParsePortDetailsTest;
-import org.jclouds.openstack.quantum.v1_0.parse.ParsePortTest;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests parsing and Guice wiring of PortApi
- *
- * @author Adam Lowe
- */
-@Test(groups="unit", testName = "PortApiExpectTest")
-public class PortApiExpectTest extends BaseQuantumApiExpectTest {
-
- public void testListReferencesReturns2xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/1a104cf5-cb18-4d35-9407-2fd2646d9d0b/ports").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"id\": \"a6058a59-fa8c-46cc-bac8-08904e6ff0a5\"}]}", APPLICATION_JSON)).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
-
- Set<? extends Reference> nets = api.listReferences().toSet();
- assertEquals(nets, ImmutableSet.of(Reference.builder().id("a6058a59-fa8c-46cc-bac8-08904e6ff0a5").build()));
- }
-
- public void testListReferencesReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/1a104cf5-cb18-4d35-9407-2fd2646d9d0b/ports").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
-
- assertTrue(api.listReferences().isEmpty());
- }
-
- public void testListReturns2xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/1a104cf5-cb18-4d35-9407-2fd2646d9d0b/ports/detail").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"state\": \"DOWN\", \"id\": \"814ae4bb-33d9-425f-8ee2-13a5c90b1465\"}]}", APPLICATION_JSON)).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
-
- Set<? extends Port> nets = api.list().toSet();
- assertEquals(nets, ImmutableSet.of(Port.builder().state(Port.State.DOWN).id("814ae4bb-33d9-425f-8ee2-13a5c90b1465").build()));
- }
-
- public void testListReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/1a104cf5-cb18-4d35-9407-2fd2646d9d0b/ports/detail").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b");
-
- assertTrue(api.list().isEmpty());
- }
-
- public void testShowReturns2xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/646c123b-871a-4124-9fa2-a94f04a582df").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/port.json", APPLICATION_JSON)).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- Port port = api.get("646c123b-871a-4124-9fa2-a94f04a582df");
- assertEquals(port, new ParsePortTest().expected());
- }
-
- public void testShowReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/646c123b-871a-4124-9fa2-a94f04a582df").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- assertNull(api.get("646c123b-871a-4124-9fa2-a94f04a582df"));
- }
-
- public void testShowDetailsReturns2xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/646c123b-871a-4124-9fa2-a94f04a582df/detail").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/port_details.json", APPLICATION_JSON)).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- PortDetails net = api.getDetails("646c123b-871a-4124-9fa2-a94f04a582df");
- assertEquals(net, new ParsePortDetailsTest().expected());
- }
-
- public void testShowDetailsReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/646c123b-871a-4124-9fa2-a94f04a582df/detail").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- assertNull(api.getDetails("646c123b-871a-4124-9fa2-a94f04a582df"));
- }
-
- public void testCreateReturns2xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports").method("POST").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"port\":{\"id\":\"12345\"}}", APPLICATION_JSON)).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- Reference port = api.create();
- assertEquals(port, Reference.builder().id("12345").build());
- }
-
- @Test(expectedExceptions = ResourceNotFoundException.class)
- public void testCreateReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports").method("POST").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- api.create();
- }
-
- public void testUpdateReturns2xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777").method("PUT")
- .payload(payloadFromStringWithContentType("{\"port\":{\"state\":\"ACTIVE\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(200).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- assertTrue(api.updateState("77777", Port.State.ACTIVE));
- }
-
- @Test(expectedExceptions = AuthorizationException.class)
- public void testUpdateReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777").method("PUT")
- .payload(payloadFromStringWithContentType("{\"port\":{\"state\":\"ACTIVE\"}}", MediaType.APPLICATION_JSON)).build(),
- HttpResponse.builder().statusCode(401).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- api.updateState("77777", Port.State.ACTIVE);
- }
-
- public void testShowAttachment() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777/attachment").build(),
- HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/attachment.json", APPLICATION_JSON)).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- Attachment attachment = api.showAttachment("77777");
- assertEquals(attachment, Attachment.builder().id("jclouds-live-test").build());
- }
-
- public void testShowAttachmentReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777/attachment").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- assertNull(api.showAttachment("77777"));
- }
-
- public void testPlugAttachment() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777/attachment")
- .payload(payloadFromStringWithContentType("{\"attachment\":{\"id\":\"jclouds-live-test\"}}", MediaType.APPLICATION_JSON))
- .method("PUT").build(),
- HttpResponse.builder().statusCode(200).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- assertTrue(api.plugAttachment("77777", "jclouds-live-test"));
- }
-
- @Test(expectedExceptions = AuthorizationException.class)
- public void testPlugAttachmentReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777/attachment")
- .payload(payloadFromStringWithContentType("{\"attachment\":{\"id\":\"jclouds-live-test\"}}", MediaType.APPLICATION_JSON))
- .method("PUT").build(),
- HttpResponse.builder().statusCode(403).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- api.plugAttachment("77777", "jclouds-live-test");
- }
- public void testUnplugAttachment() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777/attachment").method("DELETE").build(),
- HttpResponse.builder().statusCode(200).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- assertTrue(api.unplugAttachment("77777"));
- }
-
- @Test(expectedExceptions = ResourceNotFoundException.class)
- public void testUnplugAttachmentReturns4xx() {
- PortApi api = requestsSendResponses(
- keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
- authenticatedGET().endpoint(endpoint + "/tenants/3456/networks/16dba3bc-f3fa-4775-afdc-237e12c72f6a/ports/77777/attachment").method("DELETE").build(),
- HttpResponse.builder().statusCode(404).build())
- .getPortApiForZoneAndNetwork("region-a.geo-1", "16dba3bc-f3fa-4775-afdc-237e12c72f6a");
-
- api.unplugAttachment("77777");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/0736d2dd/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java b/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java
deleted file mode 100644
index 4e0c2eb..0000000
--- a/openstack/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.quantum.v1_0.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.jclouds.openstack.quantum.v1_0.domain.Attachment;
-import org.jclouds.openstack.quantum.v1_0.domain.NetworkDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Port;
-import org.jclouds.openstack.quantum.v1_0.domain.PortDetails;
-import org.jclouds.openstack.quantum.v1_0.domain.Reference;
-import org.jclouds.openstack.quantum.v1_0.internal.BaseQuantumApiLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-/**
- * Tests PortApi
- *
- * @author Adam Lowe
- * @author Zack Shoylev
- */
-@Test(groups = "live", testName = "PortApiLiveTest", singleThreaded = true)
-public class PortApiLiveTest extends BaseQuantumApiLiveTest {
-
- public void testListPorts() {
- for (String zoneId : api.getConfiguredZones()) {
- NetworkApi netApi = api.getNetworkApiForZone(zoneId);
- Set<? extends Reference> nets = netApi.listReferences().toSet();
- for(Reference net : nets) {
- PortApi portApi = api.getPortApiForZoneAndNetwork(zoneId, net.getId());
- Set<? extends Reference> portRefs = portApi.listReferences().toSet();
- Set<? extends Port> ports = portApi.list().toSet();
-
- assertEquals(portRefs.size(), ports.size());
- for (Port port : ports) {
- assertTrue(portRefs.contains(Reference.builder().id(port.getId()).build()));
- }
- }
- }
- }
-
- public void testCreateUpdateAndDeletePort() {
- for (String zoneId : api.getConfiguredZones()) {
- NetworkApi netApi = api.getNetworkApiForZone(zoneId);
- Reference net = netApi.create("jclouds-port-test");
- assertNotNull(net);
- PortApi portApi = api.getPortApiForZoneAndNetwork(zoneId, net.getId());
-
- Reference portRef = portApi.create();
- assertNotNull(portRef);
-
- Port port = portApi.get(portRef.getId());
- PortDetails portDetails = portApi.getDetails(portRef.getId());
- NetworkDetails networkDetails = netApi.getDetails(net.getId());
-
- assertEquals(port.getState(), portDetails.getState());
-
- for(Port checkme : ImmutableList.of(port, portDetails, Iterables.getOnlyElement(networkDetails.getPorts()))) {
- assertEquals(checkme.getId(), portRef.getId());
- }
-
- assertTrue(portApi.updateState(portRef.getId(), Port.State.DOWN));
-
- port = portApi.get(portRef.getId());
- portDetails = portApi.getDetails(portRef.getId());
-
- for(Port checkme : ImmutableList.of(port, portDetails)) {
- assertEquals(checkme.getId(), portRef.getId());
- assertEquals(checkme.getState(), Port.State.DOWN);
- }
-
- assertTrue(portApi.plugAttachment(port.getId(), "jclouds-live-test"));
-
- Attachment attachment = portApi.showAttachment(port.getId());
- portDetails = portApi.getDetails(portRef.getId());
-
- for(Attachment checkme : ImmutableList.of(attachment, portDetails.getAttachment())) {
- assertNotNull(checkme);
- assertEquals(checkme.getId(), "jclouds-live-test");
- }
-
- assertTrue(portApi.unplugAttachment(port.getId()));
-
- assertTrue(portApi.delete(portRef.getId()));
- assertTrue(netApi.delete(net.getId()));
- }
- }
-
- @Test(enabled=false) // assuming attachmentId matters in the wild
- public void testAttachAndDetachPort() {
- for (String zoneId : api.getConfiguredZones()) {
- NetworkApi netApi = api.getNetworkApiForZone(zoneId);
- Reference net = netApi.create("jclouds-attach-test");
- assertNotNull(net);
-
- PortApi portApi = api.getPortApiForZoneAndNetwork(zoneId, net.getId());
-
- Reference port = portApi.create();
- assertNotNull(port);
-
- assertTrue(portApi.plugAttachment(port.getId(), "jclouds-live-test"));
-
- Attachment attachment = portApi.showAttachment(port.getId());
- PortDetails portDetails = portApi.getDetails(port.getId());
-
- for(Attachment checkme : ImmutableList.of(attachment, portDetails.getAttachment())) {
- assertNotNull(checkme);
- assertEquals(checkme.getId(), "jclouds-live-test");
- }
-
- assertTrue(portApi.unplugAttachment(port.getId()));
-
- assertTrue(portApi.delete(port.getId()));
- assertTrue(netApi.delete(net.getId()));
- }
- }
-}