Search in sources :

Example 6 with Package

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);
}
Also used : Package(com.sequenceiq.cloudbreak.service.cluster.Package) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Map(java.util.Map) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) Before(org.junit.Before)

Example 7 with Package

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());
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) CheckResult(com.sequenceiq.cloudbreak.core.flow2.CheckResult) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Package(com.sequenceiq.cloudbreak.service.cluster.Package) Json(com.sequenceiq.cloudbreak.common.json.Json) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) StatedImage(com.sequenceiq.cloudbreak.service.image.StatedImage) Test(org.junit.Test)

Example 8 with Package

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;
}
Also used : Package(com.sequenceiq.cloudbreak.service.cluster.Package)

Aggregations

Package (com.sequenceiq.cloudbreak.service.cluster.Package)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)4 Json (com.sequenceiq.cloudbreak.common.json.Json)4 CheckResult (com.sequenceiq.cloudbreak.core.flow2.CheckResult)4 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)4 StatedImage (com.sequenceiq.cloudbreak.service.image.StatedImage)4 Test (org.junit.Test)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)2 Map (java.util.Map)2 HashMultimap (com.google.common.collect.HashMultimap)1 Multimap (com.google.common.collect.Multimap)1 ImagePackageVersion (com.sequenceiq.cloudbreak.cloud.model.catalog.ImagePackageVersion)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 PackageInfo (com.sequenceiq.cloudbreak.common.model.PackageInfo)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 HostOrchestrator (com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator)1 GatewayConfigService (com.sequenceiq.cloudbreak.service.GatewayConfigService)1 PackageName (com.sequenceiq.cloudbreak.service.cluster.PackageName)1