Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus-Osuna-M committed Jan 30, 2024
1 parent 97abe80 commit 810d2e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ public class RundeckClient {

public static final String APPLICATION_ZIP = "application/zip";
public static final MediaType MEDIA_TYPE_ZIP = MediaType.parse(APPLICATION_ZIP);

private final RundeckApi rundeckApi;
private final Retrofit retrofit;

public RundeckClient(String url, String apiToken) {
Retrofit retrofit;
OkHttpClient.Builder okhttp = new OkHttpClient.Builder();
okhttp.addInterceptor(chain -> chain.proceed(chain.request().newBuilder().header("X-Rundeck-Auth-Token", apiToken).build()));
final String apiBaseUrl;
Expand All @@ -35,7 +34,11 @@ public RundeckClient(String url, String apiToken) {
.build();

rundeckApi = retrofit.create(RundeckApi.class);
}

public RundeckClient(RundeckApi rundeckApi, Retrofit retrofit){
this.rundeckApi = rundeckApi;
this.retrofit = retrofit;
}
public Response<ProjectImportStatus> importProjectArchive(
String projectName,
Expand Down Expand Up @@ -79,4 +82,7 @@ private static String normalizeUrlPath(String baseUrl) {
}
return baseUrl;
}
public Retrofit getRetrofit() {
return retrofit;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import com.dtolabs.rundeck.core.common.Framework
import com.dtolabs.rundeck.core.common.IFramework
import com.dtolabs.rundeck.core.common.IRundeckProject
import com.dtolabs.rundeck.core.common.ProjectManager
import org.rundeck.client.api.model.ProjectImportStatus
import com.dtolabs.rundeck.net.api.RundeckApi
import com.dtolabs.rundeck.net.api.RundeckClient
import com.dtolabs.rundeck.net.model.ProjectImportStatus
import com.dtolabs.rundeck.util.ZipBuilder
import grails.async.Promises
import grails.events.bus.EventBus
Expand All @@ -53,8 +55,6 @@ import org.rundeck.app.components.project.ProjectComponent
import org.rundeck.app.data.model.v1.report.dto.SaveReportRequestImpl
import org.rundeck.app.data.providers.GormExecReportDataProvider
import org.rundeck.app.services.ExecutionFile
import org.rundeck.client.util.Client
import org.rundeck.client.api.RundeckApi
import org.rundeck.core.auth.AuthConstants
import org.slf4j.Logger
import retrofit2.Call
Expand Down Expand Up @@ -1812,6 +1812,7 @@ class ProjectServiceSpec extends Specification implements ServiceUnitTest<Projec
def "should result success and no error msgs when export to another instance is success"() {
given:
ProjectArchiveParams exportArchiveParams = new ProjectArchiveParams([
targetproject:'project-target',
project : 'project-target',
preserveuuid : 'preserve',
exportExecutions : true,
Expand Down Expand Up @@ -1843,6 +1844,7 @@ class ProjectServiceSpec extends Specification implements ServiceUnitTest<Projec

ProjectArchiveParams exportArchiveParams = new ProjectArchiveParams([
project : 'project-target',
targetproject:'project-target',
preserveuuid : 'preserve',
exportExecutions : true,
exportConfigs : true,
Expand Down Expand Up @@ -3276,8 +3278,8 @@ abstract class MockRundeckApi implements RundeckApi{
}


Client<RundeckApi> getRundeckClient(){
return new Client<>(this, retrofit,null, null, 0, false, null)
RundeckClient getRundeckClient(){
return new RundeckClient(this, retrofit)
}

private void setupRetrofit(){
Expand Down

0 comments on commit 810d2e0

Please sign in to comment.