mirror of https://github.com/apache/jclouds.git
Issue 130, Issue 129: revised compute abstraction to be more resource oriented. added GET to ant
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2443 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
2ee25b9629
commit
9518a67228
|
@ -26,23 +26,42 @@ package org.jclouds.compute;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.CreateServerResponse;
|
import org.jclouds.compute.domain.CreateServerResponse;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.Profile;
|
||||||
|
import org.jclouds.compute.domain.ServerIdentity;
|
||||||
|
import org.jclouds.compute.domain.ServerMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: better name?
|
|
||||||
*
|
*
|
||||||
* @author Ivan Meredith
|
* @author Ivan Meredith
|
||||||
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface ComputeService {
|
public interface ComputeService {
|
||||||
SortedSet<Server> listServers();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* List all servers available to the current user
|
||||||
|
*/
|
||||||
|
SortedSet<ServerIdentity> listServers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all servers matching the specified name
|
||||||
|
*/
|
||||||
|
SortedSet<ServerIdentity> getServerByName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new server given the name, profile, and image.
|
||||||
*
|
*
|
||||||
* @see Image
|
|
||||||
*/
|
*/
|
||||||
CreateServerResponse createServer(String name, Profile profile, Image image);
|
CreateServerResponse createServer(String name, Profile profile, Image image);
|
||||||
|
|
||||||
Server getServerById(String id);
|
/**
|
||||||
|
* destroy the server.
|
||||||
|
*/
|
||||||
|
void destroyServer(String id);
|
||||||
|
|
||||||
SortedSet<Server> getServerByName(String id);
|
/**
|
||||||
|
* Find a server by its id
|
||||||
|
*/
|
||||||
|
ServerMetadata getServerMetadata(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,36 +23,13 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.compute.domain;
|
package org.jclouds.compute.domain;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @author Ivan Meredith
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public interface CreateServerResponse {
|
public interface CreateServerResponse extends ServerMetadata {
|
||||||
|
|
||||||
/**
|
|
||||||
* unique id of the server. potentially generated by the service.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
String getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* user defined name of the server.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
SortedSet<InetAddress> getPublicAddresses();
|
|
||||||
|
|
||||||
SortedSet<InetAddress> getPrivateAddresses();
|
|
||||||
|
|
||||||
int getLoginPort();
|
|
||||||
|
|
||||||
LoginType getLoginType();
|
|
||||||
|
|
||||||
Credentials getCredentials();
|
Credentials getCredentials();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.compute;
|
package org.jclouds.compute.domain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -21,7 +21,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.compute;
|
package org.jclouds.compute.domain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
|
@ -21,12 +21,18 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.compute;
|
package org.jclouds.compute.domain;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.internal.ServerIdentityImpl;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ivan Meredith
|
* @author Ivan Meredith
|
||||||
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface Server extends Comparable<Server> {
|
@ImplementedBy(ServerIdentityImpl.class)
|
||||||
|
public interface ServerIdentity extends Comparable<ServerIdentity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unique id of the server. potentially generated by the service.
|
* unique id of the server. potentially generated by the service.
|
||||||
|
@ -40,5 +46,4 @@ public interface Server extends Comparable<Server> {
|
||||||
*/
|
*/
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
public Boolean destroy();
|
|
||||||
}
|
}
|
|
@ -21,42 +21,28 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.terremark.compute;
|
package org.jclouds.compute.domain;
|
||||||
|
|
||||||
import org.jclouds.compute.Server;
|
import java.net.InetAddress;
|
||||||
import org.jclouds.vcloud.terremark.domain.TerremarkVApp;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.internal.ServerMetadataImpl;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class TerremarkVCloudServer implements Server {
|
@ImplementedBy(ServerMetadataImpl.class)
|
||||||
|
public interface ServerMetadata extends ServerIdentity {
|
||||||
|
|
||||||
private final TerremarkVCloudComputeClient computeClient;
|
SortedSet<InetAddress> getPublicAddresses();
|
||||||
|
|
||||||
private final TerremarkVApp vApp;
|
SortedSet<InetAddress> getPrivateAddresses();
|
||||||
|
|
||||||
public TerremarkVCloudServer(TerremarkVCloudComputeClient computeClient, TerremarkVApp vApp) {
|
int getLoginPort();
|
||||||
this.vApp = vApp;
|
|
||||||
this.computeClient = computeClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
LoginType getLoginType();
|
||||||
return vApp.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean destroy() {
|
|
||||||
computeClient.stop(getId());
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return vApp.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Server o) {
|
|
||||||
return (this == o) ? 0 : getId().compareTo(o.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -24,96 +24,47 @@
|
||||||
package org.jclouds.compute.domain.internal;
|
package org.jclouds.compute.domain.internal;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.CreateServerResponse;
|
import org.jclouds.compute.domain.CreateServerResponse;
|
||||||
import org.jclouds.compute.domain.LoginType;
|
import org.jclouds.compute.domain.LoginType;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @author Ivan Meredith
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class CreateServerResponseImpl implements CreateServerResponse {
|
public class CreateServerResponseImpl extends ServerMetadataImpl implements CreateServerResponse {
|
||||||
public static final Comparator<InetAddress> ADDRESS_COMPARATOR = new Comparator<InetAddress>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(InetAddress o1, InetAddress o2) {
|
|
||||||
return (o1 == o2) ? 0 : o1.getHostAddress().compareTo(o2.getHostAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
private final String id;
|
|
||||||
private final String name;
|
|
||||||
private final SortedSet<InetAddress> publicAddresses = Sets.newTreeSet(ADDRESS_COMPARATOR);
|
|
||||||
private final SortedSet<InetAddress> privateAddresses = Sets.newTreeSet(ADDRESS_COMPARATOR);
|
|
||||||
private final int loginPort;
|
|
||||||
private final LoginType loginType;
|
|
||||||
private final Credentials credentials;
|
private final Credentials credentials;
|
||||||
|
|
||||||
|
|
||||||
public CreateServerResponseImpl(String id, String name, Iterable<InetAddress> publicAddresses,
|
public CreateServerResponseImpl(String id, String name, Iterable<InetAddress> publicAddresses,
|
||||||
Iterable<InetAddress> privateAddresses, int loginPort, LoginType loginType,
|
Iterable<InetAddress> privateAddresses, int loginPort, LoginType loginType,
|
||||||
Credentials credentials) {
|
Credentials credentials) {
|
||||||
this.id = id;
|
super(id, name, publicAddresses, privateAddresses, loginPort, loginType);
|
||||||
this.name = name;
|
|
||||||
Iterables.addAll(this.publicAddresses, publicAddresses);
|
|
||||||
Iterables.addAll(this.privateAddresses, privateAddresses);
|
|
||||||
this.loginPort = loginPort;
|
|
||||||
this.loginType = loginType;
|
|
||||||
this.credentials = credentials;
|
this.credentials = credentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedSet<InetAddress> getPublicAddresses() {
|
|
||||||
return publicAddresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedSet<InetAddress> getPrivateAddresses() {
|
|
||||||
return privateAddresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLoginPort() {
|
|
||||||
return loginPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoginType getLoginType() {
|
|
||||||
return loginType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Credentials getCredentials() {
|
public Credentials getCredentials() {
|
||||||
return credentials;
|
return credentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = super.hashCode();
|
||||||
result = prime * result + ((credentials == null) ? 0 : credentials.hashCode());
|
result = prime * result + ((credentials == null) ? 0 : credentials.hashCode());
|
||||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
|
||||||
result = prime * result + loginPort;
|
|
||||||
result = prime * result + ((loginType == null) ? 0 : loginType.hashCode());
|
|
||||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
||||||
result = prime * result + ((privateAddresses == null) ? 0 : privateAddresses.hashCode());
|
|
||||||
result = prime * result + ((publicAddresses == null) ? 0 : publicAddresses.hashCode());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
return true;
|
return true;
|
||||||
if (obj == null)
|
if (!super.equals(obj))
|
||||||
return false;
|
return false;
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
|
@ -123,34 +74,8 @@ public class CreateServerResponseImpl implements CreateServerResponse {
|
||||||
return false;
|
return false;
|
||||||
} else if (!credentials.equals(other.credentials))
|
} else if (!credentials.equals(other.credentials))
|
||||||
return false;
|
return false;
|
||||||
if (id == null) {
|
|
||||||
if (other.id != null)
|
|
||||||
return false;
|
|
||||||
} else if (!id.equals(other.id))
|
|
||||||
return false;
|
|
||||||
if (loginPort != other.loginPort)
|
|
||||||
return false;
|
|
||||||
if (loginType == null) {
|
|
||||||
if (other.loginType != null)
|
|
||||||
return false;
|
|
||||||
} else if (!loginType.equals(other.loginType))
|
|
||||||
return false;
|
|
||||||
if (name == null) {
|
|
||||||
if (other.name != null)
|
|
||||||
return false;
|
|
||||||
} else if (!name.equals(other.name))
|
|
||||||
return false;
|
|
||||||
if (privateAddresses == null) {
|
|
||||||
if (other.privateAddresses != null)
|
|
||||||
return false;
|
|
||||||
} else if (!privateAddresses.equals(other.privateAddresses))
|
|
||||||
return false;
|
|
||||||
if (publicAddresses == null) {
|
|
||||||
if (other.publicAddresses != null)
|
|
||||||
return false;
|
|
||||||
} else if (!publicAddresses.equals(other.publicAddresses))
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.compute.domain.internal;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.ServerIdentity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
|
public class ServerIdentityImpl implements ServerIdentity {
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public ServerIdentityImpl(String id, String name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public int compareTo(ServerIdentity o) {
|
||||||
|
if (getName() == null)
|
||||||
|
return -1;
|
||||||
|
return (this == o) ? 0 : getName().compareTo(o.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
|
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ServerIdentityImpl other = (ServerIdentityImpl) obj;
|
||||||
|
if (id == null) {
|
||||||
|
if (other.id != null)
|
||||||
|
return false;
|
||||||
|
} else if (!id.equals(other.id))
|
||||||
|
return false;
|
||||||
|
if (name == null) {
|
||||||
|
if (other.name != null)
|
||||||
|
return false;
|
||||||
|
} else if (!name.equals(other.name))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.compute.domain.internal;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.LoginType;
|
||||||
|
import org.jclouds.compute.domain.ServerMetadata;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
|
public class ServerMetadataImpl extends ServerIdentityImpl implements ServerMetadata {
|
||||||
|
public static final Comparator<InetAddress> ADDRESS_COMPARATOR = new Comparator<InetAddress>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(InetAddress o1, InetAddress o2) {
|
||||||
|
return (o1 == o2) ? 0 : o1.getHostAddress().compareTo(o2.getHostAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
private final SortedSet<InetAddress> publicAddresses = Sets.newTreeSet(ADDRESS_COMPARATOR);
|
||||||
|
private final SortedSet<InetAddress> privateAddresses = Sets.newTreeSet(ADDRESS_COMPARATOR);
|
||||||
|
private final int loginPort;
|
||||||
|
private final LoginType loginType;
|
||||||
|
|
||||||
|
public ServerMetadataImpl(String id, String name, Iterable<InetAddress> publicAddresses,
|
||||||
|
Iterable<InetAddress> privateAddresses, int loginPort, LoginType loginType) {
|
||||||
|
super(id, name);
|
||||||
|
Iterables.addAll(this.publicAddresses, publicAddresses);
|
||||||
|
Iterables.addAll(this.privateAddresses, privateAddresses);
|
||||||
|
this.loginPort = loginPort;
|
||||||
|
this.loginType = loginType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public SortedSet<InetAddress> getPublicAddresses() {
|
||||||
|
return publicAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public SortedSet<InetAddress> getPrivateAddresses() {
|
||||||
|
return privateAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public int getLoginPort() {
|
||||||
|
return loginPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public LoginType getLoginType() {
|
||||||
|
return loginType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + loginPort;
|
||||||
|
result = prime * result + ((loginType == null) ? 0 : loginType.hashCode());
|
||||||
|
result = prime * result + ((privateAddresses == null) ? 0 : privateAddresses.hashCode());
|
||||||
|
result = prime * result + ((publicAddresses == null) ? 0 : publicAddresses.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (!super.equals(obj))
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ServerMetadataImpl other = (ServerMetadataImpl) obj;
|
||||||
|
if (loginPort != other.loginPort)
|
||||||
|
return false;
|
||||||
|
if (loginType == null) {
|
||||||
|
if (other.loginType != null)
|
||||||
|
return false;
|
||||||
|
} else if (!loginType.equals(other.loginType))
|
||||||
|
return false;
|
||||||
|
if (privateAddresses == null) {
|
||||||
|
if (other.privateAddresses != null)
|
||||||
|
return false;
|
||||||
|
} else if (!privateAddresses.equals(other.privateAddresses))
|
||||||
|
return false;
|
||||||
|
if (publicAddresses == null) {
|
||||||
|
if (other.publicAddresses != null)
|
||||||
|
return false;
|
||||||
|
} else if (!publicAddresses.equals(other.publicAddresses))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,9 +33,10 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.Image;
|
|
||||||
import org.jclouds.compute.Profile;
|
|
||||||
import org.jclouds.compute.domain.CreateServerResponse;
|
import org.jclouds.compute.domain.CreateServerResponse;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.Profile;
|
||||||
|
import org.jclouds.compute.domain.ServerMetadata;
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
||||||
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
import org.jclouds.rimuhosting.miro.domain.Server;
|
||||||
|
@ -67,8 +68,8 @@ public class RimuHostingComputeService implements ComputeService {
|
||||||
return new RimuHostingCreateServerResponse(serverResponse);
|
return new RimuHostingCreateServerResponse(serverResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<org.jclouds.compute.Server> listServers() {
|
public SortedSet<org.jclouds.compute.domain.ServerIdentity> listServers() {
|
||||||
SortedSet<org.jclouds.compute.Server> servers = new TreeSet<org.jclouds.compute.Server>();
|
SortedSet<org.jclouds.compute.domain.ServerIdentity> servers = new TreeSet<org.jclouds.compute.domain.ServerIdentity>();
|
||||||
SortedSet<Server> rhServers = rhClient.getInstanceList();
|
SortedSet<Server> rhServers = rhClient.getInstanceList();
|
||||||
for (Server rhServer : rhServers) {
|
for (Server rhServer : rhServers) {
|
||||||
servers.add(new RimuHostingServer(rhServer, rhClient));
|
servers.add(new RimuHostingServer(rhServer, rhClient));
|
||||||
|
@ -76,16 +77,21 @@ public class RimuHostingComputeService implements ComputeService {
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.jclouds.compute.Server getServerById(String id) {
|
public ServerMetadata getServerMetadata(String id) {
|
||||||
return new RimuHostingServer(rhClient.getInstance(Long.valueOf(id)), rhClient);
|
throw new UnsupportedOperationException("not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SortedSet<org.jclouds.compute.Server> getServerByName(String id) {
|
public SortedSet<org.jclouds.compute.domain.ServerIdentity> getServerByName(String id) {
|
||||||
SortedSet<org.jclouds.compute.Server> serverSet = new TreeSet<org.jclouds.compute.Server>();
|
SortedSet<org.jclouds.compute.domain.ServerIdentity> serverSet = new TreeSet<org.jclouds.compute.domain.ServerIdentity>();
|
||||||
for (Server rhServer : rhClient.getInstanceList()) {
|
for (Server rhServer : rhClient.getInstanceList()) {
|
||||||
serverSet.add(new RimuHostingServer(rhServer, rhClient));
|
serverSet.add(new RimuHostingServer(rhServer, rhClient));
|
||||||
}
|
}
|
||||||
return serverSet;
|
return serverSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroyServer(String id) {
|
||||||
|
rhClient.destroyInstance(new Long(id));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,10 +23,10 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rimuhosting.miro.servers;
|
package org.jclouds.rimuhosting.miro.servers;
|
||||||
|
|
||||||
import org.jclouds.compute.Server;
|
import org.jclouds.compute.domain.ServerIdentity;
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
||||||
|
|
||||||
public class RimuHostingServer implements Server {
|
public class RimuHostingServer implements ServerIdentity {
|
||||||
org.jclouds.rimuhosting.miro.domain.Server rhServer;
|
org.jclouds.rimuhosting.miro.domain.Server rhServer;
|
||||||
|
|
||||||
RimuHostingClient rhClient;
|
RimuHostingClient rhClient;
|
||||||
|
@ -52,7 +52,7 @@ public class RimuHostingServer implements Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Server o) {
|
public int compareTo(ServerIdentity o) {
|
||||||
return (this == o) ? 0 : getId().compareTo(o.getId());
|
return (this == o) ? 0 : getId().compareTo(o.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ package org.jclouds.rimuhosting.miro.servers;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import org.jclouds.compute.Image;
|
|
||||||
import org.jclouds.compute.Profile;
|
|
||||||
import org.jclouds.compute.domain.CreateServerResponse;
|
import org.jclouds.compute.domain.CreateServerResponse;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.Profile;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingContextBuilder;
|
import org.jclouds.rimuhosting.miro.RimuHostingContextBuilder;
|
||||||
|
@ -63,6 +63,6 @@ public class RimuHostingComputeServiceLiveTest {
|
||||||
CreateServerResponse server = rhServerService.createServer("test.com", Profile.SMALLEST,
|
CreateServerResponse server = rhServerService.createServer("test.com", Profile.SMALLEST,
|
||||||
Image.CENTOS_53);
|
Image.CENTOS_53);
|
||||||
assertNotNull(rhClient.getInstance(Long.valueOf(server.getId())));
|
assertNotNull(rhClient.getInstance(Long.valueOf(server.getId())));
|
||||||
rhServerService.getServerById(server.getId()).destroy();
|
rhServerService.destroyServer(server.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
====================================================================
|
====================================================================
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<project name="ex6" default="list" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
|
<project name="compute" default="list" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
|
||||||
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
|
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
|
||||||
<artifact:remoteRepository id="jclouds-snapshot.repository" url="http://jclouds.rimuhosting.com/maven2/snapshots" />
|
<artifact:remoteRepository id="jclouds-snapshot.repository" url="http://jclouds.rimuhosting.com/maven2/snapshots" />
|
||||||
|
|
||||||
|
@ -37,21 +37,27 @@
|
||||||
|
|
||||||
<typedef name="compute" classname="org.jclouds.tools.ant.ComputeTask" classpathref="jclouds.classpath" />
|
<typedef name="compute" classname="org.jclouds.tools.ant.ComputeTask" classpathref="jclouds.classpath" />
|
||||||
|
|
||||||
<property name="jclouds.compute.provider" value="compute://${jclouds.compute.account}:${jclouds.compute.key}@${jclouds.compute.provider}" />
|
<property name="jclouds.compute.url" value="compute://${jclouds.compute.account}:${jclouds.compute.key}@${jclouds.compute.provider}" />
|
||||||
<property name="jclouds.compute.servername" value="testforjcloud2" />
|
<property name="jclouds.compute.servername" value="testforjcloud2" />
|
||||||
|
|
||||||
<target name="list">
|
<target name="list">
|
||||||
<compute action="list" provider="${jclouds.compute.provider}" />
|
<compute action="list" provider="${jclouds.compute.url}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<compute action="destroy" provider="${jclouds.compute.provider}" >
|
<compute action="destroy" provider="${jclouds.compute.url}" >
|
||||||
|
<server name="${jclouds.compute.servername}"/>
|
||||||
|
</compute>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="get">
|
||||||
|
<compute action="get" provider="${jclouds.compute.url}" >
|
||||||
<server name="${jclouds.compute.servername}"/>
|
<server name="${jclouds.compute.servername}"/>
|
||||||
</compute>
|
</compute>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="create">
|
<target name="create">
|
||||||
<compute action="create" provider="${jclouds.compute.provider}" >
|
<compute action="create" provider="${jclouds.compute.url}" >
|
||||||
<server name="${jclouds.compute.servername}" image="CENTOS_53" profile="SMALLEST" />
|
<server name="${jclouds.compute.servername}" image="CENTOS_53" profile="SMALLEST" />
|
||||||
</compute>
|
</compute>
|
||||||
</target>
|
</target>
|
||||||
|
|
|
@ -34,16 +34,17 @@ import org.apache.tools.ant.Project;
|
||||||
import org.apache.tools.ant.Task;
|
import org.apache.tools.ant.Task;
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.ComputeServiceFactory;
|
import org.jclouds.compute.ComputeServiceFactory;
|
||||||
import org.jclouds.compute.Image;
|
|
||||||
import org.jclouds.compute.Profile;
|
|
||||||
import org.jclouds.compute.Server;
|
|
||||||
import org.jclouds.compute.domain.CreateServerResponse;
|
import org.jclouds.compute.domain.CreateServerResponse;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.Profile;
|
||||||
|
import org.jclouds.compute.domain.ServerIdentity;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
import org.jclouds.tools.ant.logging.config.AntLoggingModule;
|
import org.jclouds.tools.ant.logging.config.AntLoggingModule;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.MapMaker;
|
import com.google.common.collect.MapMaker;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ public class ComputeTask extends Task {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum Action {
|
public static enum Action {
|
||||||
CREATE, LIST, DESTROY
|
CREATE, GET, LIST, DESTROY
|
||||||
}
|
}
|
||||||
|
|
||||||
private String provider;
|
private String provider;
|
||||||
|
@ -122,12 +123,16 @@ public class ComputeTask extends Task {
|
||||||
ComputeService computeService = computeMap.get(HttpUtils.createUri(provider));
|
ComputeService computeService = computeMap.get(HttpUtils.createUri(provider));
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
|
case GET:
|
||||||
case DESTROY:
|
case DESTROY:
|
||||||
if (serverElement != null) {
|
if (serverElement != null) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
create(computeService);
|
create(computeService);
|
||||||
break;
|
break;
|
||||||
|
case GET:
|
||||||
|
get(computeService);
|
||||||
|
break;
|
||||||
case DESTROY:
|
case DESTROY:
|
||||||
destroy(computeService);
|
destroy(computeService);
|
||||||
break;
|
break;
|
||||||
|
@ -138,7 +143,7 @@ public class ComputeTask extends Task {
|
||||||
break;
|
break;
|
||||||
case LIST:
|
case LIST:
|
||||||
log("list");
|
log("list");
|
||||||
for (Server server : computeService.listServers()) {
|
for (ServerIdentity server : computeService.listServers()) {
|
||||||
log(String.format(" id=%s, name=%s", server.getId(), server.getName()));
|
log(String.format(" id=%s, name=%s", server.getId(), server.getName()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -162,16 +167,27 @@ public class ComputeTask extends Task {
|
||||||
|
|
||||||
private void destroy(ComputeService computeService) {
|
private void destroy(ComputeService computeService) {
|
||||||
log(String.format("destroy name: %s", serverElement.getName()));
|
log(String.format("destroy name: %s", serverElement.getName()));
|
||||||
SortedSet<Server> serversThatMatch = computeService.getServerByName(serverElement.getName());
|
SortedSet<ServerIdentity> serversThatMatch = computeService.getServerByName(serverElement
|
||||||
|
.getName());
|
||||||
if (serversThatMatch.size() > 0) {
|
if (serversThatMatch.size() > 0) {
|
||||||
for (Server server : serversThatMatch) {
|
for (ServerIdentity server : serversThatMatch) {
|
||||||
log(String.format(" destroying id=%s, name=%s", server.getId(), server.getName()));
|
log(String.format(" destroying id=%s, name=%s", server.getId(), server.getName()));
|
||||||
if (!server.destroy()) {
|
computeService.destroyServer(server.getId());
|
||||||
log(String.format(" could not destroy id=%s, name=%s", server.getId(), server
|
|
||||||
.getName()), Project.MSG_ERR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void get(ComputeService computeService) {
|
||||||
|
log(String.format("get name: %s", serverElement.getName()));
|
||||||
|
SortedSet<ServerIdentity> serversThatMatch = computeService.getServerByName(serverElement
|
||||||
|
.getName());
|
||||||
|
if (serversThatMatch.size() > 0) {
|
||||||
|
for (ServerIdentity server : serversThatMatch) {
|
||||||
|
log(String.format(" server id=%s, name=%s, value=%s", server.getId(), server
|
||||||
|
.getName(), new Gson()
|
||||||
|
.toJson(computeService.getServerMetadata(server.getId()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAction() {
|
public String getAction() {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import java.util.SortedSet;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.compute.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.jclouds.vcloud.terremark.compute;
|
package org.jclouds.vcloud.terremark.compute;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -31,12 +32,14 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.Image;
|
|
||||||
import org.jclouds.compute.Profile;
|
|
||||||
import org.jclouds.compute.Server;
|
|
||||||
import org.jclouds.compute.domain.CreateServerResponse;
|
import org.jclouds.compute.domain.CreateServerResponse;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.LoginType;
|
import org.jclouds.compute.domain.LoginType;
|
||||||
|
import org.jclouds.compute.domain.Profile;
|
||||||
|
import org.jclouds.compute.domain.ServerIdentity;
|
||||||
|
import org.jclouds.compute.domain.ServerMetadata;
|
||||||
import org.jclouds.compute.domain.internal.CreateServerResponseImpl;
|
import org.jclouds.compute.domain.internal.CreateServerResponseImpl;
|
||||||
|
import org.jclouds.compute.domain.internal.ServerMetadataImpl;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.rest.domain.NamedResource;
|
import org.jclouds.rest.domain.NamedResource;
|
||||||
|
@ -81,8 +84,12 @@ public class TerremarkVCloudComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Server getServerById(String id) {
|
public ServerMetadata getServerMetadata(String id) {
|
||||||
return new TerremarkVCloudServer(computeClient, tmClient.getVApp(id));
|
VApp vApp = tmClient.getVApp(id);
|
||||||
|
// TODO
|
||||||
|
Set<InetAddress> publicAddresses = ImmutableSet.<InetAddress> of();
|
||||||
|
return new ServerMetadataImpl(vApp.getId(), vApp.getName(), publicAddresses, vApp
|
||||||
|
.getNetworkToAddresses().values(), 22, LoginType.SSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<InternetService> getInternetServicesByName(final String name) {
|
public SortedSet<InternetService> getInternetServicesByName(final String name) {
|
||||||
|
@ -96,23 +103,28 @@ public class TerremarkVCloudComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SortedSet<Server> getServerByName(final String name) {
|
public SortedSet<ServerIdentity> getServerByName(final String name) {
|
||||||
return Sets.newTreeSet(Iterables.filter(listServers(), new Predicate<Server>() {
|
return Sets.newTreeSet(Iterables.filter(listServers(), new Predicate<ServerIdentity>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Server input) {
|
public boolean apply(ServerIdentity input) {
|
||||||
return input.getName().equalsIgnoreCase(name);
|
return input.getName().equalsIgnoreCase(name);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SortedSet<Server> listServers() {
|
public SortedSet<ServerIdentity> listServers() {
|
||||||
SortedSet<Server> servers = Sets.newTreeSet();
|
SortedSet<ServerIdentity> servers = Sets.newTreeSet();
|
||||||
for (NamedResource resource : tmClient.getDefaultVDC().getResourceEntities().values()) {
|
for (NamedResource resource : tmClient.getDefaultVDC().getResourceEntities().values()) {
|
||||||
if (resource.getType().equals(VCloudMediaType.VAPP_XML)) {
|
if (resource.getType().equals(VCloudMediaType.VAPP_XML)) {
|
||||||
servers.add(getServerById(resource.getId()));
|
servers.add(getServerMetadata(resource.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroyServer(String id) {
|
||||||
|
computeClient.stop(id);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -40,6 +40,7 @@ import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.jclouds.predicates.SocketOpen;
|
import org.jclouds.predicates.SocketOpen;
|
||||||
|
import org.jclouds.rest.domain.NamedResource;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.ssh.SshClient.Factory;
|
import org.jclouds.ssh.SshClient.Factory;
|
||||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||||
|
@ -58,6 +59,7 @@ import org.testng.annotations.AfterTest;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +143,10 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
System.out.printf("%d: done deploying vApp%n", System.currentTimeMillis());
|
System.out.printf("%d: done deploying vApp%n", System.currentTimeMillis());
|
||||||
|
|
||||||
vApp = tmClient.getVApp(vApp.getId());
|
vApp = tmClient.getVApp(vApp.getId());
|
||||||
|
|
||||||
|
NamedResource vAppResource = tmClient.getDefaultVDC().getResourceEntities().get(serverName);
|
||||||
|
assertEquals(vAppResource.getId(), vApp.getId());
|
||||||
|
|
||||||
verifyConfigurationOfVApp(vApp, serverName, expectedOs, processorCount, memory, hardDisk);
|
verifyConfigurationOfVApp(vApp, serverName, expectedOs, processorCount, memory, hardDisk);
|
||||||
assertEquals(vApp.getStatus(), VAppStatus.OFF);
|
assertEquals(vApp.getStatus(), VAppStatus.OFF);
|
||||||
|
|
||||||
|
@ -162,7 +168,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
@Test(dependsOnMethods = { "testInstantiateAndPowerOn", "testAddInternetService" })
|
@Test(dependsOnMethods = { "testInstantiateAndPowerOn", "testAddInternetService" })
|
||||||
public void testPublicIp() throws InterruptedException, ExecutionException, TimeoutException,
|
public void testPublicIp() throws InterruptedException, ExecutionException, TimeoutException,
|
||||||
IOException {
|
IOException {
|
||||||
node = tmClient.addNode(is.getId(), vApp.getNetworkToAddresses().values().iterator().next(),
|
node = tmClient.addNode(is.getId(), Iterables.getLast(vApp.getNetworkToAddresses().values()),
|
||||||
vApp.getName() + "-SSH", 22);
|
vApp.getName() + "-SSH", 22);
|
||||||
publicIp = is.getPublicIpAddress().getAddress();
|
publicIp = is.getPublicIpAddress().getAddress();
|
||||||
doCheckPass(publicIp);
|
doCheckPass(publicIp);
|
||||||
|
@ -187,6 +193,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
assert successTester.apply(tmClient.resetVApp(vApp.getId()).getLocation());
|
assert successTester.apply(tmClient.resetVApp(vApp.getId()).getLocation());
|
||||||
|
|
||||||
vApp = tmClient.getVApp(vApp.getId());
|
vApp = tmClient.getVApp(vApp.getId());
|
||||||
|
|
||||||
assertEquals(vApp.getStatus(), VAppStatus.ON);
|
assertEquals(vApp.getStatus(), VAppStatus.ON);
|
||||||
|
|
||||||
// TODO we need to determine whether shutdown is supported before invoking it.
|
// TODO we need to determine whether shutdown is supported before invoking it.
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import org.jclouds.compute.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||||
import org.jclouds.vcloud.domain.ResourceType;
|
import org.jclouds.vcloud.domain.ResourceType;
|
||||||
|
|
Loading…
Reference in New Issue