Remove unused property

Signed-off-by: Eugene Ivantsov <eivantsov@codenvy.com>
6.19.x
Eugene Ivantsov 2016-03-31 12:27:21 +03:00
parent 6ac67e60ca
commit dbf39f4224
4 changed files with 0 additions and 124 deletions

View File

@ -65,8 +65,6 @@ public class ApiModule extends AbstractModule {
bind(EverrestDownloadFileResponseFilter.class);
bind(ETagResponseFilter.class);
// bind(DockerVersionVerifier.class).asEagerSingleton();
bind(UserService.class);
bind(UserProfileService.class);

View File

@ -87,7 +87,6 @@ machine.logs.location=${che.logs.dir}/machine/logs
# Size of the machine by default. What is used if RAM parameter not provided by user or API.
machine.default_mem_size_mb=1024
machine.supported_docker_version=1.6.0,1.6.1,1.6.2,1.7.1,1.8.1
# When the workspace master launches a new workspace, Che performs checks of the internal Web
# services. When Che gets a valid response, we know that the workspace agent is ready for use.

View File

@ -1,61 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2016 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.docker.client;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.plugin.docker.client.json.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.inject.Named;
import java.io.IOException;
import java.util.Set;
/**
* Verifies compatibility with docker api version.
*
* @author Anton Korneta
*/
@Singleton
public class DockerVersionVerifier {
private final DockerConnector dockerConnector;
private final Set<String> supportedVersions;
private static final Logger LOG = LoggerFactory.getLogger(DockerVersionVerifier.class);
@Inject
public DockerVersionVerifier(DockerConnector dockerConnector, @Named("machine.supported_docker_version") String[] supportedVersions) {
this.dockerConnector = dockerConnector;
this.supportedVersions = Sets.newHashSet(supportedVersions);
}
/**
* Check docker version compatibility.
*/
@PostConstruct
void checkCompatibility() throws ServerException {
try {
Version versionInfo = dockerConnector.getVersion();
if (!supportedVersions.contains(versionInfo.getVersion())) {
throw new ServerException("Unsupported docker version " + versionInfo.getVersion());
}
} catch (IOException e) {
LOG.info(e.getMessage());
throw new ServerException("Impossible to get docker version", e);
}
}
}

View File

@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2016 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.docker.client;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.plugin.docker.client.json.Version;
import org.mockito.Mock;
import org.mockito.testng.MockitoTestNGListener;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import java.io.IOException;
import static org.mockito.Mockito.when;
/**
* @author Anton Korneta
*/
@Listeners(MockitoTestNGListener.class)
public class DockerVersionVerifierTest {
@Mock
private DockerConnector dockerConnector;
@Test(expectedExceptions = ServerException.class, expectedExceptionsMessageRegExp = "Unsupported docker version x.x.x")
public void shouldThrowServerExceptionWhenDockerVersionIsIncompatible() throws Exception {
//mock docker version
Version version = new Version();
version.setVersion("x.x.x");
when(dockerConnector.getVersion()).thenReturn(version);
//prepare verifies
DockerVersionVerifier verifier = new DockerVersionVerifier(dockerConnector, new String[]{"1.6.0"});
verifier.checkCompatibility();
}
@Test(expectedExceptions = ServerException.class, expectedExceptionsMessageRegExp = "Impossible to get docker version")
public void shouldThrowIOExceptionWhenVersionJsonParsing() throws Exception {
when(dockerConnector.getVersion()).thenThrow(new IOException());
DockerVersionVerifier verifier = new DockerVersionVerifier(dockerConnector, new String[]{"1.6.0"});
verifier.checkCompatibility();
}
@Test
public void supportedVersionTest() throws Exception {
Version version = new Version();
version.setVersion("1.6.0");
when(dockerConnector.getVersion()).thenReturn(version);
DockerVersionVerifier verifier = new DockerVersionVerifier(dockerConnector, new String[]{"1.6.0"});
verifier.checkCompatibility();
}
}