String groupId = "foo";
String artifactId = "bar";
String expectedProfileId = groupId + "-" + artifactId;
String versionId = "1.0";
ProjectRequirements requirements = new ProjectRequirements();
DependencyDTO rootDependency = new DependencyDTO();
requirements.setRootDependency(rootDependency);
rootDependency.setGroupId(groupId);
rootDependency.setArtifactId(artifactId);
rootDependency.setVersion("1.0.0");
List<String> parentProfileIds = Arrays.asList("karaf");
List<String> features = Arrays.asList("cxf", "war");
requirements.setParentProfiles(parentProfileIds);
requirements.setFeatures(features);
projectDeployer.deployProject(requirements);
// now we should have a profile created
Profile profile = assertProfileInFabric(expectedProfileId, versionId);
assertBundleCount(profile, 1);
assertEquals("parent ids", parentProfileIds, profile.getParentIds());
assertFeatures(profile, features);
String requirementsFileName = "dependencies/" + groupId + "/" + artifactId + "-requirements.json";
byte[] jsonData = profile.getFileConfiguration(requirementsFileName);
assertNotNull("should have found some JSON for: " + requirementsFileName, jsonData);
String json = new String(jsonData);
LOG.info("Got JSON: " + json);
// lets replace the version, parent, features
rootDependency.setVersion("1.0.1");
projectDeployer.deployProject(requirements);
profile = assertProfileInFabric(expectedProfileId, versionId);
assertBundleCount(profile, 1);
// now lets make a new version
expectedProfileId = "cheese";
versionId = "1.2";
requirements.setVersion(versionId);
requirements.setProfileId(expectedProfileId);
parentProfileIds = Arrays.asList("default");
features = Arrays.asList("camel", "war");
requirements.setParentProfiles(parentProfileIds);
requirements.setFeatures(features);
projectDeployer.deployProject(requirements);
profile = assertProfileInFabric(expectedProfileId, versionId);
assertBundleCount(profile, 1);
assertEquals("parent ids", parentProfileIds, profile.getParentIds());