Skip to content

Commit

Permalink
fix: restore previous constructor as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaeyaert committed Oct 11, 2024
1 parent f65eb73 commit c20fbe8
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.gravitee.common.util.MultiValueMap;
import io.gravitee.gateway.api.el.EvaluableSSLSession;
import io.gravitee.gateway.api.http.HttpHeaders;
import io.gravitee.gateway.reactive.api.context.GenericRequest;
import io.gravitee.gateway.reactive.api.context.http.HttpBaseRequest;
import java.util.Map;

Expand All @@ -28,6 +29,22 @@ public class EvaluableRequest {
private Map<String, Object> jsonContent;
private Map<String, Object> xmlContent;

/**
* @deprecated see {@link #EvaluableRequest(HttpBaseRequest)}
*/
@Deprecated
public EvaluableRequest(final GenericRequest request) {
this(request, null);
}

/**
* @deprecated see {@link #EvaluableRequest(HttpBaseRequest, String)}
*/
@Deprecated
public EvaluableRequest(final GenericRequest request, final String content) {
this((HttpBaseRequest) request, content);
}

public EvaluableRequest(final HttpBaseRequest request) {
this(request, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.gravitee.gateway.reactive.api.el;

import io.gravitee.gateway.api.http.HttpHeaders;
import io.gravitee.gateway.reactive.api.context.GenericResponse;
import io.gravitee.gateway.reactive.api.context.http.HttpBaseResponse;
import java.util.Map;

Expand All @@ -26,6 +27,22 @@ public class EvaluableResponse {
private Map<String, Object> jsonContent;
private Map<String, Object> xmlContent;

/**
* @deprecated see {@link #EvaluableResponse(HttpBaseResponse)}
*/
@Deprecated
public EvaluableResponse(final GenericResponse response) {
this(response, null);
}

/**
* @deprecated see {@link #EvaluableResponse(HttpBaseResponse, String)}
*/
@Deprecated
public EvaluableResponse(final GenericResponse response, final String content) {
this((HttpBaseResponse) response, content);
}

public EvaluableResponse(final HttpBaseResponse response) {
this(response, null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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.gravitee.gateway.reactive.api.el;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import io.gravitee.gateway.reactive.api.context.GenericRequest;
import io.gravitee.gateway.reactive.api.context.http.HttpBaseRequest;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
* @author Jeoffrey HAEYAERT (jeoffrey.haeyaert at graviteesource.com)
* @author GraviteeSource Team
*/
class EvaluableRequestTest {

@Test
void should_construct_with_http_base_request() {
HttpBaseRequest httpBaseRequest = Mockito.mock(HttpBaseRequest.class);
assertDoesNotThrow(() -> new EvaluableRequest(httpBaseRequest));
}

@Test
void should_construct_with_http_base_request_and_content() {
HttpBaseRequest httpBaseRequest = Mockito.mock(HttpBaseRequest.class);
assertDoesNotThrow(() -> new EvaluableRequest(httpBaseRequest, "content"));
}

@Test
void should_construct_with_generic_request() {
GenericRequest genericRequest = Mockito.mock(GenericRequest.class);
assertDoesNotThrow(() -> new EvaluableRequest(genericRequest));
}

@Test
void should_construct_with_generic_request_and_content() {
GenericRequest genericRequest = Mockito.mock(GenericRequest.class);
assertDoesNotThrow(() -> new EvaluableRequest(genericRequest, "content"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright © 2015 The Gravitee team (http://gravitee.io)
*
* 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.gravitee.gateway.reactive.api.el;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import io.gravitee.gateway.reactive.api.context.GenericResponse;
import io.gravitee.gateway.reactive.api.context.http.HttpBaseResponse;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
* @author Jeoffrey HAEYAERT (jeoffrey.haeyaert at graviteesource.com)
* @author GraviteeSource Team
*/
class EvaluableResponseTest {

@Test
void should_construct_with_http_base_response() {
HttpBaseResponse httpBaseResponse = Mockito.mock(HttpBaseResponse.class);
assertDoesNotThrow(() -> new EvaluableResponse(httpBaseResponse));
}

@Test
void should_construct_with_http_base_response_and_content() {
HttpBaseResponse httpBaseResponse = Mockito.mock(HttpBaseResponse.class);
assertDoesNotThrow(() -> new EvaluableResponse(httpBaseResponse, "content"));
}

@Test
void should_construct_with_generic_response() {
GenericResponse genericResponse = Mockito.mock(GenericResponse.class);
assertDoesNotThrow(() -> new EvaluableResponse(genericResponse));
}

@Test
void should_construct_with_generic_response_and_content() {
GenericResponse genericResponse = Mockito.mock(GenericResponse.class);
assertDoesNotThrow(() -> new EvaluableResponse(genericResponse, "content"));
}
}

0 comments on commit c20fbe8

Please sign in to comment.