use of com.sequenceiq.cloudbreak.service.cluster.Package in project cloudbreak by hortonworks.
the class InstanceMetadataUpdaterTest method setUp.
@Before
public void setUp() throws CloudbreakException, JsonProcessingException, CloudbreakOrchestratorFailedException {
MockitoAnnotations.openMocks(this);
when(gatewayConfigService.getPrimaryGatewayConfig(any(Stack.class))).thenReturn(gatewayConfig);
Package packageByName = new Package();
packageByName.setName("packageByName");
packageByName.setPkg(Lists.newArrayList(generatePackageName("packageByName", "(.*)-(.*)")));
Package packageByCmd = new Package();
packageByCmd.setName("packageByCmd");
packageByCmd.setPkg(Lists.newArrayList(generatePackageName("packageByCmd", null)));
underTest.setPackages(Lists.newArrayList(packageByCmd, packageByName));
Map<String, Map<String, String>> hostPackageMap = Maps.newHashMap();
hostPackageMap.put("instanceId", packageMap());
hostPackageMap.put("hostByCmd", packageMap());
when(hostOrchestrator.getPackageVersionsFromAllHosts(any(GatewayConfig.class), any())).thenReturn(hostPackageMap);
}
use of com.sequenceiq.cloudbreak.service.cluster.Package in project cloudbreak by hortonworks.
the class PackageVersionCheckerTest method compareImageAndInstancesMandatoryPackageVersionBaseOk.
@Test
public void compareImageAndInstancesMandatoryPackageVersionBaseOk() throws JsonProcessingException {
String packageName = "package";
Map<String, String> packageVersions = Collections.singletonMap(packageName, "1");
when(statedImage.getImage()).thenReturn(image);
when(image.isPrewarmed()).thenReturn(false);
when(image.getPackageVersions()).thenReturn(packageVersions);
Package aPackage = new Package();
aPackage.setName(packageName);
aPackage.setPrewarmed(false);
Package prewarmedPackage = new Package();
prewarmedPackage.setName(packageName);
prewarmedPackage.setPrewarmed(true);
when(instanceMetadataUpdater.getPackages()).thenReturn(Lists.newArrayList(aPackage, prewarmedPackage));
when(instanceMetadataUpdater.isPackagesVersionEqual(anyString(), anyString())).thenReturn(true);
InstanceMetaData instanceMetaData = new InstanceMetaData();
instanceMetaData.setImage(new Json(new com.sequenceiq.cloudbreak.cloud.model.Image("image", Collections.emptyMap(), "os", "ostype", "catalogn", "catalogu", "id", packageVersions)));
Set<InstanceMetaData> instanceMetaDataSet = Collections.singleton(instanceMetaData);
CheckResult result = underTest.compareImageAndInstancesMandatoryPackageVersion(statedImage, instanceMetaDataSet);
assertEquals(EventStatus.OK, result.getStatus());
}
use of com.sequenceiq.cloudbreak.service.cluster.Package in project cloudbreak by hortonworks.
the class CmVersionQueryServiceTest method getCmPackage.
private Package getCmPackage() {
Package cmPackage = new Package();
cmPackage.setName("cm");
cmPackage.setPkg(Lists.newArrayList(generatePackageName(CLOUDERA_MANAGER_AGENT, VALID_PATTERN), generatePackageName(CLOUDERA_MANAGER_SERVER, VALID_PATTERN)));
return cmPackage;
}
Aggregations