This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into logs-remove-id-response
- Loading branch information
Showing
16 changed files
with
375 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../charlescd/moove/application/configuration/DeleteDeploymentConfigurationByIdInteractor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.charlescd.moove.application.configuration | ||
|
||
interface DeleteDeploymentConfigurationByIdInteractor { | ||
|
||
fun execute(workspaceId: String, id: String) | ||
} |
17 changes: 17 additions & 0 deletions
17
...d/moove/application/configuration/impl/DeleteDeploymentConfigurationByIdInteractorImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.charlescd.moove.application.configuration.impl | ||
|
||
import io.charlescd.moove.application.DeploymentConfigurationService | ||
import io.charlescd.moove.application.configuration.DeleteDeploymentConfigurationByIdInteractor | ||
import javax.inject.Inject | ||
import javax.inject.Named | ||
|
||
@Named | ||
class DeleteDeploymentConfigurationByIdInteractorImpl @Inject constructor( | ||
val deploymentConfigurationService: DeploymentConfigurationService | ||
) : DeleteDeploymentConfigurationByIdInteractor { | ||
|
||
override fun execute(workspaceId: String, id: String) { | ||
deploymentConfigurationService.checkIfDeploymentConfigurationExists(workspaceId, id) | ||
deploymentConfigurationService.delete(id) | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...application/configuration/impl/DeleteDeploymentConfigurationByIdInteractorImplTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.charlescd.moove.application.configuration.impl | ||
|
||
import io.charlescd.moove.application.DeploymentConfigurationService | ||
import io.charlescd.moove.application.configuration.DeleteDeploymentConfigurationByIdInteractor | ||
import io.charlescd.moove.domain.exceptions.NotFoundException | ||
import io.charlescd.moove.domain.repository.DeploymentConfigurationRepository | ||
import spock.lang.Specification | ||
|
||
class DeleteDeploymentConfigurationByIdInteractorImplTest extends Specification { | ||
|
||
private DeleteDeploymentConfigurationByIdInteractor interactor | ||
|
||
private DeploymentConfigurationRepository deploymentConfigurationRepository = Mock(DeploymentConfigurationRepository) | ||
|
||
def setup() { | ||
this.interactor = new DeleteDeploymentConfigurationByIdInteractorImpl(new DeploymentConfigurationService(deploymentConfigurationRepository)) | ||
} | ||
|
||
def 'when deployment configuration id does not exist should throw exception'() { | ||
given: | ||
def deploymentConfigurationId = "4e806b2a-557b-45c5-91be-1e1db909bef6" | ||
def workspaceId = "00000000-557b-45c5-91be-1e1db909bef6" | ||
|
||
when: | ||
interactor.execute(workspaceId, deploymentConfigurationId) | ||
|
||
then: | ||
1 * deploymentConfigurationRepository.exists(workspaceId, deploymentConfigurationId) >> false | ||
|
||
def ex = thrown(NotFoundException) | ||
ex.resourceName == "deploymentConfigurationId" | ||
ex.id == deploymentConfigurationId | ||
} | ||
|
||
def 'should delete git configuration id successfully'() { | ||
given: | ||
def deploymentConfigurationId = "4e806b2a-557b-45c5-91be-1e1db909bef6" | ||
def workspaceId = "00000000-557b-45c5-91be-1e1db909bef6" | ||
|
||
when: | ||
interactor.execute(workspaceId, deploymentConfigurationId) | ||
|
||
then: | ||
1 * deploymentConfigurationRepository.exists(workspaceId, deploymentConfigurationId) >> true | ||
1 * deploymentConfigurationRepository.delete(deploymentConfigurationId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.