mirror of https://github.com/apache/jclouds.git
Merge pull request #1322 from jclouds/dynect-jdk7
corrected generic type failure in jdk7 in dynect
This commit is contained in:
commit
d6e38116c3
|
@ -101,7 +101,7 @@ public class RecordId {
|
||||||
return toStringHelper(this).add("zone", zone).add("fqdn", fqdn).add("type", type).add("id", id);
|
return toStringHelper(this).add("zone", zone).add("fqdn", fqdn).add("type", type).add("id", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> recordIdBuilder() {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.dynect.v3.functions;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -63,7 +64,7 @@ public final class ToRecordIds implements Function<HttpResponse, FluentIterable<
|
||||||
public RecordId apply(String in) {
|
public RecordId apply(String in) {
|
||||||
Matcher matcher = DEFAULT_PATTERN.matcher(in);
|
Matcher matcher = DEFAULT_PATTERN.matcher(in);
|
||||||
checkState(matcher.find() && matcher.groupCount() == 4, "%s didn't match %s", in, DEFAULT_PATTERN);
|
checkState(matcher.find() && matcher.groupCount() == 4, "%s didn't match %s", in, DEFAULT_PATTERN);
|
||||||
return RecordId.builder().type(matcher.group(1)).zone(matcher.group(2)).fqdn(matcher.group(3))
|
return recordIdBuilder().type(matcher.group(1)).zone(matcher.group(2)).fqdn(matcher.group(3))
|
||||||
.id(Long.parseLong(matcher.group(4))).build();
|
.id(Long.parseLong(matcher.group(4))).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
package org.jclouds.dynect.v3.features;
|
package org.jclouds.dynect.v3.features;
|
||||||
|
|
||||||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
||||||
|
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse soaResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse soaResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_soa.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_soa.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId soaId = RecordId.builder()
|
RecordId soaId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("SOA")
|
.type("SOA")
|
||||||
|
@ -80,7 +81,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse aaaaResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse aaaaResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_aaaa.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_aaaa.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId aaaaId = RecordId.builder()
|
RecordId aaaaId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("AAAA")
|
.type("AAAA")
|
||||||
|
@ -106,7 +107,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse aResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse aResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_a.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_a.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId aId = RecordId.builder()
|
RecordId aId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("A")
|
.type("A")
|
||||||
|
@ -132,7 +133,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse cnameResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse cnameResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_cname.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_cname.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId cnameId = RecordId.builder()
|
RecordId cnameId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("CNAME")
|
.type("CNAME")
|
||||||
|
@ -158,7 +159,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse mxResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse mxResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_mx.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_mx.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId mxId = RecordId.builder()
|
RecordId mxId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("MX")
|
.type("MX")
|
||||||
|
@ -184,7 +185,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse nsResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse nsResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_ns.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_ns.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId nsId = RecordId.builder()
|
RecordId nsId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("NS")
|
.type("NS")
|
||||||
|
@ -210,7 +211,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse ptrResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse ptrResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_ptr.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_ptr.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId ptrId = RecordId.builder()
|
RecordId ptrId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("PTR")
|
.type("PTR")
|
||||||
|
@ -247,7 +248,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse srvResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse srvResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_srv.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_srv.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId srvId = RecordId.builder()
|
RecordId srvId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("SRV")
|
.type("SRV")
|
||||||
|
@ -268,7 +269,7 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
HttpResponse txtResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse txtResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/get_record_txt.json", APPLICATION_JSON)).build();
|
.payload(payloadFromResourceWithContentType("/get_record_txt.json", APPLICATION_JSON)).build();
|
||||||
|
|
||||||
RecordId txtId = RecordId.builder()
|
RecordId txtId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("TXT")
|
.type("TXT")
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.jclouds.dynect.v3.functions;
|
package org.jclouds.dynect.v3.functions;
|
||||||
|
|
||||||
|
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import org.jclouds.dynect.v3.domain.RecordId;
|
import org.jclouds.dynect.v3.domain.RecordId;
|
||||||
|
@ -34,7 +35,7 @@ import com.google.gson.Gson;
|
||||||
@Test(groups = "unit")
|
@Test(groups = "unit")
|
||||||
public class ToRecordIdsTest {
|
public class ToRecordIdsTest {
|
||||||
ToRecordIds fn = new ToRecordIds(new GsonWrapper(new Gson()));
|
ToRecordIds fn = new ToRecordIds(new GsonWrapper(new Gson()));
|
||||||
RecordId recordId = RecordId.builder()
|
RecordId recordId = recordIdBuilder()
|
||||||
.id(50976583)
|
.id(50976583)
|
||||||
.type("NS")
|
.type("NS")
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.jclouds.dynect.v3.parse;
|
package org.jclouds.dynect.v3.parse;
|
||||||
|
|
||||||
|
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
||||||
|
|
||||||
import org.jclouds.dynect.v3.domain.RecordId;
|
import org.jclouds.dynect.v3.domain.RecordId;
|
||||||
import org.jclouds.dynect.v3.domain.RecordId.Builder;
|
import org.jclouds.dynect.v3.domain.RecordId.Builder;
|
||||||
import org.jclouds.dynect.v3.functions.ToRecordIds;
|
import org.jclouds.dynect.v3.functions.ToRecordIds;
|
||||||
|
@ -43,7 +45,7 @@ public class ListRecordsResponseTest extends BaseDynECTParseTest<FluentIterable<
|
||||||
@Override
|
@Override
|
||||||
@ResponseParser(ToRecordIds.class)
|
@ResponseParser(ToRecordIds.class)
|
||||||
public FluentIterable<RecordId> expected() {
|
public FluentIterable<RecordId> expected() {
|
||||||
Builder<?> builder = RecordId.builder()
|
Builder<?> builder = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org");
|
.fqdn("adrianc.zone.dynecttest.jclouds.org");
|
||||||
return FluentIterable.from(ImmutableSet.<RecordId> builder()
|
return FluentIterable.from(ImmutableSet.<RecordId> builder()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jclouds.dynect.v3.predicates;
|
package org.jclouds.dynect.v3.predicates;
|
||||||
|
|
||||||
|
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
||||||
import static org.jclouds.dynect.v3.predicates.RecordPredicates.typeEquals;
|
import static org.jclouds.dynect.v3.predicates.RecordPredicates.typeEquals;
|
||||||
|
|
||||||
import org.jclouds.dynect.v3.domain.RecordId;
|
import org.jclouds.dynect.v3.domain.RecordId;
|
||||||
|
@ -11,7 +12,7 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit")
|
@Test(groups = "unit")
|
||||||
public class RecordPredicatesTest {
|
public class RecordPredicatesTest {
|
||||||
RecordId recordId = RecordId.builder()
|
RecordId recordId = recordIdBuilder()
|
||||||
.zone("adrianc.zone.dynecttest.jclouds.org")
|
.zone("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
.fqdn("adrianc.zone.dynecttest.jclouds.org")
|
||||||
.type("SOA")
|
.type("SOA")
|
||||||
|
|
Loading…
Reference in New Issue