Copyrignt header added, warnings in test are supressed of fixed

This commit is contained in:
Dmitri Babaev 2011-04-27 18:11:52 +04:00
parent b16a74eb47
commit 01706954dd
11 changed files with 123 additions and 27 deletions

View File

@ -52,7 +52,7 @@ public class ParseFaultFromJsonResponseTest {
public void testApplyInputStream() { public void testApplyInputStream() {
InputStream is = getClass().getResourceAsStream("/test_list_servers.json"); InputStream is = getClass().getResourceAsStream("/test_list_servers.json");
@SuppressWarnings("unused")
UnwrapOnlyJsonValue<List<Server>> parser = i.getInstance(Key UnwrapOnlyJsonValue<List<Server>> parser = i.getInstance(Key
.get(new TypeLiteral<UnwrapOnlyJsonValue<List<Server>>>() { .get(new TypeLiteral<UnwrapOnlyJsonValue<List<Server>>>() {
})); }));

View File

@ -46,8 +46,6 @@ import java.util.SimpleTimeZone;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertEquals;
/** /**
* Tests behavior of {@code ParseServerFromJsonResponse} * Tests behavior of {@code ParseServerFromJsonResponse}
* *

View File

@ -1,3 +1,21 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.openstack.nova.live; package org.jclouds.openstack.nova.live;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;

View File

@ -1,7 +1,43 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.openstack.nova.live.compute; package org.jclouds.openstack.nova.live.compute;
import com.google.common.collect.ImmutableSet; import static com.google.common.base.Predicates.and;
import com.google.inject.Guice; import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Sets.filter;
import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
import static org.jclouds.compute.predicates.NodePredicates.all;
import static org.jclouds.compute.predicates.NodePredicates.inGroup;
import static org.jclouds.openstack.nova.live.PropertyHelper.setupKeyPair;
import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides;
import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jclouds.compute.ComputeService; import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
@ -23,21 +59,8 @@ import org.jclouds.ssh.jsch.JschSshClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import java.io.IOException; import com.google.common.collect.ImmutableSet;
import java.net.URISyntaxException; import com.google.inject.Guice;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Sets.filter;
import static org.jclouds.compute.predicates.NodePredicates.*;
import static org.jclouds.openstack.nova.live.PropertyHelper.*;
import static org.testng.Assert.assertEquals;
/** /**
* @author Victor Galkin * @author Victor Galkin
@ -62,7 +85,7 @@ public class ComputeBase {
} }
@SuppressWarnings("unused")
private RetryablePredicate<IPSocket> buildSocket() { private RetryablePredicate<IPSocket> buildSocket() {
SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class); SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class);
return new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS); return new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);

View File

@ -1,3 +1,21 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.openstack.nova.live.compute; package org.jclouds.openstack.nova.live.compute;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -137,6 +137,7 @@ public class NovaComputeServiceLiveTest extends ComputeBase {
awaitForSshPort(address, new Credentials("root", keyPair.get("private"))); awaitForSshPort(address, new Credentials("root", keyPair.get("private")));
OperatingSystem os = node.getOperatingSystem(); OperatingSystem os = node.getOperatingSystem();
try { try {
@SuppressWarnings("unused")
Map<? extends NodeMetadata, ExecResponse> responses = runJavaInstallationScriptWithCreds(group, os, new Credentials( Map<? extends NodeMetadata, ExecResponse> responses = runJavaInstallationScriptWithCreds(group, os, new Credentials(
"root", "romeo")); "root", "romeo"));
} catch (RunScriptOnNodesException e) { } catch (RunScriptOnNodesException e) {
@ -161,6 +162,7 @@ public class NovaComputeServiceLiveTest extends ComputeBase {
checkNodes(Sets.<NodeMetadata>newHashSet(node), group); checkNodes(Sets.<NodeMetadata>newHashSet(node), group);
@SuppressWarnings("unused")
Credentials good = node.getCredentials(); Credentials good = node.getCredentials();
//TODO check good is being private key .overrideCredentialsWith //TODO check good is being private key .overrideCredentialsWith
//TODO test for .blockOnPort //TODO test for .blockOnPort
@ -322,6 +324,7 @@ public class NovaComputeServiceLiveTest extends ComputeBase {
@Test(timeOut = 60000) @Test(timeOut = 60000)
public void testCreateAndRunService() throws Exception { public void testCreateAndRunService() throws Exception {
@SuppressWarnings("unused")
NodeMetadata node = getDefaultNodeImmediately(group); NodeMetadata node = getDefaultNodeImmediately(group);
//TODO .inboundPorts //TODO .inboundPorts
//checkHttpGet(node); //checkHttpGet(node);

View File

@ -1,3 +1,21 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.openstack.nova.live.compute; package org.jclouds.openstack.nova.live.compute;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;

View File

@ -1,3 +1,21 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.openstack.nova.live.novaclient; package org.jclouds.openstack.nova.live.novaclient;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@ -32,15 +50,12 @@ public class ClientBase {
protected int testImageId = 95; protected int testImageId = 95;
protected NovaClient client; protected NovaClient client;
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
@SuppressWarnings("unused")
private Predicate<IPSocket> socketTester; private Predicate<IPSocket> socketTester;
protected String provider = "nova"; protected String provider = "nova";
protected String serverPrefix = System.getProperty("user.name") + ".cs"; protected String serverPrefix = System.getProperty("user.name") + ".cs";
protected Map<String, String> keyPair; protected Map<String, String> keyPair;
private int serverId;
private String adminPass;
Map<String, String> metadata = ImmutableMap.of("jclouds", "rackspace"); Map<String, String> metadata = ImmutableMap.of("jclouds", "rackspace");
private int createdImageId;
@BeforeTest @BeforeTest
public void before() throws IOException { public void before() throws IOException {

View File

@ -40,11 +40,10 @@ public class DeleteServersInVariousStatesLiveTest {
protected NovaClient client; protected NovaClient client;
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
@SuppressWarnings("unused")
private Predicate<IPSocket> socketTester; private Predicate<IPSocket> socketTester;
protected String provider = "nova"; protected String provider = "nova";
private int testImageId = 95;
Map<String, String> metadata = ImmutableMap.of("jclouds", "rackspace"); Map<String, String> metadata = ImmutableMap.of("jclouds", "rackspace");
Server server = null; Server server = null;
@ -58,6 +57,7 @@ public class DeleteServersInVariousStatesLiveTest {
} }
@SuppressWarnings("unused")
private void blockUntilServerActive(int serverId) throws InterruptedException { private void blockUntilServerActive(int serverId) throws InterruptedException {
Server currentDetails; Server currentDetails;
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client

View File

@ -186,6 +186,7 @@ public class NovaClientLiveTest extends ClientBase {
assertNotNull(server.getAdminPass()); assertNotNull(server.getAdminPass());
assertEquals(server.getStatus(), ServerStatus.BUILD); assertEquals(server.getStatus(), ServerStatus.BUILD);
int serverId = server.getId(); int serverId = server.getId();
@SuppressWarnings("unused")
String adminPass = server.getAdminPass(); String adminPass = server.getAdminPass();
blockUntilServerActive(serverId); blockUntilServerActive(serverId);
blockUntilPublicAddress(serverId); blockUntilPublicAddress(serverId);

View File

@ -56,6 +56,7 @@ public class ServerCreateLiveTest {
protected NovaClient client; protected NovaClient client;
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
@SuppressWarnings("unused")
private Predicate<IPSocket> socketTester; private Predicate<IPSocket> socketTester;
protected String provider = "nova"; protected String provider = "nova";
@ -122,6 +123,7 @@ public class ServerCreateLiveTest {
// client.getServer(serverId).getAddresses().getPublicAddresses().iterator().next().getAddress(); // client.getServer(serverId).getAddresses().getPublicAddresses().iterator().next().getAddress();
} }
@SuppressWarnings("unused")
private void blockUntilServerActive(int serverId) throws InterruptedException { private void blockUntilServerActive(int serverId) throws InterruptedException {
Server currentDetails; Server currentDetails;
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client