mirror of https://github.com/apache/jclouds.git
Added ant tests
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2385 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
b51d5fd927
commit
22f98a77c7
|
@ -0,0 +1,2 @@
|
|||
rimuhosting.contextBuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder
|
||||
rimuhosting.propertiesBuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder
|
|
@ -25,6 +25,7 @@ package org.jclouds.rimuhosting.miro.config;
|
|||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Scopes;
|
||||
import org.jclouds.http.functions.config.ParserModule.CDateTimeAdapter;
|
||||
import org.jclouds.http.functions.config.ParserModule.DateTimeAdapter;
|
||||
import org.jclouds.lifecycle.Closer;
|
||||
|
@ -33,7 +34,9 @@ import org.jclouds.rest.internal.RestContextImpl;
|
|||
import org.jclouds.rimuhosting.miro.RimuHosting;
|
||||
import org.jclouds.rimuhosting.miro.RimuHostingAsyncClient;
|
||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
||||
import org.jclouds.rimuhosting.miro.servers.RimuHostingComputeService;
|
||||
import org.jclouds.rimuhosting.miro.reference.RimuHostingConstants;
|
||||
import org.jclouds.compute.ComputeService;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -48,6 +51,7 @@ public class RimuHostingContextModule extends AbstractModule {
|
|||
@Override
|
||||
protected void configure() {
|
||||
bind(DateTimeAdapter.class).to(CDateTimeAdapter.class);
|
||||
bind(ComputeService.class).to(RimuHostingComputeService.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -57,4 +61,5 @@ public class RimuHostingContextModule extends AbstractModule {
|
|||
return new RestContextImpl<RimuHostingAsyncClient, RimuHostingClient>(closer, asyncApi, syncApi, endPoint, account);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
*
|
||||
* 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.rimuhosting.miro.servers;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
import org.jclouds.rimuhosting.miro.RimuHostingContextBuilder;
|
||||
import org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "compute.PropertiesTest")
|
||||
public class PropertiesTest {
|
||||
private Properties properties;
|
||||
|
||||
@BeforeTest
|
||||
public void setUp() throws IOException {
|
||||
properties = new Properties();
|
||||
properties.load(Resources.newInputStreamSupplier(Resources.getResource("compute.properties"))
|
||||
.getInput());
|
||||
}
|
||||
|
||||
public void testAzure() {
|
||||
assertEquals(properties.getProperty("rimuhosting.contextBuilder"),
|
||||
RimuHostingContextBuilder.class.getName());
|
||||
assertEquals(properties.getProperty("rimuhosting.propertiesBuilder"),
|
||||
RimuHostingPropertiesBuilder.class.getName());
|
||||
}
|
||||
|
||||
|
||||
}
|
0
rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/servers/RimuHostingComputeServiceLiveTest.java
Normal file → Executable file
0
rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/servers/RimuHostingComputeServiceLiveTest.java
Normal file → Executable file
|
@ -33,7 +33,7 @@
|
|||
|
||||
<typedef name="compute" classname="org.jclouds.tools.ant.ComputeTask" classpathref="jclouds.classpath" />
|
||||
<target name="demo">
|
||||
<compute/>
|
||||
<compute action="create"/>
|
||||
|
||||
|
||||
</target>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-project</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<parent>
|
||||
<artifactId>jclouds-tools-project</artifactId>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-ant-plugin</artifactId>
|
||||
|
|
|
@ -25,6 +25,10 @@ package org.jclouds.tools.ant;
|
|||
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.jclouds.rimuhosting.miro.RimuHostingContextBuilder;
|
||||
import org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder;
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* @author Ivan Meredith
|
||||
|
@ -38,7 +42,11 @@ public class ComputeTask extends Task {
|
|||
public void execute() throws BuildException {
|
||||
if(ACTION_CREATE.equalsIgnoreCase(action)){
|
||||
if(getServerElement() != null){
|
||||
Injector injector = new RimuHostingContextBuilder(new RimuHostingPropertiesBuilder("test", "Test").relaxSSLHostname().build()).buildInjector();
|
||||
|
||||
ComputeService computeService = injector.getInstance(ComputeService.class);
|
||||
|
||||
computeService.createServerAndWait("test.com","MIRO1B","lenny");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue