Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

Commit

Permalink
Applied IntelliJ's automatic code formatting to all code in the subdi…
Browse files Browse the repository at this point in the history
…rectory

As long as we have the same settings in our IDE, we will no longer have merge conflicts in imports or unnecessary code changes due to spaces/tabs/etc.
  • Loading branch information
Remmelt Pit committed Apr 21, 2016
1 parent c3ca886 commit f14d7c4
Show file tree
Hide file tree
Showing 51 changed files with 463 additions and 396 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

[*.java]
indent_style = space
indent_size = 4
50 changes: 25 additions & 25 deletions minimesos/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
import com.bmuschko.gradle.docker.tasks.image.DockerTagImage

ext {
Expand Down Expand Up @@ -71,11 +71,11 @@ jar {
baseName = "minimesos"
manifest {
attributes(
'Main-Class' : mainClassName,
'Implementation-Version' : project.version
'Main-Class': mainClassName,
'Implementation-Version': project.version
)
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}

jacocoTestReport {
Expand All @@ -92,40 +92,40 @@ task executableJar(type: Jar) {
with jar
manifest {
attributes(
'Main-Class' : mainClassName,
'Implementation-Version' : project.version
'Main-Class': mainClassName,
'Implementation-Version': project.version
)
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}

task installMinimesosScript(type: Copy) {
from "$rootDir/bin/minimesos"
into "/usr/local/bin"
from "$rootDir/bin/minimesos"
into "/usr/local/bin"
}

task copyExecutableJar(type: Copy) {
dependsOn 'executableJar'
rename { String fileName ->
fileName.replace("-${project.version}-all", "")
}
from "build/libs/minimesos-${project.version}-all.jar"
into 'build/libs'
from "build/libs/minimesos-${project.version}-all.jar"
into 'build/libs'
}

task copyFilesForDocker(type: Copy) {
dependsOn 'copyExecutableJar'
from "build/libs/minimesos.jar"
into 'build/docker'
dependsOn 'copyExecutableJar'
from "build/libs/minimesos.jar"
into 'build/docker'
rename { String fileName ->
fileName.replace("-${project.version}", "")
}
}

task copyDockerfile(type: Copy) {
dependsOn 'copyFilesForDocker'
from "Dockerfile"
into 'build/docker'
dependsOn 'copyFilesForDocker'
from "Dockerfile"
into 'build/docker'
}

artifacts {
Expand All @@ -145,35 +145,35 @@ afterEvaluate { project ->
+ ' contains Dockerfile, but it does not define project.ext.imageName value')
}
docker.url = 'unix:///var/run/docker.sock'
if(!System.properties['os.name'].equals('Mac OS X')) {
if (!System.properties['os.name'].equals('Mac OS X')) {
docker.certPath = null
}
if (System.env.DOCKER_HOST) {
docker.url = "$System.env.DOCKER_HOST".replace("tcp","https")
docker.url = "$System.env.DOCKER_HOST".replace("tcp", "https")
if (System.env.DOCKER_CERT_PATH) {
docker.certPath = new File(System.env.DOCKER_CERT_PATH)
}
}
task buildDockerImage(type: DockerBuildImage, dependsOn: [copyDockerfile], description: 'build Docker image') {
inputDir = new File( "${buildDir}/docker")
inputDir = new File("${buildDir}/docker")
tag = project.imageName
}
project.build.dependsOn buildDockerImage
[ 'snapshot', 'version' ].each { aTag ->
['snapshot', 'version'].each { aTag ->
String uppercasedName = aTag.capitalize()
task "tagDockerImageWith$uppercasedName"(type: DockerTagImage, description: 'tag Docker image') {
imageId = project.imageName
tag = ( 'version'.equals(aTag) ) ? project.version : aTag
tag = ('version'.equals(aTag)) ? project.version : aTag
repository = project.imageName
force = true
}
task "publishDockerImageWith$uppercasedName"(type: DockerPushImage, dependsOn: ["tagDockerImageWith$uppercasedName"],
description: 'publish Docker image') {
imageName = project.imageName
tag = ( 'version'.equals(aTag) ) ? project.version : aTag
tag = ('version'.equals(aTag)) ? project.version : aTag
doFirst {
['dockerHubUsername', 'dockerHubPassword', 'dockerHubEmail'].each {
assert project.hasProperty(it) : 'Undefined "' + it + '" property'
assert project.hasProperty(it): 'Undefined "' + it + '" property'
}
docker {
registryCredentials {
Expand All @@ -189,4 +189,4 @@ afterEvaluate { project ->
}

assemble.dependsOn copyExecutableJar
// install.dependsOn installMinimesosScript
// install.dependsOn installMinimesosScript
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class ConfigParser {

private final Map<String, String> propsDictionary = [
"agents": "agent",
"cpus": "cpu",
"mems": "mem",
"disks": "disk",
"apps": "app"
"cpus" : "cpu",
"mems" : "mem",
"disks" : "disk",
"apps" : "app"
]
private final List<String> ignoredProperties = ["class", "format"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class ConsulConfig extends ContainerConfigBlock implements ContainerConfi
public static final int CONSUL_DNS_PORT = 8600

public ConsulConfig() {
imageName = CONSUL_IMAGE_NAME
imageTag = CONSUL_TAG_NAME
imageName = CONSUL_IMAGE_NAME
imageTag = CONSUL_TAG_NAME
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ package com.containersol.minimesos.config
interface ContainerConfig {

String getImageName()

void setImageName(String imageName)

String getImageTag()

void setImageTag(String imageTag)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class MarathonConfig extends ContainerConfigBlock implements ContainerCon
List<AppConfig> apps = new ArrayList<>();

public MarathonConfig() {
imageName = MARATHON_IMAGE
imageTag = MARATHON_IMAGE_TAG
imageName = MARATHON_IMAGE
imageTag = MARATHON_IMAGE_TAG
}

def app(@DelegatesTo(AppConfig) Closure cl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class MesosAgentConfig extends MesosContainerConfig {
AgentResourcesConfig resources = new AgentResourcesConfig()

public MesosAgentConfig() {
imageName = MESOS_AGENT_IMAGE
imageTag = MESOS_IMAGE_TAG
imageName = MESOS_AGENT_IMAGE
imageTag = MESOS_IMAGE_TAG
}

def resources(@DelegatesTo(AgentResourcesConfig) Closure cl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class MesosMasterConfig extends MesosContainerConfig {
public static final int MESOS_MASTER_PORT = 5050

public MesosMasterConfig() {
imageName = MESOS_MASTER_IMAGE
imageTag = MESOS_IMAGE_TAG
imageName = MESOS_MASTER_IMAGE
imageTag = MESOS_IMAGE_TAG
}

boolean authenticate = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ public class RegistratorConfig extends ContainerConfigBlock implements Container
public static final String REGISTRATOR_TAG_NAME = "v6"

public RegistratorConfig() {
imageName = REGISTRATOR_IMAGE_NAME
imageTag = REGISTRATOR_TAG_NAME
imageName = REGISTRATOR_IMAGE_NAME
imageTag = REGISTRATOR_TAG_NAME
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.containersol.minimesos.config

import java.text.DecimalFormat
import java.text.DecimalFormatSymbols

/**
* Check http://mesos.apache.org/documentation/latest/attributes-resources/ for possible types of values
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class ZooKeeperConfig extends ContainerConfigBlock implements ContainerCo
public static final String ZOOKEEPER_IMAGE_TAG = "3.4.6"

public ZooKeeperConfig() {
imageName = MESOS_LOCAL_IMAGE
imageTag = ZOOKEEPER_IMAGE_TAG
imageName = MESOS_LOCAL_IMAGE
imageTag = ZOOKEEPER_IMAGE_TAG
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public interface ClusterProcess {

MesosCluster getCluster();

void setCluster(MesosCluster mesosCluster);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class ClusterRepository {

public static final String MINIMESOS_FILE_PROPERTY = "minimesos.cluster";

private ClusterRepository() {}
private ClusterRepository() {
}

/**
* Loads representation of the running cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void destroy(MesosClusterFactory factory) {
* Starts a container. This container will be removed when the Mesos cluster is shut down.
*
* @param process container to be started
* @param timeout in seconds
* @param timeout in seconds
* @return container ID
*/
public String addAndStartProcess(ClusterProcess process, int timeout) {
Expand Down Expand Up @@ -374,7 +374,6 @@ public static File getHostDir() {
* Taking either URI or path to a file, returns string with its content
*
* @param location either absolute URI or path to a file
*
* @return input stream with location content or null
*/
public static InputStream getInputStream(String location) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public interface MesosContainer extends ClusterProcess {

void setZooKeeper(ZooKeeper zookeeper);

JSONObject getStateInfoJSON() throws UnirestException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public interface MesosMaster extends MesosContainer {

String getStateUrl();

void waitFor();

Map<String, String> getFlags() throws UnirestException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static boolean hasRoleInCluster(String containerName, String clusterId, S
/**
* Based on container name check if it has the given role in the cluster
*
* @param dockerNames as returned by <code>container.getNames()</code>
* @param clusterId cluster to check
* @param role role to check
* @param dockerNames as returned by <code>container.getNames()</code>
* @param clusterId cluster to check
* @param role role to check
* @return true if container has the role
*/
public static boolean hasRoleInCluster(String[] dockerNames, String clusterId, String role) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.containersol.minimesos.docker;

import com.containersol.minimesos.MinimesosException;
import com.github.dockerjava.api.DockerException;
import com.github.dockerjava.api.command.InspectContainerResponse;
import com.github.dockerjava.api.command.LogContainerCmd;
import com.github.dockerjava.api.DockerException;
import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.Frame;
import com.github.dockerjava.api.model.PullResponseItem;
Expand Down Expand Up @@ -37,6 +37,7 @@ private DockerContainersUtil(List<Container> containers) {

/**
* Use this getter if you need to iterate over docker objects
*
* @return set of docker containers
*/
public List<Container> getContainers() {
Expand Down Expand Up @@ -164,6 +165,7 @@ public static String getIpAddress(String containerId) {

/**
* Synchronized method for returning logs of docker container
*
* @param containerId - ID of the container ot lookup logs
* @return list of strings, where every string is log line
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* JUnit Rule extension of Mesos Cluster to use in JUnit.
*
* <p>
* TODO: see https://github.com/ContainerSolutions/minimesos/issues/8 for completion
*/
public class MesosClusterTestRule implements TestRule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
import com.beust.jcommander.Parameters;
import com.containersol.minimesos.MinimesosException;
import com.containersol.minimesos.cluster.MesosCluster;
import com.containersol.minimesos.config.*;
import com.containersol.minimesos.config.AppConfig;
import com.containersol.minimesos.config.ClusterConfig;
import com.containersol.minimesos.config.ConfigParser;
import com.containersol.minimesos.config.ConsulConfig;
import com.containersol.minimesos.config.MarathonConfig;
import com.containersol.minimesos.config.MesosAgentConfig;
import com.containersol.minimesos.config.MesosMasterConfig;
import com.containersol.minimesos.config.RegistratorConfig;
import com.containersol.minimesos.config.ZooKeeperConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import com.containersol.minimesos.cluster.MesosCluster;
import com.containersol.minimesos.mesos.MesosClusterContainersFactory;

import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

/**
Expand Down
Loading

0 comments on commit f14d7c4

Please sign in to comment.