mirror of https://github.com/apache/jclouds.git
Cleaned up ChefApi and ChefService interfaces
Cleaned up and renamed some methods to have a more consistent naming, and improved the javadocs.
This commit is contained in:
parent
063dcc4c9d
commit
ef7b7f7c52
|
@ -20,7 +20,6 @@ import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.ApiMetadata;
|
import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.chef.ChefApi;
|
|
||||||
import org.jclouds.chef.ChefApiMetadata;
|
import org.jclouds.chef.ChefApiMetadata;
|
||||||
import org.jclouds.chef.ChefContext;
|
import org.jclouds.chef.ChefContext;
|
||||||
import org.jclouds.chef.config.ChefBootstrapModule;
|
import org.jclouds.chef.config.ChefBootstrapModule;
|
||||||
|
@ -63,7 +62,7 @@ public class EnterpriseChefApiMetadata extends BaseHttpApiMetadata<EnterpriseChe
|
||||||
.name("Enterprise Chef Api")
|
.name("Enterprise Chef Api")
|
||||||
.identityName("User")
|
.identityName("User")
|
||||||
.credentialName("Certificate")
|
.credentialName("Certificate")
|
||||||
.version(ChefApi.VERSION)
|
.version(ChefApiMetadata.DEFAULT_VERSION)
|
||||||
.documentation(URI.create("http://www.opscode.com/support"))
|
.documentation(URI.create("http://www.opscode.com/support"))
|
||||||
.defaultEndpoint("https://api.opscode.com")
|
.defaultEndpoint("https://api.opscode.com")
|
||||||
.view(ChefContext.class)
|
.view(ChefContext.class)
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.chef.BaseChefApiExpectTest;
|
import org.jclouds.chef.BaseChefApiExpectTest;
|
||||||
import org.jclouds.chef.ChefApi;
|
import org.jclouds.chef.ChefApiMetadata;
|
||||||
import org.jclouds.date.TimeStamp;
|
import org.jclouds.date.TimeStamp;
|
||||||
import org.jclouds.enterprisechef.config.EnterpriseChefHttpApiModule;
|
import org.jclouds.enterprisechef.config.EnterpriseChefHttpApiModule;
|
||||||
import org.jclouds.enterprisechef.domain.Group;
|
import org.jclouds.enterprisechef.domain.Group;
|
||||||
|
@ -56,7 +56,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
signed(HttpRequest.builder() //
|
signed(HttpRequest.builder() //
|
||||||
.method("GET") //
|
.method("GET") //
|
||||||
.endpoint("https://api.opscode.com/users/nacx") //
|
.endpoint("https://api.opscode.com/users/nacx") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON).build()), //
|
.addHeader("Accept", MediaType.APPLICATION_JSON).build()), //
|
||||||
HttpResponse.builder().statusCode(200)
|
HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/user.json", MediaType.APPLICATION_JSON)) //
|
.payload(payloadFromResourceWithContentType("/user.json", MediaType.APPLICATION_JSON)) //
|
||||||
|
@ -71,7 +71,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("GET") //
|
.method("GET") //
|
||||||
.endpoint("https://api.opscode.com/users/foo") //
|
.endpoint("https://api.opscode.com/users/foo") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.build()), //
|
.build()), //
|
||||||
HttpResponse.builder().statusCode(404).build());
|
HttpResponse.builder().statusCode(404).build());
|
||||||
|
@ -84,7 +84,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
signed(HttpRequest.builder() //
|
signed(HttpRequest.builder() //
|
||||||
.method("GET") //
|
.method("GET") //
|
||||||
.endpoint("https://api.opscode.com/groups") //
|
.endpoint("https://api.opscode.com/groups") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON).build()), //
|
.addHeader("Accept", MediaType.APPLICATION_JSON).build()), //
|
||||||
HttpResponse.builder().statusCode(200)
|
HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/groups.json", MediaType.APPLICATION_JSON)) //
|
.payload(payloadFromResourceWithContentType("/groups.json", MediaType.APPLICATION_JSON)) //
|
||||||
|
@ -100,7 +100,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
signed(HttpRequest.builder() //
|
signed(HttpRequest.builder() //
|
||||||
.method("GET") //
|
.method("GET") //
|
||||||
.endpoint("https://api.opscode.com/groups/admins") //
|
.endpoint("https://api.opscode.com/groups/admins") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON).build()), //
|
.addHeader("Accept", MediaType.APPLICATION_JSON).build()), //
|
||||||
HttpResponse.builder().statusCode(200)
|
HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/group.json", MediaType.APPLICATION_JSON)) //
|
.payload(payloadFromResourceWithContentType("/group.json", MediaType.APPLICATION_JSON)) //
|
||||||
|
@ -115,7 +115,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("GET") //
|
.method("GET") //
|
||||||
.endpoint("https://api.opscode.com/groups/foo") //
|
.endpoint("https://api.opscode.com/groups/foo") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.build()), //
|
.build()), //
|
||||||
HttpResponse.builder().statusCode(404).build());
|
HttpResponse.builder().statusCode(404).build());
|
||||||
|
@ -127,7 +127,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("POST") //
|
.method("POST") //
|
||||||
.endpoint("https://api.opscode.com/groups") //
|
.endpoint("https://api.opscode.com/groups") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.payload(payloadFromStringWithContentType("{\"groupname\":\"foo\"}", MediaType.APPLICATION_JSON)) //
|
.payload(payloadFromStringWithContentType("{\"groupname\":\"foo\"}", MediaType.APPLICATION_JSON)) //
|
||||||
.build()), //
|
.build()), //
|
||||||
|
@ -140,7 +140,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("DELETE") //
|
.method("DELETE") //
|
||||||
.endpoint("https://api.opscode.com/groups/foo") //
|
.endpoint("https://api.opscode.com/groups/foo") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.build()), //
|
.build()), //
|
||||||
HttpResponse.builder().statusCode(200).build());
|
HttpResponse.builder().statusCode(200).build());
|
||||||
|
@ -153,7 +153,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("DELETE") //
|
.method("DELETE") //
|
||||||
.endpoint("https://api.opscode.com/groups/foo") //
|
.endpoint("https://api.opscode.com/groups/foo") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.build()), //
|
.build()), //
|
||||||
HttpResponse.builder().statusCode(404).build());
|
HttpResponse.builder().statusCode(404).build());
|
||||||
|
@ -165,7 +165,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("PUT") //
|
.method("PUT") //
|
||||||
.endpoint("https://api.opscode.com/groups/admins") //
|
.endpoint("https://api.opscode.com/groups/admins") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.payload(payloadFromResourceWithContentType("/group-update.json", MediaType.APPLICATION_JSON)) //
|
.payload(payloadFromResourceWithContentType("/group-update.json", MediaType.APPLICATION_JSON)) //
|
||||||
.build()), //
|
.build()), //
|
||||||
|
@ -180,7 +180,7 @@ public class EnterpriseChefApiExpectTest extends BaseChefApiExpectTest<Enterpris
|
||||||
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
EnterpriseChefApi api = requestSendsResponse(signed(HttpRequest.builder() //
|
||||||
.method("PUT") //
|
.method("PUT") //
|
||||||
.endpoint("https://api.opscode.com/groups/admins") //
|
.endpoint("https://api.opscode.com/groups/admins") //
|
||||||
.addHeader("X-Chef-Version", ChefApi.VERSION) //
|
.addHeader("X-Chef-Version", ChefApiMetadata.DEFAULT_VERSION) //
|
||||||
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
.addHeader("Accept", MediaType.APPLICATION_JSON) //
|
||||||
.payload(payloadFromResourceWithContentType("/group-update.json", MediaType.APPLICATION_JSON)) //
|
.payload(payloadFromResourceWithContentType("/group-update.json", MediaType.APPLICATION_JSON)) //
|
||||||
.build()), //
|
.build()), //
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.enterprisechef;
|
package org.jclouds.enterprisechef;
|
||||||
|
|
||||||
import org.jclouds.enterprisechef.EnterpriseChefApiMetadata;
|
|
||||||
import org.jclouds.enterprisechef.EnterpriseChefProviderMetadata;
|
|
||||||
import org.jclouds.providers.internal.BaseProviderMetadataTest;
|
import org.jclouds.providers.internal.BaseProviderMetadataTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.chef.ChefApi;
|
import org.jclouds.chef.ChefApiMetadata;
|
||||||
import org.jclouds.chef.config.ChefParserModule;
|
import org.jclouds.chef.config.ChefParserModule;
|
||||||
import org.jclouds.enterprisechef.domain.Group;
|
import org.jclouds.enterprisechef.domain.Group;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
|
@ -45,7 +45,7 @@ public class BindGroupToUpdateRequestJsonPayloadTest {
|
||||||
private Injector injector = Guice.createInjector(new AbstractModule() {
|
private Injector injector = Guice.createInjector(new AbstractModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(String.class).annotatedWith(ApiVersion.class).toInstance(ChefApi.VERSION);
|
bind(String.class).annotatedWith(ApiVersion.class).toInstance(ChefApiMetadata.DEFAULT_VERSION);
|
||||||
}
|
}
|
||||||
}, new ChefParserModule(), new GsonModule());
|
}, new ChefParserModule(), new GsonModule());
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.enterprisechef.binders.GroupName;
|
|
||||||
import org.jclouds.enterprisechef.domain.Group;
|
import org.jclouds.enterprisechef.domain.Group;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue