diff --git a/build.sh b/build.sh index c16a4983..04d94ef6 100755 --- a/build.sh +++ b/build.sh @@ -39,7 +39,7 @@ fi cd cli/ && ./build-cli.sh if [ $? -ne 0 ]; then _notify_github failure "CLI build failed" - exit 1 + exit 1 fi cd $REPO_ROOT_DIR diff --git a/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/CassandraData.java b/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/CassandraData.java index 0353d9b6..693755be 100644 --- a/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/CassandraData.java +++ b/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/CassandraData.java @@ -92,7 +92,9 @@ public static final CassandraData createBackupSchemaData( context.getAccountId(), context.getSecretKey(), context.getUsesEmc(), - context.getRestoreType()); + context.getRestoreType(), + context.getUsername(), + context.getPassword()); } public static final CassandraData createBackupSchemaStatusData() { @@ -113,7 +115,9 @@ public static final CassandraData createBackupSnapshotData( context.getAccountId(), context.getSecretKey(), context.getUsesEmc(), - context.getRestoreType()); + context.getRestoreType(), + context.getUsername(), + context.getPassword()); } public static final CassandraData createBackupSnapshotStatusData() { @@ -133,7 +137,9 @@ public static final CassandraData createBackupUploadData( context.getAccountId(), context.getSecretKey(), context.getUsesEmc(), - context.getRestoreType()); + context.getRestoreType(), + context.getUsername(), + context.getPassword()); } public static final CassandraData createBackupUploadStatusData() { @@ -153,7 +159,9 @@ public static final CassandraData createSnapshotDownloadData( context.getAccountId(), context.getSecretKey(), context.getUsesEmc(), - context.getRestoreType()); + context.getRestoreType(), + context.getUsername(), + context.getPassword()); } public static final CassandraData createSnapshotDownloadStatusData() { @@ -173,7 +181,9 @@ public static final CassandraData createRestoreSnapshotData( context.getAccountId(), context.getSecretKey(), context.getUsesEmc(), - context.getRestoreType()); + context.getRestoreType(), + context.getUsername(), + context.getPassword()); } public static final CassandraData createRestoreSnapshotStatusData() { @@ -193,7 +203,9 @@ public static final CassandraData createRestoreSchemaData( context.getAccountId(), context.getSecretKey(), context.getUsesEmc(), - context.getRestoreType()); + context.getRestoreType(), + context.getUsername(), + context.getPassword()); } public static final CassandraData createRestoreSchemaStatusData() { @@ -284,7 +296,9 @@ private CassandraData(final CassandraTask.TYPE type, final String accountId, final String secretKey, final boolean usesEmc, - final String restoreType) { + final String restoreType, + final String username, + final String password) { data = CassandraProtos.CassandraData.newBuilder() .setType(type.ordinal()) @@ -298,6 +312,8 @@ private CassandraData(final CassandraTask.TYPE type, .setState(Protos.TaskState.TASK_STAGING.ordinal()) .setUsesEmc(usesEmc) .setRestoreType(restoreType) + .setUsername(username) + .setPassword(password) .build(); } @@ -412,7 +428,9 @@ public BackupRestoreContext getBackupRestoreContext() { data.getAccoundId(), data.getSecretKey(), data.getUsesEmc(), - data.getRestoreType()); + data.getRestoreType(), + data.getUsername(), + data.getPassword()); } public UpgradeSSTableContext getUpgradeSSTableContext() { diff --git a/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/backup/BackupRestoreContext.java b/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/backup/BackupRestoreContext.java index 1f8d7bac..42958186 100644 --- a/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/backup/BackupRestoreContext.java +++ b/cassandra-commons/src/main/java/com/mesosphere/dcos/cassandra/common/tasks/backup/BackupRestoreContext.java @@ -46,7 +46,11 @@ public static final BackupRestoreContext create( @JsonProperty("uses_emc") final boolean usesEmc, @JsonProperty("restore_type") - final String restoreType) { + final String restoreType, + @JsonProperty("username") + final String username, + @JsonProperty("password") + final String password) { return new BackupRestoreContext( nodeId, @@ -56,7 +60,9 @@ public static final BackupRestoreContext create( accountId, secretKey, usesEmc, - restoreType); + restoreType, + username, + password); } @JsonProperty("node_id") @@ -82,6 +88,12 @@ public static final BackupRestoreContext create( @JsonProperty("restore_type") private final String restoreType; + + @JsonProperty("username") + private final String username; + + @JsonProperty("password") + private final String password; public BackupRestoreContext(final String nodeId, final String name, @@ -90,7 +102,7 @@ public BackupRestoreContext(final String nodeId, final String accountId, final String secretKey, final boolean usesEmc, - final String restoreType) { + final String restoreType, final String username, final String password) { this.nodeId = nodeId; this.externalLocation = externalLocation; this.name = name; @@ -99,6 +111,8 @@ public BackupRestoreContext(final String nodeId, this.secretKey = secretKey; this.usesEmc = usesEmc; this.restoreType = restoreType; + this.username = username; + this.password = password; } /** @@ -179,6 +193,12 @@ public String getNodeId() { */ @JsonProperty("restore_type") public String getRestoreType() { return restoreType; } + + @JsonProperty("username") + public String getUsername() { return username; } + + @JsonProperty("password") + public String getPassword() { return password; } @Override public String toString() { @@ -198,7 +218,9 @@ public boolean equals(Object o) { that.getLocalLocation()) && Objects.equals(getAccountId(), that.getAccountId()) && Objects.equals(getSecretKey(), that.getSecretKey()) && - Objects.equals(getRestoreType(), that.getRestoreType()); + Objects.equals(getRestoreType(), that.getRestoreType()) && + Objects.equals(getUsername(), that.getUsername()) && + Objects.equals(getPassword(), that.getPassword()); } @Override @@ -217,7 +239,9 @@ public BackupRestoreContext forNode(final String nodeId){ accountId, secretKey, usesEmc, - restoreType); + restoreType, + username, + password); } @JsonIgnore @@ -230,6 +254,8 @@ public BackupRestoreContext withLocalLocation(final String localLocation){ accountId, secretKey, usesEmc, - restoreType); + restoreType, + username, + password); } } diff --git a/cassandra-commons/src/main/proto/common.proto b/cassandra-commons/src/main/proto/common.proto index f583688e..7ae0286e 100644 --- a/cassandra-commons/src/main/proto/common.proto +++ b/cassandra-commons/src/main/proto/common.proto @@ -91,4 +91,8 @@ message CassandraData{ optional bool usesEmc = 17; optional string restoreType = 18; + + optional string username = 19; + + optional string password = 20; } \ No newline at end of file diff --git a/cassandra-executor/apache-cassandra-2.2.5/conf/cassandra-rackdc.properties b/cassandra-executor/apache-cassandra-2.2.5/conf/cassandra-rackdc.properties index 53a77e8d..76efeb19 100644 --- a/cassandra-executor/apache-cassandra-2.2.5/conf/cassandra-rackdc.properties +++ b/cassandra-executor/apache-cassandra-2.2.5/conf/cassandra-rackdc.properties @@ -1,4 +1,2 @@ -#DCOS got yo Cassandra! -#Tue Jan 17 16:20:57 PST 2017 dc=dc1 rack=rac1 diff --git a/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/BackupSchema.java b/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/BackupSchema.java index 483f7675..c3aea8c6 100644 --- a/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/BackupSchema.java +++ b/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/BackupSchema.java @@ -37,7 +37,7 @@ * using Datastax Java Driver. */ public class BackupSchema implements ExecutorTask { - private static final Logger LOGGER = LoggerFactory.getLogger( + private static final Logger LOGGER = LoggerFactory.getLogger( BackupSchema.class); private CassandraDaemonProcess daemon; private ExecutorDriver driver; @@ -81,7 +81,7 @@ public void run() { sendStatus(driver, Protos.TaskState.TASK_RUNNING, "Started taking schema backup"); - cluster = Cluster.builder().addContactPoint(daemon.getProbe().getEndpoint()).build(); + cluster = Cluster.builder().addContactPoint(daemon.getProbe().getEndpoint()).withCredentials(context.getUsername(), context.getPassword()).build(); final List keyspaces = StorageUtil.filterSystemKeyspaces(daemon.getNonSystemKeySpaces()); if (keyspaces.size() > 0) { diff --git a/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSchema.java b/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSchema.java index 1109b52e..27dce888 100644 --- a/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSchema.java +++ b/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSchema.java @@ -66,7 +66,8 @@ public void run() { sendStatus(driver, Protos.TaskState.TASK_RUNNING, "Started restoring schema"); - cluster = Cluster.builder().addContactPoint(daemon.getProbe().getEndpoint()).build(); + //cluster = Cluster.builder().addContactPoint(daemon.getProbe().getEndpoint()).build(); + cluster = Cluster.builder().addContactPoint(daemon.getProbe().getEndpoint()).withCredentials(context.getUsername(), context.getPassword()).build(); session = cluster.connect(); read = new Scanner(backupStorageDriver.downloadSchema(context)); read.useDelimiter(";"); diff --git a/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSnapshot.java b/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSnapshot.java index 9ddaefda..f9187b48 100644 --- a/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSnapshot.java +++ b/cassandra-executor/src/main/java/com/mesosphere/dcos/cassandra/executor/tasks/RestoreSnapshot.java @@ -120,7 +120,7 @@ public void run() { final String columnFamilyPath = columnFamily.getAbsolutePath(); final List command = Arrays.asList( - ssTableLoaderBinary, "-d", libProcessAddress, "-f", + ssTableLoaderBinary, "-d", libProcessAddress, "-u",context.getUsername(),"-pw",context.getPassword(),"-f", cassandraYaml, columnFamilyPath); LOGGER.info("Executing command: {}", command); diff --git a/cassandra-executor/src/test/java/com/mesosphere/dcos/cassandra/executor/backup/S3StorageDriverTest.java b/cassandra-executor/src/test/java/com/mesosphere/dcos/cassandra/executor/backup/S3StorageDriverTest.java index 1361d5f3..72e89d43 100644 --- a/cassandra-executor/src/test/java/com/mesosphere/dcos/cassandra/executor/backup/S3StorageDriverTest.java +++ b/cassandra-executor/src/test/java/com/mesosphere/dcos/cassandra/executor/backup/S3StorageDriverTest.java @@ -30,7 +30,9 @@ public void testGetBucketNameS3Protocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(bucketName, s3StorageDriver.getBucketName(backupRestoreContext)); } @@ -45,7 +47,9 @@ public void testGetBucketNameHTTPSProtocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(bucketName, s3StorageDriver.getBucketName(backupRestoreContext)); } @@ -60,7 +64,9 @@ public void testGetBucketNameHTTPProtocolIPPort() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(bucketName, s3StorageDriver.getBucketName(backupRestoreContext)); } @@ -75,7 +81,9 @@ public void testGetEmptyPrefixKeyS3Protocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(backupName, s3StorageDriver.getPrefixKey(backupRestoreContext)); } @@ -91,7 +99,9 @@ public void testGetNestedPrefixKeyS3Protocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(nestedPath + "/" + backupName, s3StorageDriver.getPrefixKey(backupRestoreContext)); } @@ -106,7 +116,9 @@ public void testGetEmptyPrefixKeyHTTPSProtocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(backupName, s3StorageDriver.getPrefixKey(backupRestoreContext)); } @@ -122,7 +134,9 @@ public void testGetNestedPrefixKeyHTTPSProtocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(nestedPath + "/" + backupName, s3StorageDriver.getPrefixKey(backupRestoreContext)); } @@ -136,7 +150,9 @@ public void testGetEndpointS3Protocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(Constants.S3_HOSTNAME, s3StorageDriver.getEndpoint(backupRestoreContext)); } @@ -151,7 +167,9 @@ public void testGetEndpointHTTPSProtocol() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(endpoint, s3StorageDriver.getEndpoint(backupRestoreContext)); } @@ -166,7 +184,9 @@ public void testGetEndpointHTTPProtocolHostPort() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(endpoint, s3StorageDriver.getEndpoint(backupRestoreContext)); } @@ -181,7 +201,9 @@ public void testGetEndpointHTTPProtocolHost() throws URISyntaxException { "account-id", "secret-key", false, - "existing"); + "existing", + "username", + "password"); Assert.assertEquals(endpoint, s3StorageDriver.getEndpoint(backupRestoreContext)); } } diff --git a/cassandra-scheduler/src/main/java/com/mesosphere/dcos/cassandra/scheduler/resources/BackupRestoreRequest.java b/cassandra-scheduler/src/main/java/com/mesosphere/dcos/cassandra/scheduler/resources/BackupRestoreRequest.java index ba34ec94..5f68f554 100644 --- a/cassandra-scheduler/src/main/java/com/mesosphere/dcos/cassandra/scheduler/resources/BackupRestoreRequest.java +++ b/cassandra-scheduler/src/main/java/com/mesosphere/dcos/cassandra/scheduler/resources/BackupRestoreRequest.java @@ -33,6 +33,13 @@ public class BackupRestoreRequest implements ClusterTaskRequest { @JsonProperty("restore_type") private String restoreType; + + @JsonProperty("username") + private String username; + + @JsonProperty("password") + private String password; + public String getName() { return name; @@ -82,6 +89,28 @@ public void setAzureKey(String azureKey) { this.azureKey = azureKey; } + + public String getUsername() { + if (StringUtils.isBlank(username)) { + username= "nouser"; + } + return username; + } + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + if (StringUtils.isBlank(password)) { + password= "nopassword"; + } + return password; + } + + public void setPassword(String password) { + this.password = password; + } + public String getRestoreType() { @@ -139,6 +168,8 @@ public String toString() { ", azureKey='" + azureKey + '\'' + ", usesEmc='" + usesEmc + '\'' + ", restoreType='" + restoreType + '\'' + + ", username='" + username + '\'' + + ", password='" + password + '\'' + '}'; } @@ -162,7 +193,9 @@ public BackupRestoreContext toContext() { accountId, secretKey, usesEmc(), - getRestoreType()); + getRestoreType(), + getUsername(), + getPassword()); } private static boolean isAzure(String externalLocation) { diff --git a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupManagerTest.java b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupManagerTest.java index c462780d..807ebc06 100644 --- a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupManagerTest.java +++ b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupManagerTest.java @@ -61,7 +61,7 @@ public void testInitialNoState() { @Test public void testInitialWithState() throws IOException { - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); when(mockState.fetchProperty(BackupManager.BACKUP_KEY)).thenReturn( SerializationUtils.toJsonString(context).getBytes(StandardCharsets.UTF_8)); BackupManager manager = new BackupManager(mockCassandraState, mockProvider, mockState); diff --git a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupSnapshotStepTest.java b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupSnapshotStepTest.java index 3ec56e98..4ec52cc9 100644 --- a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupSnapshotStepTest.java +++ b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/BackupSnapshotStepTest.java @@ -46,7 +46,7 @@ public void beforeEach() { @Test public void testInitial() { Mockito.when(cassandraState.get("snapshot-node-0")).thenReturn(Optional.empty()); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupSnapshotStep backupSnapshotStep = new BackupSnapshotStep("node-0", cassandraState, provider, backupRestoreContext); Assert.assertEquals("snapshot-node-0", backupSnapshotStep.getName()); @@ -60,7 +60,7 @@ public void testComplete() { Mockito.when(mockCassandraTask.getState()).thenReturn(Protos.TaskState.TASK_FINISHED); Mockito.when(cassandraState.get("snapshot-node-0")) .thenReturn(Optional.ofNullable(mockCassandraTask)); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupSnapshotStep backupSnapshotStep = new BackupSnapshotStep("node-0", cassandraState, provider, backupRestoreContext); Assert.assertEquals("snapshot-node-0", backupSnapshotStep.getName()); @@ -75,7 +75,7 @@ public void testTaskStartAlreadyCompleted() throws Exception { final HashMap map = new HashMap<>(); map.put("node-0", null); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupSnapshotTask snapshotTask = Mockito.mock(BackupSnapshotTask.class); Mockito.when(snapshotTask.getSlaveId()).thenReturn("1234"); @@ -98,7 +98,7 @@ public void testTaskStart() throws Exception { final HashMap map = new HashMap<>(); map.put("node-0", daemonTask); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupSnapshotTask snapshotTask = Mockito.mock(BackupSnapshotTask.class); Mockito.when(snapshotTask.getSlaveId()).thenReturn("1234"); @@ -122,7 +122,7 @@ public void testTaskFailed() throws Exception { final HashMap map = new HashMap<>(); map.put("node-0", daemonTask); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupSnapshotTask snapshotTask = Mockito.mock(BackupSnapshotTask.class); Mockito.when(snapshotTask.getSlaveId()).thenReturn("1234"); diff --git a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/DownloadSnapshotStepTest.java b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/DownloadSnapshotStepTest.java index 60b99af0..e056e941 100644 --- a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/DownloadSnapshotStepTest.java +++ b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/DownloadSnapshotStepTest.java @@ -48,7 +48,7 @@ public void beforeEach() { @Test public void testInitial() { Mockito.when(cassandraState.get(DOWNLOAD_NODE_0)).thenReturn(Optional.empty()); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final DownloadSnapshotStep downloadSnapshotStep = new DownloadSnapshotStep(NODE_0, cassandraState, provider, backupRestoreContext); Assert.assertEquals(DOWNLOAD_NODE_0, downloadSnapshotStep.getName()); @@ -62,7 +62,7 @@ public void testComplete() { Mockito.when(mockCassandraTask.getState()).thenReturn(Protos.TaskState.TASK_FINISHED); Mockito.when(cassandraState.get(DOWNLOAD_NODE_0)) .thenReturn(Optional.ofNullable(mockCassandraTask)); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final DownloadSnapshotStep downloadSnapshotStep = new DownloadSnapshotStep(NODE_0, cassandraState, provider, backupRestoreContext); Assert.assertEquals(DOWNLOAD_NODE_0, downloadSnapshotStep.getName()); @@ -77,7 +77,7 @@ public void testTaskStartAlreadyCompleted() throws Exception { final HashMap map = new HashMap<>(); map.put(NODE_0, null); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final DownloadSnapshotTask snapshotTask = Mockito.mock(DownloadSnapshotTask.class); Mockito.when(snapshotTask.getSlaveId()).thenReturn("1234"); @@ -99,7 +99,7 @@ public void testTaskStart() throws Exception { final HashMap map = new HashMap<>(); map.put(NODE_0, daemonTask); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext backupRestoreContext = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final DownloadSnapshotTask snapshotTask = Mockito.mock(DownloadSnapshotTask.class); Mockito.when(snapshotTask.getSlaveId()).thenReturn("1234"); diff --git a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreManagerTest.java b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreManagerTest.java index ad2b2cbf..ab5fee0a 100644 --- a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreManagerTest.java +++ b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreManagerTest.java @@ -62,7 +62,7 @@ public void testInitialNoState() { @Test public void testInitialWithState() throws IOException { - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); when(mockState.fetchProperty(RestoreManager.RESTORE_KEY)).thenReturn( SerializationUtils.toJsonString(context).getBytes(StandardCharsets.UTF_8)); RestoreManager manager = new RestoreManager(mockCassandraState, mockProvider, mockState); diff --git a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreSnapshotStepTest.java b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreSnapshotStepTest.java index 09e30d6e..a585f2e6 100644 --- a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreSnapshotStepTest.java +++ b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/RestoreSnapshotStepTest.java @@ -47,7 +47,7 @@ public void beforeEach() { @Test public void testInitial() { Mockito.when(cassandraState.get(RESTORE_NODE_0)).thenReturn(Optional.empty()); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final RestoreSnapshotStep step = new RestoreSnapshotStep(NODE_0, cassandraState, provider, context); Assert.assertEquals(RESTORE_NODE_0, step.getName()); Assert.assertEquals(NODE_0, step.getDaemon()); @@ -60,7 +60,7 @@ public void testComplete() { Mockito.when(mockCassandraTask.getState()).thenReturn(Protos.TaskState.TASK_FINISHED); Mockito.when(cassandraState.get(RESTORE_NODE_0)) .thenReturn(Optional.ofNullable(mockCassandraTask)); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final RestoreSnapshotStep step = new RestoreSnapshotStep(NODE_0, cassandraState, provider, context); Assert.assertEquals(RESTORE_NODE_0, step.getName()); Assert.assertEquals(NODE_0, step.getDaemon()); @@ -74,7 +74,7 @@ public void testTaskStartAlreadyCompleted() throws Exception { final HashMap map = new HashMap<>(); map.put(NODE_0, null); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final RestoreSnapshotTask task = Mockito.mock(RestoreSnapshotTask.class); Mockito.when(task.getSlaveId()).thenReturn("1234"); @@ -94,7 +94,7 @@ public void testTaskStart() throws Exception { final HashMap map = new HashMap<>(); map.put(NODE_0, daemonTask); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final RestoreSnapshotTask task = Mockito.mock(RestoreSnapshotTask.class); Mockito.when(task.getSlaveId()).thenReturn("1234"); diff --git a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/UploadBackupStepTest.java b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/UploadBackupStepTest.java index 00996a1d..a89fed26 100644 --- a/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/UploadBackupStepTest.java +++ b/cassandra-scheduler/src/test/java/com/mesosphere/dcos/cassandra/scheduler/plan/backup/UploadBackupStepTest.java @@ -47,7 +47,7 @@ public void beforeEach() { @Test public void testInitial() { Mockito.when(cassandraState.get(UPLOAD_NODE_0)).thenReturn(Optional.empty()); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final UploadBackupStep step = new UploadBackupStep(NODE_0, cassandraState, provider, context); Assert.assertEquals(UPLOAD_NODE_0, step.getName()); Assert.assertEquals(NODE_0, step.getDaemon()); @@ -60,7 +60,7 @@ public void testComplete() { Mockito.when(mockCassandraTask.getState()).thenReturn(Protos.TaskState.TASK_FINISHED); Mockito.when(cassandraState.get(UPLOAD_NODE_0)) .thenReturn(Optional.ofNullable(mockCassandraTask)); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final UploadBackupStep step = new UploadBackupStep(NODE_0, cassandraState, provider, context); Assert.assertEquals(UPLOAD_NODE_0, step.getName()); Assert.assertEquals(NODE_0, step.getDaemon()); @@ -74,7 +74,7 @@ public void testTaskStartAlreadyCompleted() throws Exception { final HashMap map = new HashMap<>(); map.put(NODE_0, null); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupUploadTask task = Mockito.mock(BackupUploadTask.class); Mockito.when(task.getSlaveId()).thenReturn("1234"); @@ -94,7 +94,7 @@ public void testTaskStart() throws Exception { final HashMap map = new HashMap<>(); map.put(NODE_0, daemonTask); Mockito.when(cassandraState.getDaemons()).thenReturn(map); - final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, ""); + final BackupRestoreContext context = BackupRestoreContext.create("", "", "", "", "", "", false, "","",""); final BackupUploadTask task = Mockito.mock(BackupUploadTask.class); Mockito.when(task.getSlaveId()).thenReturn("1234");