Search in sources :

Example 36 with WarningImpl

use of org.eclipse.che.api.workspace.server.model.impl.WarningImpl in project devspaces-images by redhat-developer.

the class SecureServerExposerFactoryProviderTest method shouldAddWarningIfSecureServerConfiguredInEnvironmentWasNotFound.

@Test
public void shouldAddWarningIfSecureServerConfiguredInEnvironmentWasNotFound() {
    // given
    SecureServerExposerFactoryProvider<KubernetesEnvironment> factoryProvider = new SecureServerExposerFactoryProvider<>(EXPOSER1, factories);
    kubernetesEnvironment.setAttributes(ImmutableMap.of(SECURE_EXPOSER_IMPL_PROPERTY, NON_EXISTING_EXPOSER));
    WarningImpl expectedWarning = new WarningImpl(UNKNOWN_SECURE_SERVER_EXPOSER_CONFIGURED_IN_WS_WARNING_CODE, format(UNKNOWN_EXPOSER_ERROR_TEMPLATE, NON_EXISTING_EXPOSER, String.join(", ", factories.keySet())));
    SecureServerExposerFactory<KubernetesEnvironment> factory = factoryProvider.get(kubernetesEnvironment);
    // then
    assertSame(factory, secureServerExposer1);
    assertEquals(kubernetesEnvironment.getWarnings().size(), 1);
    assertEquals(kubernetesEnvironment.getWarnings().get(0), expectedWarning);
}
Also used : WarningImpl(org.eclipse.che.api.workspace.server.model.impl.WarningImpl) KubernetesEnvironment(org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment) Test(org.testng.annotations.Test)

Aggregations

WarningImpl (org.eclipse.che.api.workspace.server.model.impl.WarningImpl)36 Test (org.testng.annotations.Test)22 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 Warning (org.eclipse.che.api.core.model.workspace.Warning)8 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)6 ServerException (org.eclipse.che.api.core.ServerException)6 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)4 Pod (io.fabric8.kubernetes.api.model.Pod)4 Service (io.fabric8.kubernetes.api.model.Service)4 Ingress (io.fabric8.kubernetes.api.model.networking.v1.Ingress)4 RuntimeIdentity (org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity)4 MachineImpl (org.eclipse.che.api.workspace.server.model.impl.MachineImpl)4 ServerImpl (org.eclipse.che.api.workspace.server.model.impl.ServerImpl)4 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)4 KubernetesEnvironment (org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)2 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)2 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)2