You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/05 19:28:08 UTC
[5/9] git commit: Remove smartos-ssh,
which hasn't been published in over a year.
Remove smartos-ssh, which hasn't been published in over a year.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/1795ff7e
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/1795ff7e
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/1795ff7e
Branch: refs/heads/master
Commit: 1795ff7e17e4775af759a89576bc5bd164a9d7a9
Parents: 1bdd26c
Author: Adrian Cole <ad...@gmail.com>
Authored: Sun Oct 5 09:20:13 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Sun Oct 5 10:22:36 2014 -0700
----------------------------------------------------------------------
smartos-ssh/README.md | 20 --
smartos-ssh/pom.xml | 119 ---------
.../org/jclouds/smartos/SmartOSApiMetadata.java | 73 ------
.../jclouds/smartos/SmartOSHostController.java | 259 -------------------
.../SmartOSComputeServiceContextModule.java | 57 ----
.../compute/config/SmartOSParserModule.java | 61 -----
.../jclouds/smartos/compute/domain/DataSet.java | 149 -----------
.../org/jclouds/smartos/compute/domain/VM.java | 187 -------------
.../jclouds/smartos/compute/domain/VmNIC.java | 135 ----------
.../smartos/compute/domain/VmSpecification.java | 236 -----------------
.../compute/functions/DataSetToImage.java | 59 -----
.../compute/functions/DatacenterToLocation.java | 49 ----
.../compute/functions/VMToNodeMetadata.java | 103 --------
.../functions/VmSpecificationToHardware.java | 43 ---
.../strategy/SmartOSComputeServiceAdapter.java | 156 -----------
.../services/org.jclouds.apis.ApiMetadata | 1 -
...ManagerComputeServiceContextBuilderTest.java | 76 ------
.../SmartOSManagerComputeServiceLiveTest.java | 54 ----
.../smartos/compute/domain/DataSetTest.java | 55 ----
.../jclouds/smartos/compute/domain/VMTest.java | 55 ----
.../compute/parse/ParseVmSpecificationTest.java | 68 -----
smartos-ssh/src/test/resources/log4j.xml | 190 --------------
.../compute/domain/dsadm-list-response.txt | 11 -
.../compute/domain/vmadm-list-response.txt | 2 -
smartos-ssh/src/test/resources/vmspec.json | 19 --
25 files changed, 2237 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/README.md
----------------------------------------------------------------------
diff --git a/smartos-ssh/README.md b/smartos-ssh/README.md
deleted file mode 100644
index 7ca7d43..0000000
--- a/smartos-ssh/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-
-This is designed for interacting with a Joyent SmartOS host, in order to be able to leverage
-the lightweight VM support (nee Solaris Zones).
-
-It is planned to support KVM VMs in the future.
-
---------------
-
-#Setup
-
-Have a SmartOS installation, that you know either the root password for, or a secondary account with sufficient
-permissions to be able to run the vm tools (vmadm, dsadm).
-
-That's it!
-
---------------
-
-#Notes:
-
-- This is a work in progress, so please report any bugs that you find.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/pom.xml
----------------------------------------------------------------------
diff --git a/smartos-ssh/pom.xml b/smartos-ssh/pom.xml
deleted file mode 100644
index 8f404c2..0000000
--- a/smartos-ssh/pom.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <!-- TODO: when out of labs, switch to org.jclouds.api -->
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>smartos-ssh</artifactId>
- <name>smartos ssh api</name>
- <description>jclouds components to access SmartOS over SSH</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.smartos-ssh.endpoint>https://api.joyentcloud.com</test.smartos-ssh.endpoint>
- <test.smartos-ssh.api-version>~6.5</test.smartos-ssh.api-version>
- <test.smartos-ssh.build-version />
- <test.smartos-ssh.identity>FIXME_IDENTITY</test.smartos-ssh.identity>
- <test.smartos-ssh.credential>FIXME_CREDENTIALS</test.smartos-ssh.credential>
- <jclouds.osgi.export>org.jclouds.joyent.cloudapi.v6_5*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
- </jclouds.osgi.import>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-slf4j</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <test.smartos-ssh.endpoint>${test.smartos-ssh.endpoint}</test.smartos-ssh.endpoint>
- <test.smartos-ssh.api-version>${test.smartos-ssh.api-version}</test.smartos-ssh.api-version>
- <test.smartos-ssh.build-version>${test.smartos-ssh.build-version}</test.smartos-ssh.build-version>
- <test.smartos-ssh.identity>${test.smartos-ssh.identity}</test.smartos-ssh.identity>
- <test.smartos-ssh.credential>${test.smartos-ssh.credential}</test.smartos-ssh.credential>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSApiMetadata.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSApiMetadata.java b/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSApiMetadata.java
deleted file mode 100644
index aa8db9d..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSApiMetadata.java
+++ /dev/null
@@ -1,73 +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.smartos;
-
-import java.net.URI;
-
-import org.jclouds.apis.internal.BaseApiMetadata;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.smartos.compute.config.SmartOSComputeServiceContextModule;
-import org.jclouds.smartos.compute.config.SmartOSParserModule;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Implementation of {@link ApiMetadata} for SmartOS
- */
-public class SmartOSApiMetadata extends BaseApiMetadata {
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public SmartOSApiMetadata() {
- super(new Builder());
- }
-
- protected SmartOSApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static class Builder extends BaseApiMetadata.Builder<Builder> {
-
- protected Builder() {
- id("smartos-ssh")
- .name("SmartOS SSH API")
- .identityName("Username")
- .defaultIdentity("root")
- .defaultCredential("smartos")
- .defaultEndpoint("http://localhost")
- .documentation(URI.create("http://http://wiki.smartos.org/display/DOC/How+to+create+a+Virtual+Machine+in+SmartOS"))
- .view(ComputeServiceContext.class)
- .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
- .add(SmartOSComputeServiceContextModule.class)
- .add(SmartOSParserModule.class).build());
- }
-
- @Override
- public SmartOSApiMetadata build() {
- return new SmartOSApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSHostController.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSHostController.java b/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSHostController.java
deleted file mode 100644
index a7d4a89..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/SmartOSHostController.java
+++ /dev/null
@@ -1,259 +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.smartos;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.net.URI;
-import java.util.Map;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.inject.Inject;
-
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.json.Json;
-import org.jclouds.location.Provider;
-import org.jclouds.smartos.compute.domain.DataSet;
-import org.jclouds.smartos.compute.domain.VM;
-import org.jclouds.smartos.compute.domain.VmSpecification;
-import org.jclouds.ssh.SshClient;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.net.HostAndPort;
-import com.google.common.util.concurrent.RateLimiter;
-
-/**
- * A host machine that runs smartOS
- */
-public class SmartOSHostController {
- protected final String hostname;
- protected final Supplier<Credentials> creds;
- protected final SshClient.Factory sshClientFactory;
- protected final Json json;
-
- protected transient SshClient _connection;
-
- public static class HostException extends RuntimeException {
-
- public HostException(String s, Throwable throwable) {
- super(s, throwable);
- }
-
- public HostException(String s) {
- super(s);
- }
- }
-
- public static class NoResponseException extends Exception {
-
- public NoResponseException() {
- }
- }
-
- @Inject
- protected SmartOSHostController(@Provider Supplier<URI> provider,
- @org.jclouds.location.Provider final Supplier<Credentials> creds, SshClient.Factory sshFactory, Json json) {
- this.hostname = provider.get().getHost();
- this.creds = creds;
- this.sshClientFactory = sshFactory;
- this.json = json;
- }
-
- public String getDescription() {
- return "SmartOS@" + hostname;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public SshClient.Factory getSshClientFactory() {
- return sshClientFactory;
- }
-
- protected SshClient getConnection() {
- if (_connection == null) {
- Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
-
- LoginCredentials credentials = new LoginCredentials.Builder().user(currentCreds.identity)
- .password(currentCreds.credential).build();
-
- _connection = getSshClientFactory().create(HostAndPort.fromParts(hostname, 22), credentials);
-
- _connection.connect();
-
- }
- return _connection;
- }
-
- public String exec(String cmd) {
- return getConnection().exec(cmd).getOutput();
- }
-
- public String vmList() {
- return exec("vmadm list -p");
- }
-
- public Map<String, String> getVMIpAddresses(UUID vmId) {
- ImmutableMap.Builder<String, String> netMapBuilder = ImmutableMap.builder();
-
- String response = getConnection().exec("zlogin " + vmId.toString() + " ifconfig -a4").getOutput();
-
- if (response.length() == 0)
- return ImmutableMap.of();
-
- Iterable<String> strings = Splitter.on("\n").split(response);
- Pattern inetMatcher = Pattern.compile("inet [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}");
-
- String iface = "";
- for (String line : strings) {
- if (line.length() > 0 && Character.isLetterOrDigit(line.charAt(0))) {
- iface = line.substring(0, line.indexOf(":"));
- } else {
- Matcher matcher = inetMatcher.matcher(line);
- if (matcher.find())
- netMapBuilder.put(iface, matcher.group().substring(5));
- }
- }
-
- return netMapBuilder.build();
-
- }
-
- /**
- * What remotely available images are there in the cloud?
- *
- * @return Collection of datasets
- */
- public Iterable<DataSet> getAvailableImages() {
- return toSpecList(exec("dsadm avail"));
- }
-
- public Iterable<DataSet> getLocalDatasets() {
- return toSpecList(exec("dsadm list"));
- }
-
- public Iterable<VM> getVMs() {
- return toVMList(exec("vmadm list -p"));
- }
-
- public VM createVM(VmSpecification specification) {
-
- String specAsJson = json.toJson(specification);
- String response = getConnection().exec("(cat <<END\n" + specAsJson + "\nEND\n) | vmadm create").getOutput();
-
- Pattern uuidPattern = Pattern.compile("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
- Matcher matcher = uuidPattern.matcher(response);
- if (matcher.find()) {
- String uuid = matcher.group();
- return getVM(UUID.fromString(uuid));
- } else {
- throw new HostException("Error creating Host: response = " + response + "\n source = " + specAsJson);
- }
-
- }
-
- private Iterable<DataSet> toSpecList(String string) {
-
- try {
- BufferedReader r = new BufferedReader(new StringReader(string));
- r.readLine(); // Skip
- String line;
- ImmutableList.Builder<DataSet> resultBuilder = ImmutableList.builder();
- while ((line = r.readLine()) != null) {
- DataSet dataset = DataSet.builder().fromDsadmString(line).build();
-
- resultBuilder.add(dataset);
- }
- return resultBuilder.build();
- } catch (IOException e) {
- throw new HostException("Error parsing response when building spec list", e);
- }
- }
-
- private Iterable<VM> toVMList(String string) {
- try {
- BufferedReader r = new BufferedReader(new StringReader(string));
- String line;
- ImmutableList.Builder<VM> resultBuilder = ImmutableList.builder();
- while ((line = r.readLine()) != null) {
- VM vm = VM.builder().fromVmadmString(line).build();
-
- Map<String, String> ipAddresses;
- RateLimiter limiter = RateLimiter.create(1.0);
- for (int i = 0; i < 30; i++) {
- ipAddresses = getVMIpAddresses(vm.getUuid());
- if (!ipAddresses.isEmpty()) {
- // Got some
- String ip = ipAddresses.get("net0");
- if (ip != null && !ip.equals("0.0.0.0")) {
- vm = vm.toBuilder().publicAddress(ip).build();
- break;
- }
- }
-
- limiter.acquire();
- }
-
- resultBuilder.add(vm);
- }
- return resultBuilder.build();
- } catch (IOException e) {
- throw new HostException("Error parsing response when building VM list", e);
- }
- }
-
- public VM getVM(UUID serverId) {
- for (VM vm : getVMs())
- if (vm.getUuid().equals(serverId))
- return vm;
- return null;
- }
-
- public DataSet getDataSet(UUID imageId) {
- for (DataSet ds : getLocalDatasets()) {
- if (ds.getUuid().equals(imageId))
- return ds;
- }
- return null;
- }
-
- public void destroyHost(UUID uuid) {
- exec("vmadm delete " + uuid.toString());
- }
-
- public void rebootHost(UUID uuid) {
- exec("vmadm reboot " + uuid.toString());
- }
-
- public void stopHost(UUID uuid) {
- exec("vmadm stop -p");
- }
-
- public void startHost(UUID uuid) {
- exec("vmadm start " + uuid.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSComputeServiceContextModule.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSComputeServiceContextModule.java
deleted file mode 100644
index cf57c4b..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSComputeServiceContextModule.java
+++ /dev/null
@@ -1,57 +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.smartos.compute.config;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.domain.Location;
-import org.jclouds.smartos.SmartOSHostController;
-import org.jclouds.smartos.compute.domain.DataSet;
-import org.jclouds.smartos.compute.domain.VM;
-import org.jclouds.smartos.compute.domain.VmSpecification;
-import org.jclouds.smartos.compute.functions.DataSetToImage;
-import org.jclouds.smartos.compute.functions.DatacenterToLocation;
-import org.jclouds.smartos.compute.functions.VMToNodeMetadata;
-import org.jclouds.smartos.compute.functions.VmSpecificationToHardware;
-import org.jclouds.smartos.compute.strategy.SmartOSComputeServiceAdapter;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-public class SmartOSComputeServiceContextModule extends
- ComputeServiceAdapterContextModule<VM, VmSpecification, DataSet, SmartOSHostController> {
-
- @Override
- protected void configure() {
- super.configure();
- bind(new TypeLiteral<ComputeServiceAdapter<VM, VmSpecification, DataSet, SmartOSHostController>>() {
- }).to(SmartOSComputeServiceAdapter.class);
- bind(new TypeLiteral<Function<VM, NodeMetadata>>() {
- }).to(VMToNodeMetadata.class);
- bind(new TypeLiteral<Function<DataSet, org.jclouds.compute.domain.Image>>() {
- }).to(DataSetToImage.class);
- bind(new TypeLiteral<Function<VmSpecification, org.jclouds.compute.domain.Hardware>>() {
- }).to(VmSpecificationToHardware.class);
- bind(new TypeLiteral<Function<SmartOSHostController, Location>>() {
- }).to(DatacenterToLocation.class);
- // to have the compute service adapter override default locations
- // install(new LocationsFromComputeServiceAdapterModule<VM, VmSpecification, DataSet,
- // SmartOSHost>(){});
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSParserModule.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSParserModule.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSParserModule.java
deleted file mode 100644
index dc7be0f..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/config/SmartOSParserModule.java
+++ /dev/null
@@ -1,61 +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.smartos.compute.config;
-
-import java.lang.reflect.Type;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.smartos.compute.domain.DataSet;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonPrimitive;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-public class SmartOSParserModule extends AbstractModule {
-
- @Provides
- @Singleton
- public Map<Type, Object> provideCustomAdapterBindings() {
- return ImmutableMap.<Type, Object> of(DataSet.class, new FlattenDataset());
- }
-
- public static class FlattenDataset implements JsonSerializer<DataSet>, JsonDeserializer<DataSet> {
- @Override
- public JsonElement serialize(DataSet dataset, Type type, JsonSerializationContext jsonSerializationContext) {
- return new JsonPrimitive(dataset.getUuid().toString());
- }
-
- @Override
- public DataSet deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
- throws JsonParseException {
- return DataSet.builder().uuid(json.getAsString()).build();
- }
- }
-
- @Override
- protected void configure() {
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/DataSet.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/DataSet.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/DataSet.java
deleted file mode 100644
index e3a9c65..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/DataSet.java
+++ /dev/null
@@ -1,149 +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.smartos.compute.domain;
-
-import java.util.UUID;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Dataset is a pre-built image ready to be cloned.
- */
-public class DataSet {
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().fromDataSet(this);
- }
-
- public static class Builder {
-
- private UUID uuid;
- private String os;
- private String published;
- private String urn;
-
- public Builder uuid(UUID uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public Builder uuid(String uuid) {
- this.uuid = UUID.fromString(uuid);
- return this;
- }
-
- public Builder os(String os) {
- this.os = os;
- return this;
- }
-
- public Builder published(String published) {
- this.published = published;
- return this;
- }
-
- public Builder urn(String urn) {
- this.urn = urn;
- return this;
- }
-
- public Builder fromDsadmString(String string) {
- String[] sections = string.split(" ");
-
- uuid(sections[0]);
- os(sections[1]);
- published(sections[2]);
- urn(sections[3]);
-
- return this;
- }
-
- public DataSet build() {
- return new DataSet(uuid, os, published, urn);
- }
-
- public Builder fromDataSet(DataSet in) {
- return uuid(in.getUuid()).os(in.getOs()).published(in.getPublished()).urn(in.getUrn());
- }
- }
-
- private final UUID uuid;
- private final String os;
- private final String published;
- private final String urn;
-
- protected DataSet(UUID uuid, String os, String published, String urn) {
- this.uuid = uuid;
- this.os = os;
- this.published = published;
- this.urn = urn;
- }
-
- public UUID getUuid() {
- return uuid;
- }
-
- public String getOs() {
- return os;
- }
-
- public String getPublished() {
- return published;
- }
-
- public String getUrn() {
- return urn;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- // UUID is primary key
- return uuid.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- return uuid.equals(((DataSet) obj).uuid);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues().add("uuid", uuid).add("os", os).add("published", published)
- .add("urn", urn).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VM.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VM.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VM.java
deleted file mode 100644
index d81127f..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VM.java
+++ /dev/null
@@ -1,187 +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.smartos.compute.domain;
-
-import java.util.UUID;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-
-/**
- * Representing a Virtual Machine (Zone / KVM )
- **/
-public class VM {
-
- public enum State {
- RUNNING, STOPPED, INCOMPLETE
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().fromVM(this);
- }
-
- public static class Builder {
-
- private Optional<String> publicAddress = Optional.absent();
- private UUID uuid;
- private String type;
- private String ram;
- private State state = State.STOPPED;
- private String alias;
-
- public Builder uuid(UUID uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public Builder uuid(String uuid) {
- this.uuid = UUID.fromString(uuid);
- return this;
- }
-
- public Builder publicAddress(String publicAddress) {
- this.publicAddress = Optional.fromNullable(publicAddress);
- return this;
- }
-
- public Builder type(String type) {
- this.type = type;
- return this;
- }
-
- public Builder ram(String ram) {
- this.ram = ram;
- return this;
- }
-
- public Builder state(String state) {
- this.state = State.valueOf(state.toUpperCase());
- return this;
- }
-
- public Builder state(State state) {
- this.state = state;
- return this;
- }
-
- public Builder alias(String alias) {
- this.alias = alias;
- return this;
- }
-
- public Builder fromVmadmString(String string) {
- String[] sections = string.split(":");
-
- uuid(sections[0]);
-
- type(sections[1]);
- ram(sections[2]);
- state(sections[3]);
-
- if (sections.length > 4)
- alias(sections[4]);
-
- return this;
- }
-
- public VM build() {
- return new VM(publicAddress, uuid, type, ram, state, alias);
- }
-
- public Builder fromVM(VM in) {
- return publicAddress(in.getPublicAddress().orNull()).uuid(in.getUuid()).type(in.getType()).ram(in.getRam())
- .state(in.getState()).alias(in.getAlias());
- }
- }
-
- private Optional<String> publicAddress;
- private final UUID uuid;
- private String type;
- private String ram;
- private State state;
- private String alias;
-
- protected VM(Optional<String> publicAddress, UUID uuid, String type, String ram, State state, String alias) {
- this.publicAddress = publicAddress;
- this.uuid = uuid;
- this.type = type;
- this.ram = ram;
- this.state = state;
- this.alias = alias;
- }
-
- public State getState() {
- return state;
- }
-
- public Optional<String> getPublicAddress() {
- return publicAddress;
- }
-
- public UUID getUuid() {
- return uuid;
- }
-
- public String getType() {
- return type;
- }
-
- public String getRam() {
- return ram;
- }
-
- public String getAlias() {
- return alias;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- // UUID is primary key
- return uuid.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- return uuid.equals(((VM) obj).getUuid());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues().add("uuid", uuid).add("type", type).add("ram", ram)
- .add("alias", alias).add("publicAddress", publicAddress.orNull()).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmNIC.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmNIC.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmNIC.java
deleted file mode 100644
index 285b4c0..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmNIC.java
+++ /dev/null
@@ -1,135 +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.smartos.compute.domain;
-
-import java.beans.ConstructorProperties;
-
-import javax.inject.Named;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Specification of a network card.
- */
-public class VmNIC {
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().fromVmNIC(this);
- }
-
- public static class Builder {
-
- private String tag = "admin";
- private String ip;
- private String netmask;
- private String gateway;
-
- public Builder simpleDHCPNic() {
- tag = "admin";
- ip = "dhcp";
- return this;
- }
-
- public Builder tag(String tag) {
- this.tag = tag;
- return this;
- }
-
- public Builder ip(String ip) {
- this.ip = ip;
- return this;
- }
-
- public Builder netmask(String netmask) {
- this.netmask = netmask;
- return this;
- }
-
- public Builder gateway(String gateway) {
- this.gateway = gateway;
- return this;
- }
-
- public VmNIC build() {
- return new VmNIC(tag, ip, netmask, gateway);
- }
-
- public Builder fromVmNIC(VmNIC in) {
- return tag(in.getTag()).ip(in.getIp()).netmask(in.getNetmask()).gateway(in.getGateway());
- }
- }
-
- @Named("nic_tag")
- private final String tag;
- private final String ip;
- private final String netmask;
- private final String gateway;
-
- @ConstructorProperties({ "nic_tag", "ip", "netmask", "gateway" })
- protected VmNIC(String tag, String ip, String netmask, String gateway) {
- this.tag = tag;
- this.ip = ip;
- this.netmask = netmask;
- this.gateway = gateway;
- }
-
- public String getTag() {
- return tag;
- }
-
- public String getIp() {
- return ip;
- }
-
- public String getNetmask() {
- return netmask;
- }
-
- public String getGateway() {
- return gateway;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(tag, ip, netmask, gateway);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
- VmNIC that = VmNIC.class.cast(obj);
- return Objects.equal(this.tag, that.tag) && Objects.equal(this.ip, that.ip)
- && Objects.equal(this.netmask, that.netmask) && Objects.equal(this.gateway, that.gateway);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues().add("tag", tag).add("ip", ip).add("netmask", netmask)
- .add("gateway", gateway).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmSpecification.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmSpecification.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmSpecification.java
deleted file mode 100644
index 0aaf52c..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/domain/VmSpecification.java
+++ /dev/null
@@ -1,236 +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.smartos.compute.domain;
-
-import java.beans.ConstructorProperties;
-import java.util.List;
-
-import javax.inject.Named;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-
-/**
- * Specification of a VM to build, based on a dataset.
- */
-public class VmSpecification {
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().fromVmSpecification(this);
- }
-
- public static class Builder {
-
- private String alias;
- private String brand = "joyent";
- private DataSet dataset;
- private String dnsDomain = "local";
- private String quota = "0";
-
- private int maxPhysicalMemory = 256;
- private int maxLockedMemory = 256;
- private int maxSwap = 256;
- private int tmpFs = 256;
-
- private ImmutableList.Builder<VmNIC> nics = ImmutableList.<VmNIC> builder();
-
- public Builder alias(String alias) {
- this.alias = alias;
- return this;
- }
-
- public Builder brand(String brand) {
- this.brand = brand;
- return this;
- }
-
- public Builder dataset(DataSet dataset) {
- this.dataset = dataset;
- return this;
- }
-
- public Builder dnsDomain(String dnsDomain) {
- this.dnsDomain = dnsDomain;
- return this;
- }
-
- public Builder quota(String quota) {
- this.quota = quota;
- return this;
- }
-
- public Builder nics(Iterable<VmNIC> nics) {
- this.nics.addAll(nics);
- return this;
- }
-
- public Builder nic(VmNIC nic) {
- this.nics.add(nic);
- return this;
- }
-
- public Builder maxPhysicalMemory(int maxPhysicalMemory) {
- this.maxPhysicalMemory = maxPhysicalMemory;
- return this;
- }
-
- public Builder maxLockedMemory(int maxLockedMemory) {
- this.maxLockedMemory = maxLockedMemory;
- return this;
- }
-
- public Builder maxSwap(int maxSwap) {
- this.maxSwap = maxSwap;
- return this;
- }
-
- public Builder tmpFs(int tmpFs) {
- this.tmpFs = tmpFs;
- return this;
- }
-
- public Builder ram(int ram) {
- this.maxPhysicalMemory = ram;
- this.maxLockedMemory = ram;
- this.maxSwap = ram;
- this.tmpFs = ram;
- return this;
- }
-
- public VmSpecification build() {
- return new VmSpecification(alias, brand, dataset, dnsDomain, quota, maxPhysicalMemory, maxLockedMemory,
- maxSwap, tmpFs, nics.build());
- }
-
- public Builder fromVmSpecification(VmSpecification in) {
- return alias(in.getAlias()).brand(in.getBrand()).dataset(in.getDataset()).dnsDomain(in.getDnsDomain())
- .quota(in.getQuota()).maxPhysicalMemory(in.getMaxPhysicalMemory())
- .maxLockedMemory(in.getMaxLockedMemory()).maxSwap(in.getMaxSwap()).tmpFs(in.getTmpFs())
- .nics(in.getNics());
- }
- }
-
- private final String alias;
- private final String brand;
- @Named("dataset_uuid")
- private final DataSet dataset;
- @Named("dns_domain")
- private final String dnsDomain;
- private final String quota;
- @Named("max_physical_memory")
- private final int maxPhysicalMemory;
- @Named("max_locked_memory")
- private final int maxLockedMemory;
- @Named("max_swap")
- private final int maxSwap;
- @Named("tmpfs")
- private final int tmpFs;
- private final List<VmNIC> nics;
-
- @ConstructorProperties({ "alias", "brand", "dataset_uuid", "dns_domain", "quota", "max_physical_memory",
- "max_locked_memory", "max_swap", "tmpfs", "nics" })
- protected VmSpecification(String alias, String brand, DataSet dataset, String dnsDomain, String quota,
- int maxPhysicalMemory, int maxLockedMemory, int maxSwap, int tmpFs, List<VmNIC> nics) {
- this.alias = alias;
- this.brand = brand;
- this.dataset = dataset;
- this.dnsDomain = dnsDomain;
- this.quota = quota;
- this.maxPhysicalMemory = maxPhysicalMemory;
- this.maxLockedMemory = maxLockedMemory;
- this.maxSwap = maxSwap;
- this.tmpFs = tmpFs;
- this.nics = ImmutableList.copyOf(nics);
- }
-
- public String getAlias() {
- return alias;
- }
-
- public String getBrand() {
- return brand;
- }
-
- public DataSet getDataset() {
- return dataset;
- }
-
- public String getDnsDomain() {
- return dnsDomain;
- }
-
- public String getQuota() {
- return quota;
- }
-
- public int getMaxPhysicalMemory() {
- return maxPhysicalMemory;
- }
-
- public int getMaxLockedMemory() {
- return maxLockedMemory;
- }
-
- public int getMaxSwap() {
- return maxSwap;
- }
-
- public int getTmpFs() {
- return tmpFs;
- }
-
- public List<VmNIC> getNics() {
- return nics;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(alias, brand, dataset, dnsDomain, quota, maxPhysicalMemory, maxLockedMemory, maxSwap,
- tmpFs, nics);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
- VmSpecification that = VmSpecification.class.cast(obj);
- return Objects.equal(this.alias, that.alias) && Objects.equal(this.brand, that.brand)
- && Objects.equal(this.dataset, that.dataset) && Objects.equal(this.dnsDomain, that.dnsDomain)
- && Objects.equal(this.quota, that.quota)
- && Objects.equal(this.maxPhysicalMemory, that.maxPhysicalMemory)
- && Objects.equal(this.maxLockedMemory, that.maxLockedMemory)
- && Objects.equal(this.maxSwap, that.maxSwap) && Objects.equal(this.tmpFs, that.tmpFs)
- && Objects.equal(this.nics, that.nics);
-
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues().add("alias", alias).add("brand", brand)
- .add("dataset_uuid", dataset != null ? dataset.getUuid() : null).add("dns_domain", dnsDomain)
- .add("quota", quota).add("max_physical_memory", maxPhysicalMemory)
- .add("max_locked_memory", maxLockedMemory).add("max_swap", maxSwap).add("tmpfs", tmpFs)
- .add("nics", nics).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DataSetToImage.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DataSetToImage.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DataSetToImage.java
deleted file mode 100644
index 5b58e22..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DataSetToImage.java
+++ /dev/null
@@ -1,59 +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.smartos.compute.functions;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.smartos.compute.domain.DataSet;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class DataSetToImage implements Function<DataSet, Image> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- @Override
- public Image apply(DataSet from) {
-
- ImageBuilder builder = new ImageBuilder();
- builder.ids(from.getUuid() + "");
- builder.name(from.getUrn());
- builder.description(from.getUrn());
- builder.status(Image.Status.AVAILABLE);
-
- OsFamily family;
- try {
- family = OsFamily.SOLARIS;
- builder.operatingSystem(new OperatingSystem.Builder().name(from.getUrn()).description(from.getUrn())
- .family(family).build());
- } catch (IllegalArgumentException e) {
- logger.debug("<< didn't match os(%s)", from);
- }
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DatacenterToLocation.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DatacenterToLocation.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DatacenterToLocation.java
deleted file mode 100644
index a14a27a..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/DatacenterToLocation.java
+++ /dev/null
@@ -1,49 +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.smartos.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.smartos.SmartOSHostController;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-@Singleton
-public class DatacenterToLocation implements Function<SmartOSHostController, Location> {
- private final Provider<Supplier<Location>> provider;
-
- // allow us to lazy discover the provider of a resource
- @Inject
- public DatacenterToLocation(Provider<Supplier<Location>> provider) {
- this.provider = checkNotNull(provider, "provider");
- }
-
- @Override
- public Location apply(SmartOSHostController from) {
- return new LocationBuilder().scope(LocationScope.ZONE).id(from.getHostname() + "")
- .description(from.getDescription()).parent(provider.get().get()).build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VMToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VMToNodeMetadata.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VMToNodeMetadata.java
deleted file mode 100644
index a0aa88a..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VMToNodeMetadata.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.smartos.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.FluentIterable.from;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.predicates.HardwarePredicates;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.jclouds.domain.Credentials;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.location.predicates.LocationPredicates;
-import org.jclouds.smartos.compute.domain.VM;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-@Singleton
-public class VMToNodeMetadata implements Function<VM, NodeMetadata> {
-
- public static final Map<VM.State, NodeMetadata.Status> serverStatusToNodeStatus = ImmutableMap
- .<VM.State, NodeMetadata.Status> builder().put(VM.State.RUNNING, NodeMetadata.Status.RUNNING)//
- .put(VM.State.STOPPED, NodeMetadata.Status.SUSPENDED)//
- .put(VM.State.INCOMPLETE, NodeMetadata.Status.PENDING)//
- .build();
-
- private final Supplier<Set<? extends Hardware>> hardware;
- private final Supplier<Set<? extends Location>> locations;
- private final Supplier<Set<? extends Image>> images;
- private final Map<String, Credentials> credentialStore;
- private final GroupNamingConvention nodeNamingConvention;
-
- @Inject
- VMToNodeMetadata(Map<String, Credentials> credentialStore, @Memoized Supplier<Set<? extends Hardware>> hardware,
- @Memoized Supplier<Set<? extends Location>> locations, @Memoized Supplier<Set<? extends Image>> images,
- GroupNamingConvention.Factory namingConvention) {
- this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
- this.credentialStore = checkNotNull(credentialStore, "credentialStore");
- this.hardware = checkNotNull(hardware, "hardware");
- this.locations = checkNotNull(locations, "locations");
- this.images = checkNotNull(images, "images");
- }
-
- @Override
- public NodeMetadata apply(VM from) {
- // convert the result object to a jclouds NodeMetadata
- NodeMetadataBuilder builder = new NodeMetadataBuilder();
- builder.ids(from.getUuid() + "");
- builder.name(from.getAlias());
- builder.location(from(locations.get()).firstMatch(LocationPredicates.idEquals(from.getUuid() + "")).orNull());
- builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getType()));
- builder.imageId(from.getType() + "");
- Image image = from(images.get()).firstMatch(ImagePredicates.idEquals(from.getUuid() + "")).orNull();
- if (image != null)
- builder.operatingSystem(image.getOperatingSystem());
- builder.hardware(from(hardware.get()).firstMatch(HardwarePredicates.idEquals(from.getUuid() + "")).orNull());
- builder.status(serverStatusToNodeStatus.get(from.getState()));
- try {
- if (from.getState() == VM.State.RUNNING) {
- Optional<String> ip = from.getPublicAddress();
- if (ip.isPresent()) {
- builder.publicAddresses(ImmutableSet.<String> of(ip.get()));
- builder.privateAddresses(ImmutableSet.<String> of(ip.get()));
- }
- }
- } catch (Exception ex) {
- // None?
- }
- // builder.privateAddresses(ImmutableSet.<String> of(from.privateAddress));
- builder.credentials(LoginCredentials.fromCredentials(credentialStore.get(from.getUuid() + "")));
- return builder.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VmSpecificationToHardware.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VmSpecificationToHardware.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VmSpecificationToHardware.java
deleted file mode 100644
index 9cbcf98..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/functions/VmSpecificationToHardware.java
+++ /dev/null
@@ -1,43 +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.smartos.compute.functions;
-
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.smartos.compute.domain.VmSpecification;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-
-@Singleton
-public class VmSpecificationToHardware implements Function<VmSpecification, Hardware> {
-
- @Override
- public Hardware apply(VmSpecification from) {
- HardwareBuilder builder = new HardwareBuilder();
- builder.ids(from.getAlias());
- builder.name(from.getAlias());
- builder.processors(ImmutableList.of(new Processor(1, 1.0)));
- builder.ram(from.getMaxPhysicalMemory());
- // builder.volumes(ImmutableList.<Volume> of(new VolumeImpl(from.disk, true, false)));
- return builder.build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java b/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java
deleted file mode 100644
index 5fdab9b..0000000
--- a/smartos-ssh/src/main/java/org/jclouds/smartos/compute/strategy/SmartOSComputeServiceAdapter.java
+++ /dev/null
@@ -1,156 +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.smartos.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.smartos.SmartOSHostController;
-import org.jclouds.smartos.compute.domain.DataSet;
-import org.jclouds.smartos.compute.domain.VM;
-import org.jclouds.smartos.compute.domain.VmNIC;
-import org.jclouds.smartos.compute.domain.VmSpecification;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-/**
- * defines the connection between the {@link org.jclouds.smartos.compute.domain.SmartOSHostController}
- * implementation and the jclouds {@link ComputeService}
- */
-@Singleton
-public class SmartOSComputeServiceAdapter implements ComputeServiceAdapter<VM, VmSpecification, DataSet, SmartOSHostController> {
- private final SmartOSHostController host;
- private final Map<String, VmSpecification> specificationMap;
-
-
- @Inject
- public SmartOSComputeServiceAdapter(SmartOSHostController host) {
- this.host = checkNotNull(host, "host");
-
- Collection<VmSpecification> specifications = Lists.newArrayList();
-
- specifications.add(VmSpecification.builder().alias("Standard Joyent VM, 1Gb RAM / 2Gb SWAP").ram(1024).maxSwap(2048)
- .nic(VmNIC.builder().simpleDHCPNic().build()).build());
-
- specifications.add(VmSpecification.builder().alias("Standard Joyent VM, 2Gb RAM / 4Gb SWAP").ram(2048).maxSwap(4096)
- .nic(VmNIC.builder().simpleDHCPNic().build()).build());
-
- specifications.add(VmSpecification.builder().alias("Standard Joyent VM, 4Gb RAM / 8Gb SWAP").ram(4096).maxSwap(8192)
- .nic(VmNIC.builder().simpleDHCPNic().build()).build());
-
- specifications.add(VmSpecification.builder().alias("Standard Joyent VM, 8Gb RAM / 16Gb SWAP").ram(8192).maxSwap(16384)
- .nic(VmNIC.builder().simpleDHCPNic().build()).build());
-
- specificationMap = Maps.uniqueIndex(specifications, new Function<VmSpecification,String>() {
- @Override
- public String apply(VmSpecification input) {
- return input.getAlias();
- }
- });
-
- }
-
- private SmartOSHostController getHost() {
- return host;
- }
-
- @Override
- public NodeAndInitialCredentials<VM> createNodeWithGroupEncodedIntoName(String tag, String name, Template template) {
-
- VmSpecification.Builder builder = VmSpecification.builder();
- String providerId = template.getHardware().getProviderId();
-
- if (specificationMap.containsKey(providerId)) {
- builder.fromVmSpecification( specificationMap.get(providerId) );
- } else {
- builder.nic(VmNIC.builder().simpleDHCPNic().build());
- }
-
- VmSpecification specification = builder.alias(name)
- .dataset(getHost().getDataSet(UUID.fromString(template.getImage().getProviderId())))
- .build();
-
- VM from = getHost().createVM(specification);
-
- return new NodeAndInitialCredentials<VM>(from, from.getUuid() + "", LoginCredentials.builder().user("smartos")
- .password("smartos").build());
- }
-
-
-
- @Override
- public Iterable<VmSpecification> listHardwareProfiles() {
- return specificationMap.values();
- }
-
- @Override
- public Iterable<DataSet> listImages() {
- return getHost().getLocalDatasets();
- }
-
- @Override
- public DataSet getImage(String id) {
- return getHost().getDataSet(UUID.fromString(id));
- }
-
- @Override
- public Iterable<VM> listNodes() {
- return getHost().getVMs();
- }
-
- @Override
- public Iterable<SmartOSHostController> listLocations() {
- return ImmutableSet.of();
- }
-
- @Override
- public VM getNode(String id) {
- return getHost().getVM(UUID.fromString(id));
- }
-
- @Override
- public void destroyNode(String id) {
- getHost().destroyHost(UUID.fromString(id));
- }
-
- @Override
- public void rebootNode(String id) {
- getHost().rebootHost(UUID.fromString(id));
- }
-
- @Override
- public void resumeNode(String id) {
- getHost().startHost(UUID.fromString(id));
- }
-
- @Override
- public void suspendNode(String id) {
- getHost().stopHost(UUID.fromString(id));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/smartos-ssh/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
deleted file mode 100644
index 04d5659..0000000
--- a/smartos-ssh/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.smartos.SmartOSApiMetadata
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceContextBuilderTest.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceContextBuilderTest.java b/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceContextBuilderTest.java
deleted file mode 100644
index 41cf033..0000000
--- a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceContextBuilderTest.java
+++ /dev/null
@@ -1,76 +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.smartos.compute;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.internal.ContextImpl;
-import org.jclouds.smartos.SmartOSApiMetadata;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-@Test(groups = "unit", testName = "ServerManagerContextBuilderTest")
-public class SmartOSManagerComputeServiceContextBuilderTest {
-
- @Test
- public void testCanBuildWithApiMetadata() {
- ComputeServiceContext context = ContextBuilder.newBuilder(new SmartOSApiMetadata())
- .modules(ImmutableSet.<Module> of(getSshModule())).build(ComputeServiceContext.class);
- context.close();
- }
-
- @Test
- public void testCanBuildById() {
- ComputeServiceContext context = ContextBuilder.newBuilder("smartos-ssh")
- .modules(ImmutableSet.<Module> of(getSshModule())).build(ComputeServiceContext.class);
- context.close();
- }
-
- @Test
- public void testCanBuildWithOverridingProperties() {
- Properties overrides = new Properties();
- overrides.setProperty("smartos-ssh.endpoint", "http://host");
- overrides.setProperty("smartos-ssh.api-version", "1");
-
- ComputeServiceContext context = ContextBuilder.newBuilder("smartos-ssh")
- .modules(ImmutableSet.<Module> of(getSshModule())).overrides(overrides)
- .build(ComputeServiceContext.class);
-
- context.close();
- }
-
- @Test
- public void testUnwrapIsCorrectType() {
- ComputeServiceContext context = ContextBuilder.newBuilder("smartos-ssh")
- .modules(ImmutableSet.<Module> of(getSshModule())).build(ComputeServiceContext.class);
-
- assertEquals(context.unwrap().getClass(), ContextImpl.class);
-
- context.close();
- }
-
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceLiveTest.java b/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceLiveTest.java
deleted file mode 100644
index de76392..0000000
--- a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/SmartOSManagerComputeServiceLiveTest.java
+++ /dev/null
@@ -1,54 +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.smartos.compute;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-@Test(groups = "live", enabled = true, singleThreaded = true)
-public class SmartOSManagerComputeServiceLiveTest extends BaseComputeServiceLiveTest {
-
- public SmartOSManagerComputeServiceLiveTest() {
- provider = "smartos-ssh";
- }
-
- @Test
- public void testTemplateBuilder() {
- Template defaultTemplate = client.templateBuilder().build();
- assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3");
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
- assertEquals(defaultTemplate.getLocation().getId(), "1");
- assertEquals(getCores(defaultTemplate.getHardware()), 0.5d);
- }
-
- // smartos-ssh does not support metadata
- @Override
- protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
- assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
- "node userMetadata did not match %s %s", userMetadata, node);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/DataSetTest.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/DataSetTest.java b/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/DataSetTest.java
deleted file mode 100644
index d65a16d..0000000
--- a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/DataSetTest.java
+++ /dev/null
@@ -1,55 +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.smartos.compute.domain;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.UUID;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "DataSetTest")
-public class DataSetTest {
-
- @Test
- public void testParse() throws IOException {
- // Response from console from a 'dsadm list'
- InputStream is = getClass().getResourceAsStream("dsadm-list-response.txt");
-
- BufferedReader r = new BufferedReader(new InputStreamReader(is));
- String line = r.readLine(); // skip line
- ImmutableList.Builder<DataSet> resultBuilder = ImmutableList.builder();
- while ((line = r.readLine()) != null) {
- DataSet ds = DataSet.builder().fromDsadmString(line).build();
-
- resultBuilder.add(ds);
- }
- List<DataSet> dataSetList = resultBuilder.build();
-
- Assert.assertEquals(10, dataSetList.size());
-
- Assert.assertEquals(UUID.fromString("c0ffee88-883e-47cf-80d1-ad71cc872180"), dataSetList.get(0).getUuid());
- Assert.assertEquals("nrm:nrm:realtime-jenkins:1.7", dataSetList.get(0).getUrn());
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/VMTest.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/VMTest.java b/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/VMTest.java
deleted file mode 100644
index 0f36d96..0000000
--- a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/domain/VMTest.java
+++ /dev/null
@@ -1,55 +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.smartos.compute.domain;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.UUID;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-@Test(groups = "unit", testName = "VMTest")
-public class VMTest {
-
- @Test
- public void testParse() throws IOException {
- // Response from console from a 'vmadm list -p'
- InputStream is = getClass().getResourceAsStream("vmadm-list-response.txt");
-
- BufferedReader r = new BufferedReader(new InputStreamReader(is));
- String line = null;
- ImmutableList.Builder<VM> resultBuilder = ImmutableList.builder();
- while ((line = r.readLine()) != null) {
- VM vm = VM.builder().fromVmadmString(line).build();
-
- resultBuilder.add(vm);
- }
- List<VM> vmList = resultBuilder.build();
-
- Assert.assertEquals(2, vmList.size());
-
- Assert.assertEquals(UUID.fromString("60bd2ae5-4e4d-4952-88f9-1b850259d914"), vmList.get(0).getUuid());
- Assert.assertEquals(VM.State.STOPPED, vmList.get(0).getState());
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1795ff7e/smartos-ssh/src/test/java/org/jclouds/smartos/compute/parse/ParseVmSpecificationTest.java
----------------------------------------------------------------------
diff --git a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/parse/ParseVmSpecificationTest.java b/smartos-ssh/src/test/java/org/jclouds/smartos/compute/parse/ParseVmSpecificationTest.java
deleted file mode 100644
index 351c9ba..0000000
--- a/smartos-ssh/src/test/java/org/jclouds/smartos/compute/parse/ParseVmSpecificationTest.java
+++ /dev/null
@@ -1,68 +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.smartos.compute.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.json.BaseItemParserTest;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.smartos.compute.config.SmartOSParserModule;
-import org.jclouds.smartos.compute.domain.DataSet;
-import org.jclouds.smartos.compute.domain.VmNIC;
-import org.jclouds.smartos.compute.domain.VmSpecification;
-import org.testng.annotations.Test;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-@Test(groups = "unit", testName = "ParseVmSpecificationTest")
-public class ParseVmSpecificationTest extends BaseItemParserTest<VmSpecification> {
-
- @Override
- public String resource() {
- return "/vmspec.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public VmSpecification expected() {
- return VmSpecification.builder()
- .alias("small")
- .brand("joyent")
- .dataset(DataSet.builder()
- .uuid("56108678-1183-11e1-83c3-ff3185a5b47f")
- .os("linux")
- .published("2011-11-18")
- .urn("sdc:sdc:ubuntu10.04:0.1.0").build())
- .nic(VmNIC.builder()
- .ip("192.168.1.4")
- .gateway("192.168.1.1")
- .netmask("255.255.255.0")
- .tag("eth0").build())
- .dnsDomain("local")
- .quota("0")
- .maxPhysicalMemory(256)
- .maxLockedMemory(256)
- .maxSwap(256)
- .tmpFs(256).build();
- }
-
- protected Injector injector() {
- return Guice.createInjector(new SmartOSParserModule(), new GsonModule());
- }
-}