| Chunk |
|---|
| Conflicting content |
|---|
* This list must be updated whenever a new media type constant is added.
*/
public static final List |
| Solution content |
|---|
* This list must be updated whenever a new media type constant is added.
*/
public static final List |
| File |
|---|
| VCloudDirectorMediaType.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Chunk |
|---|
| Conflicting content |
|---|
*/ package org.jclouds.vcloud.director.v1_5.features; <<<<<<< HEAD import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceType; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; ======= import static org.testng.Assert.*; import static org.jclouds.vcloud.director.v1_5.domain.Checks.*; >>>>>>> 5201207f1ca515a87564de23c64a9243ca9e576f import java.net.URI; |
| Solution content |
|---|
*/ package org.jclouds.vcloud.director.v1_5.features; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceType; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.net.URI; |
| File |
|---|
| NetworkClientLiveTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; <<<<<<< HEAD import org.testng.annotations.BeforeGroups; ======= import org.testng.annotations.BeforeClass; >>>>>>> 5201207f1ca515a87564de23c64a9243ca9e576f import org.testng.annotations.Test; import com.google.common.collect.Iterables; |
| Solution content |
|---|
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.collect.Iterables; |
| File |
|---|
| NetworkClientLiveTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
*/
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest")
public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
<<<<<<< HEAD
public static final String NETWORK = "network";
/*
* Convenience reference to API client.
*/
protected NetworkClient networkClient;
private Reference networkRef;
@BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" })
public void before() {
String networkId = "a604f3c2-0343-453e-ae1f-cddac5b7bd94"; // TODO: inject
networkRef = Reference.builder()
.type("application/vnd.vmware.vcloud.orgNetwork+xml")
.name("")
.href(URI.create(endpoint+"/network/"+networkId))
.id(networkId)
.build();
networkClient = context.getApi().getNetworkClient();
}
@Test(testName = "GET /network/{id}")
public void testGetNetwork() {
// required for testing
assertNotNull(networkRef, String.format(REF_REQ_LIVE, NETWORK));
OrgNetwork network = networkClient.getNetwork(networkRef);
assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK));
assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing");
// parent type
Checks.checkNetworkType(network);
// optional
ReferenceType> networkPoolRef = network.getNetworkPool();
if (networkPoolRef != null) {
Checks.checkReferenceType(networkPoolRef);
}
IpAddresses allowedExternalIpAddresses = network.getAllowedExternalIpAddresses();
if (allowedExternalIpAddresses != null) {
Checks.checkIpAddresses(allowedExternalIpAddresses);
=======
public static final String NETWORK = "network";
/*
* Convenience references to API clients.
*/
protected NetworkClient networkClient;
@BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() {
networkClient = context.getApi().getNetworkClient();
}
@Test(testName = "GET /network/{id}")
public void testWhenResponseIs2xxLoginReturnsValidNetwork() {
Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/" + networkId)).build();
OrgNetwork network = networkClient.getNetwork(networkRef);
// TODO change to checkOrgNetwork(...)
checkEntityType(network);
}
@Test(testName = "GET /network/{id} - invalid")
public void testWhenResponseIs400ForInvalidNetworkId() {
Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/NOTAUUID")).build();
Error expected = Error.builder()
.message("validation error on field 'id': String value has invalid format or length")
.majorErrorCode(400)
.minorErrorCode("BAD_REQUEST")
.build();
try {
networkClient.getNetwork(networkRef);
fail("Should give HTTP 400 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
} catch (Exception e) {
fail("Should have thrown a VCloudDirectorException");
}
}
@Test(testName = "GET /network/{id} - fake")
public void testWhenResponseIs403ForFakeNetworkId() {
Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")).build();
Error expected = Error.builder()
.message("This operation is denied.")
.majorErrorCode(403)
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
.build();
try {
networkClient.getNetwork(networkRef);
fail("Should give HTTP 403 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
} catch (Exception e) {
fail("Should have thrown a VCloudDirectorException");
>>>>>>> 5201207f1ca515a87564de23c64a9243ca9e576f
}
}
|
| Solution content |
|---|
*/
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest")
public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String NETWORK = "network";
/*
* Convenience reference to API client.
*/
protected NetworkClient networkClient;
private Reference networkRef;
@BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() {
String networkId = "a604f3c2-0343-453e-ae1f-cddac5b7bd94"; // TODO: inject
networkRef = Reference.builder()
.type("application/vnd.vmware.vcloud.orgNetwork+xml")
.name("")
.href(URI.create(endpoint+"/network/"+networkId))
.id(networkId)
.build();
networkClient = context.getApi().getNetworkClient();
}
@Test(testName = "GET /network/{id}")
public void testGetNetwork() {
// required for testing
assertNotNull(networkRef, String.format(REF_REQ_LIVE, NETWORK));
OrgNetwork network = networkClient.getNetwork(networkRef);
assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK));
assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing");
// parent type
Checks.checkNetworkType(network);
// optional
ReferenceType> networkPoolRef = network.getNetworkPool();
if (networkPoolRef != null) {
Checks.checkReferenceType(networkPoolRef);
}
IpAddresses allowedExternalIpAddresses = network.getAllowedExternalIpAddresses();
if (allowedExternalIpAddresses != null) {
Checks.checkIpAddresses(allowedExternalIpAddresses);
}
} |
| File |
|---|
| NetworkClientLiveTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Catch clause |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
@Test(testName = "GET /network/{id}/metadata")
<<<<<<< HEAD
public void testGetMetadata() {
Metadata metadata = networkClient.getMetadata(networkRef);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
// parent type
checkResourceType(metadata);
for (MetadataEntry entry : metadata.getMetadataEntries()) {
// required elements and attributes
assertNotNull(entry.getKey(),
String.format(OBJ_FIELD_ATTRB_REQ, networkClient, "MetadataEntry", entry.getKey(), "key"));
assertNotNull(entry.getValue(),
String.format(OBJ_FIELD_ATTRB_REQ, networkClient, "MetadataEntry", entry.getValue(), "value"));
// parent type
checkResourceType(entry);
}
}
@Test(testName = "GET /network/{id}/metadata/{key}")
public void testGetMetadataValue() {
MetadataValue metadataValue = networkClient.getMetadataValue(networkRef, "key");
// Check parent type
checkResourceType(metadataValue);
// Check required elements and attributes
String value = metadataValue.getValue();
assertNotNull(value,
String.format(OBJ_FIELD_ATTRB_REQ, NETWORK, "MetadataEntry",
metadataValue.toString(), "value"));
assertEquals(value, "value",
String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", value));
=======
public void testWhenResponseIs2xxLoginReturnsValidMetadataList() {
Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/"+networkId)).build();
Metadata metadata = context.getApi().getNetworkClient().getMetadata(networkRef);
checkMetadata(metadata);
// TODO assert has metadata in order to support subsequent test
// TODO assign metadata key (todo- ordering)
}
String metadataKey = "key";
//TODO depends on previous
@Test(testName = "GET /network/{id}/metadata", enabled=false)
public void testWhenResponseIs2xxLoginReturnsValidMetadataEntry() {
Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/"+networkId)).build();
MetadataEntry metadataEntry = networkClient.getMetadataEntry(networkRef, metadataKey);
checkMetadataEntry(metadataEntry);
>>>>>>> 5201207f1ca515a87564de23c64a9243ca9e576f
}
} |
| Solution content |
|---|
}
@Test(testName = "GET /network/{id}/metadata")
public void testGetMetadata() {
Metadata metadata = networkClient.getMetadata(networkRef);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
// parent type
checkResourceType(metadata);
for (MetadataEntry entry : metadata.getMetadataEntries()) {
// required elements and attributes
assertNotNull(entry.getKey(),
String.format(OBJ_FIELD_ATTRB_REQ, networkClient, "MetadataEntry", entry.getKey(), "key"));
assertNotNull(entry.getValue(),
String.format(OBJ_FIELD_ATTRB_REQ, networkClient, "MetadataEntry", entry.getValue(), "value"));
// parent type
checkResourceType(entry);
}
}
@Test(testName = "GET /network/{id}/metadata/{key}")
public void testGetMetadataValue() {
MetadataValue metadataValue = networkClient.getMetadataValue(networkRef, "key");
// Check parent type
checkResourceType(metadataValue);
// Check required elements and attributes
String value = metadataValue.getValue();
assertNotNull(value,
String.format(OBJ_FIELD_ATTRB_REQ, NETWORK, "MetadataEntry",
metadataValue.toString(), "value"));
assertEquals(value, "value",
String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", value));
}
} |
| File |
|---|
| NetworkClientLiveTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
import com.google.inject.Module;
/**
<<<<<<< HEAD
* Tests behavior of {@link VCloudDirectorClient} and acts as parent for other client live tests.
=======
* Tests behavior of {@link VCloudDirectorClient}
>>>>>>> 5201207f1ca515a87564de23c64a9243ca9e576f
*
* @author Adrian Cole
* @author grkvlt@apache.org |
| Solution content |
|---|
import com.google.inject.Module;
/**
* Tests behavior of {@link VCloudDirectorClient} and acts as parent for other client live tests.
*
* @author Adrian Cole
* @author grkvlt@apache.org |
| File |
|---|
| BaseVCloudDirectorClientLiveTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
protected RestContext |
| Solution content |
|---|
protected RestContext |
| File |
|---|
| BaseVCloudDirectorClientLiveTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Method declaration |
| Method signature |