upgrade jdk and java ee

This commit is contained in:
Raupp Pereira 2023-06-05 19:50:34 +02:00
parent e39c1deb58
commit 5e696bc131
97 changed files with 656 additions and 570 deletions

View File

@ -42,10 +42,10 @@ jobs:
with:
languages: ${{ matrix.language }}
- name: Set up JDK 8 (Corretto)
- name: Set up JDK 17 (Corretto)
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'corretto'
cache: maven

View File

@ -16,10 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8 (Corretto)
- name: Set up JDK 17 (Corretto)
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'corretto'
cache: maven
- name: Build with Maven

View File

@ -30,7 +30,7 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -62,6 +62,9 @@
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<includes>
<include>${project.basedir}/target/generated-sources/**</include>
</includes>
</configuration>
</plugin>
<plugin>

View File

@ -30,7 +30,7 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -62,6 +62,9 @@
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:unchecked</compilerArgument>
<includes>
<include>${project.basedir}/target/generated-sources/**</include>
</includes>
</configuration>
</plugin>
<plugin>

View File

@ -30,7 +30,7 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -82,8 +82,8 @@
<!-- REST services CXF -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<groupId>org.apache.geronimo.javamail</groupId>
<artifactId>geronimo-javamail_1.6_mail</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
@ -102,8 +102,8 @@
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@ -111,14 +111,36 @@
</dependency>
<!-- /REST services CXF -->
<!-- Jakarta -->
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>${jakarta.inject.version}</version>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>${jakarta.ws.version}</version>
</dependency>
<!-- JAVAX -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<!-- SPRING -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-log4j</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>

View File

@ -30,7 +30,7 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -30,7 +30,7 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -30,7 +30,7 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -23,20 +23,20 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -23,21 +23,21 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -20,8 +20,8 @@ package org.apache.olingo.fit;
import java.io.IOException;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;

View File

@ -20,8 +20,8 @@ package org.apache.olingo.fit;
import java.io.IOException;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;

View File

@ -20,7 +20,7 @@ package org.apache.olingo.fit;
import java.io.IOException;
import javax.ws.rs.Path;
import jakarta.ws.rs.Path;
import org.springframework.stereotype.Service;

View File

@ -23,20 +23,20 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -43,26 +43,26 @@ import java.util.regex.Pattern;
import javax.mail.Header;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.core.UriInfo;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
@ -359,7 +359,7 @@ public class Services {
bos.write(Constants.CRLF);
bos.write(Constants.CRLF);
bos.write("HTTP/1.1 202 Accepted".getBytes());
bos.write("HTTP/1.1 202".getBytes());
bos.write(Constants.CRLF);
bos.write("Location: http://service-root/async-monitor".getBytes());
bos.write(Constants.CRLF);

View File

@ -20,12 +20,12 @@ package org.apache.olingo.fit;
import java.io.IOException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.apache.olingo.fit.metadata.Metadata;
import org.apache.olingo.fit.utils.Accept;

View File

@ -23,7 +23,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.ws.rs.HttpMethod;
import jakarta.ws.rs.HttpMethod;
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)

View File

@ -18,8 +18,8 @@
*/
package org.apache.olingo.fit.rest;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.cxf.rs.security.oauth2.common.AccessTokenRegistration;
import org.apache.cxf.rs.security.oauth2.common.Client;
@ -31,6 +31,8 @@ import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeRegistrati
import org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant;
import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
import org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken;
import org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken;
public class OAuth2Provider implements AuthorizationCodeDataProvider {
@ -65,7 +67,7 @@ public class OAuth2Provider implements AuthorizationCodeDataProvider {
@Override
public List<OAuthPermission> convertScopeToPermissions(final Client client, final List<String> list) {
return Collections.singletonList(new OAuthPermission());
return list.stream().map(l -> new OAuthPermission((l))).collect(Collectors.toList());
}
@Override
@ -117,16 +119,25 @@ public class OAuth2Provider implements AuthorizationCodeDataProvider {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeAccessToken(final ServerAccessToken sat) throws OAuthServiceException {
if (token != null && token.getTokenKey().equals(sat.getTokenKey())) {
token = null;
}
}
@Override
public void revokeToken(final Client client, final String string, final String string1) throws OAuthServiceException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<ServerAuthorizationCodeGrant>
getCodeGrants(Client client, UserSubject userSubject) throws OAuthServiceException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<ServerAccessToken> getAccessTokens(Client client, UserSubject userSubject) throws OAuthServiceException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<RefreshToken> getRefreshTokens(Client client, UserSubject userSubject) throws OAuthServiceException {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -18,15 +18,26 @@
*/
package org.apache.olingo.fit.rest;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.ext.Provider;
import jakarta.inject.Inject;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.ext.Provider;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer;
import org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter;
@Provider
public class OAuth2RequestFilter extends OAuthRequestFilter {
@Inject
public OAuth2RequestFilter(JoseJwtConsumer joseJwtConsumer, OAuth2Provider oAuth2Provider,
MessageContext messageContext) {
super.setJwtTokenConsumer(joseJwtConsumer);
super.setDataProvider(oAuth2Provider);
this.setMessageContext(messageContext);
}
@Override
public void filter(final ContainerRequestContext context) {
final String svcName =

View File

@ -23,10 +23,10 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerResponseContext;
import jakarta.ws.rs.container.ContainerResponseFilter;
import jakarta.ws.rs.ext.Provider;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -23,8 +23,8 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;
import org.apache.cxf.common.security.SimplePrincipal;
import org.apache.cxf.interceptor.Fault;

View File

@ -35,22 +35,25 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.SimpleFormatter;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionEvent;
import jakarta.servlet.http.HttpSessionListener;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.loader.WebappClassLoader;
import org.apache.catalina.loader.WebappClassLoaderBase;
import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.startup.Tomcat;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.tomcat.util.http.LegacyCookieProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -66,10 +69,11 @@ public class TomcatTestServer {
this.tomcat = tomcat;
}
public static void main(final String[] params) {
public static void main(final String[] params) throws LifecycleException {
TestServerBuilder server = null;
try {
LOG.trace("Start tomcat embedded server from main()");
TestServerBuilder server = TomcatTestServer.init(9180)
server = TomcatTestServer.init(9180)
.addStaticContent("/stub/StaticService/V40/OpenType.svc/$metadata", "V40/openTypeMetadata.xml")
.addStaticContent("/stub/StaticService/V40/Demo.svc/$metadata", "V40/demoMetadata.xml")
.addStaticContent("/stub/StaticService/V40/Static.svc/$metadata", "V40/metadata.xml");
@ -96,6 +100,8 @@ public class TomcatTestServer {
throw new RuntimeException("Failed to start Tomcat server from main method.", e);
} catch (LifecycleException e) {
throw new RuntimeException("Failed to start Tomcat server from main method.", e);
} finally {
server.stop();
}
}
@ -240,7 +246,11 @@ public class TomcatTestServer {
String contextPath = "/stub";
Context context = tomcat.addWebapp(tomcat.getHost(), contextPath, webAppDir.getAbsolutePath());
context.setLoader(new WebappLoader(Thread.currentThread().getContextClassLoader()));
WebappLoader webappLoader = new WebappLoader();
WebappClassLoaderBase webappClassLoaderBase =
new WebappClassLoader(Thread.currentThread().getContextClassLoader());
webappLoader.setLoaderInstance(webappClassLoaderBase);
context.setLoader(webappLoader);
LOG.info("Webapp {} at context {}.", webAppDir.getName(), contextPath);
return this;
@ -272,7 +282,7 @@ public class TomcatTestServer {
Context cxt = getContext();
String randomServletId = UUID.randomUUID().toString();
Tomcat.addServlet(cxt, randomServletId, httpServlet);
cxt.addServletMapping(path, randomServletId);
cxt.addServletMappingDecoded(path, randomServletId);
LOG.info("Added servlet {} at context {} (mapping id={}).", servletClassname, path, randomServletId);
return this;
}
@ -291,7 +301,7 @@ public class TomcatTestServer {
cxt.setAltDDName(webXMLPath);
String randomServletId = UUID.randomUUID().toString();
Tomcat.addServlet(cxt, randomServletId, httpServlet);
cxt.addServletMapping(contextPath, randomServletId);
cxt.addServletMappingDecoded(contextPath, randomServletId);
return this;
}
@ -315,7 +325,7 @@ public class TomcatTestServer {
}
Context cxt = getContext();
Tomcat.addServlet(cxt, name, httpServlet);
cxt.addServletMapping(path, name);
cxt.addServletMappingDecoded(path, name);
//
LOG.info("Added servlet {} at context {}.", name, path);
return this;
@ -325,7 +335,8 @@ public class TomcatTestServer {
private Context getContext() {
if (baseContext == null) {
baseContext = tomcat.addContext("/", baseDir.getAbsolutePath());
baseContext = tomcat.addContext("", baseDir.getAbsolutePath());
baseContext.setCookieProcessor(new LegacyCookieProcessor());
}
return baseContext;
}
@ -349,15 +360,15 @@ public class TomcatTestServer {
start();
tomcat.getServer().await();
}
}
public void stop() throws LifecycleException {
if (tomcat.getServer() != null
&& tomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
tomcat.stop();
public void stop() throws LifecycleException {
if (tomcat.getServer() != null
&& tomcat.getServer().getState() != LifecycleState.DESTROYED) {
if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
tomcat.stop();
}
tomcat.destroy();
}
tomcat.destroy();
}
}

View File

@ -35,8 +35,8 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.core.Response;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -26,7 +26,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import javax.ws.rs.NotFoundException;
import jakarta.ws.rs.NotFoundException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.vfs2.FileObject;

View File

@ -31,7 +31,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.NotFoundException;
import jakarta.ws.rs.NotFoundException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -40,7 +40,7 @@ import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import javax.ws.rs.NotFoundException;
import jakarta.ws.rs.NotFoundException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLEventReader;

View File

@ -22,32 +22,46 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<context:property-placeholder/>
<context:annotation-config/>
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"/>
<jaxrs:server id="services" address="/" basePackages="org.apache.olingo.fit">
<jaxrs:providers>
<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
<bean class="com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider"/>
<bean class="org.apache.olingo.fit.rest.OAuth2RequestFilter">
<property name="requiredScopes">
<list>
<value>foo</value>
<value>bar</value>
</list>
</property>
<property name="dataProvider" ref="oauthProvider"/>
<property name="jwtTokenConsumer" ref="jwtTokenConsumer"/>
<property name="messageContext" ref="messageContext" />
</bean>
<bean class="org.apache.olingo.fit.rest.ServiceNameResponseFilter"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="oauthProvider" class="org.apache.olingo.fit.rest.OAuth2Provider"/>
<bean id="jwtTokenConsumer" class="org.apache.cxf.rs.security.jose.jwt.JoseJwtConsumer"/>
<bean id="messageContext" class="org.apache.cxf.jaxrs.impl.tl.ThreadLocalMessageContext" />
<bean id="authorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
<property name="dataProvider" ref="oauthProvider"/>
</bean>

View File

@ -20,10 +20,10 @@ package org.apache.olingo.fit;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.catalina.LifecycleException;
import org.apache.commons.io.IOUtils;

View File

@ -21,7 +21,7 @@ package org.apache.olingo.fit;
import java.io.IOException;
import java.net.URI;
import javax.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
@ -49,14 +49,16 @@ import org.apache.http.util.EntityUtils;
import org.apache.olingo.client.core.http.AbstractOAuth2HttpClientFactory;
import org.apache.olingo.client.core.http.OAuth2Exception;
import org.apache.olingo.fit.rest.OAuth2Provider;
import org.apache.cxf.rs.security.oauth2.client.Consumer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory {
private static final OAuthClientUtils.Consumer OAUTH2_CONSUMER =
new OAuthClientUtils.Consumer(OAuth2Provider.CLIENT_ID, OAuth2Provider.CLIENT_SECRET);
private static final Consumer OAUTH2_CONSUMER =
new Consumer(OAuth2Provider.CLIENT_ID, OAuth2Provider.CLIENT_SECRET);
private ClientAccessToken accessToken;
@ -85,7 +87,7 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory
OAuth2Provider.CLIENT_ID,
OAuth2Provider.REDIRECT_URI,
null,
null);
"foo bar");
// Disable automatic redirects handling
final HttpParams params = new BasicHttpParams();
@ -120,6 +122,7 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory
addParameter("client_id", oAuthAuthorizationData.get("clientId").asText()).
addParameter("redirect_uri", oAuthAuthorizationData.get("redirectUri").asText()).
addParameter("oauthDecision", "allow").
addParameter("scope", "foo bar").
build();
final HttpGet method = new HttpGet(location);
method.addHeader("Authorization", "Basic " + Base64.encodeBase64String("odatajclient:odatajclient".getBytes()));

View File

@ -249,7 +249,7 @@ public class ConformanceTestITCase extends AbstractTestITCase {
assertEquals("application/json;odata.metadata=minimal", req.getAccept());
final ODataRetrieveResponse<ClientEntity> res = req.execute();
assertTrue(res.getContentType().startsWith("application/json; odata.metadata=minimal"));
assertTrue(res.getContentType().startsWith("application/json;odata.metadata=minimal"));
assertNotNull(res.getBody());
}

View File

@ -97,7 +97,6 @@ public class AuthBatchTestITCase extends AbstractParamTecSvcITCase{
final ODataBatchResponse response = streamManager.getResponse();
assertEquals(200, response.getStatusCode());
assertEquals("OK", response.getStatusMessage());
}
}

View File

@ -133,7 +133,6 @@ public class BatchClientITCase extends AbstractParamTecSvcITCase {
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("OK", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
assertFalse(iter.hasNext());
@ -151,7 +150,6 @@ public class BatchClientITCase extends AbstractParamTecSvcITCase {
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("OK", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
assertTrue(iter.hasNext());
@ -183,7 +181,6 @@ public class BatchClientITCase extends AbstractParamTecSvcITCase {
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("OK", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
assertTrue(iter.hasNext());

View File

@ -64,7 +64,7 @@ public class BoundOperationITCase extends AbstractParamTecSvcITCase {
final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("application/json; odata.metadata=full", response.getContentType());
assertEquals("application/json;odata.metadata=full", response.getContentType());
final ClientEntitySet entitySet = response.getBody();
assertNotNull(entitySet);
@ -124,7 +124,7 @@ public class BoundOperationITCase extends AbstractParamTecSvcITCase {
final ODataRetrieveResponse<ClientProperty> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("application/json; odata.metadata=full", response.getContentType());
assertEquals("application/json;odata.metadata=full", response.getContentType());
final ClientProperty property = response.getBody();
assertNotNull(property);
@ -151,7 +151,7 @@ public class BoundOperationITCase extends AbstractParamTecSvcITCase {
final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("application/json; odata.metadata=full", response.getContentType());
assertEquals("application/json;odata.metadata=full", response.getContentType());
final ClientEntitySet entitySet = response.getBody();
assertNotNull(entitySet);

View File

@ -245,7 +245,7 @@ public class ConformanceITCase extends AbstractParamTecSvcITCase {
assertEquals("application/json;odata.metadata=minimal", req.getAccept());
final ODataRetrieveResponse<ClientEntity> res = req.execute();
assertTrue(res.getContentType().startsWith("application/json; odata.metadata=minimal"));
assertTrue(res.getContentType().startsWith("application/json;odata.metadata=minimal"));
assertNotNull(res.getBody());
}

View File

@ -66,7 +66,7 @@ public class EntityWithStreamITCase extends AbstractParamTecSvcITCase {
final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("application/json; odata.metadata=full", response.getContentType());
assertEquals("application/json;odata.metadata=full", response.getContentType());
final ClientEntitySet entitySet = response.getBody();
assertNotNull(entitySet);
@ -132,7 +132,7 @@ public class EntityWithStreamITCase extends AbstractParamTecSvcITCase {
final ODataRetrieveResponse<ClientEntity> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("application/json; odata.metadata=full", response.getContentType());
assertEquals("application/json;odata.metadata=full", response.getContentType());
final ClientEntity entity = response.getBody();
assertNotNull(entity);
@ -194,7 +194,7 @@ public class EntityWithStreamITCase extends AbstractParamTecSvcITCase {
final ODataRetrieveResponse<ClientEntity> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("application/json; odata.metadata=full", response.getContentType());
assertEquals("application/json;odata.metadata=full", response.getContentType());
final ClientEntity entity = response.getBody();
assertNotNull(entity);

View File

@ -74,7 +74,7 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
assertEquals(0, response.byteLength());
Map<String, List<String>> headerFields = connection.getHeaderFields();
assertEquals("HTTP/1.1 202 Accepted", headerFields.get(null).get(0));
assertEquals("HTTP/1.1 202", headerFields.get(null).get(0));
assertTrue(Pattern.matches("http:\\/\\/localhost:9080\\/odata-server-tecsvc\\/status\\/\\d*",
headerFields.get("Location").get(0)));
assertEquals("respond-async", headerFields.get("Preference-Applied").get(0));
@ -84,7 +84,7 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
HttpURLConnection statusRequest = getRequest(new URL(respondUri), Collections.<String, String>emptyMap());
StringHelper.Stream statusBody = StringHelper.toStream(statusRequest.getInputStream());
Map<String, List<String>> statusHeaderFields = statusRequest.getHeaderFields();
assertEquals("HTTP/1.1 202 Accepted", statusHeaderFields.get(null).get(0));
assertEquals("HTTP/1.1 202", statusHeaderFields.get(null).get(0));
assertEquals(0, statusBody.byteLength());
// get async response (now finished)
@ -94,10 +94,10 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
Map<String, List<String>> resultHeaderFields = result.getHeaderFields();
String resBody = resultBody.asString();
assertEquals("HTTP/1.1 200 OK", resultHeaderFields.get(null).get(0));
assertEquals("HTTP/1.1 200", resultHeaderFields.get(null).get(0));
assertEquals(1007, resultBody.byteLength());
contains(resBody,
"HTTP/1.1 200 OK",
"HTTP/1.1 200",
"OData-Version: 4.0",
"Content-Length: 605",
"\"@odata.context\":\"$metadata#ESAllPrim/$entity\"",
@ -117,7 +117,7 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
assertEquals(0, response.byteLength());
Map<String, List<String>> headerFields = connection.getHeaderFields();
assertEquals("HTTP/1.1 202 Accepted", headerFields.get(null).get(0));
assertEquals("HTTP/1.1 202", headerFields.get(null).get(0));
// because of generated status id it is only checked that the location starts correct and contains a number
assertTrue(Pattern.matches("http:\\/\\/localhost:9080\\/odata-server-tecsvc\\/status\\/\\d*",
headerFields.get("Location").get(0)));
@ -128,7 +128,7 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
HttpURLConnection statusRequest = getRequest(new URL(respondUri), Collections.<String, String>emptyMap());
StringHelper.Stream statusBody = StringHelper.toStream(statusRequest.getInputStream());
Map<String, List<String>> statusHeaderFields = statusRequest.getHeaderFields();
assertEquals("HTTP/1.1 202 Accepted", statusHeaderFields.get(null).get(0));
assertEquals("HTTP/1.1 202", statusHeaderFields.get(null).get(0));
assertEquals(0, statusBody.byteLength());
// get async response (now finished)
@ -136,10 +136,10 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
StringHelper.Stream resultBody = StringHelper.toStream(result.getInputStream());
Map<String, List<String>> resultHeaderFields = result.getHeaderFields();
String resBody = resultBody.asString();
assertEquals("HTTP/1.1 200 OK", resultHeaderFields.get(null).get(0));
assertEquals("HTTP/1.1 200", resultHeaderFields.get(null).get(0));
assertEquals(2321, resultBody.byteLength());
contains(resBody,
"HTTP/1.1 200 OK",
"HTTP/1.1 200",
"OData-Version: 4.0",
"Content-Length: 605",
"\"@odata.context\":\"$metadata#ESAllPrim/$entity\"",
@ -192,10 +192,10 @@ public class BasicAsyncITCase extends AbstractBaseTestITCase {
HttpURLConnection statusRequest = getRequest(new URL(location), Collections.<String, String>emptyMap());
Map<String, List<String>> statusHeaderFields = statusRequest.getHeaderFields();
String statusHeader = statusHeaderFields.get(null).get(0);
if("HTTP/1.1 202 Accepted".equals(statusHeader)) {
if("HTTP/1.1 202".equals(statusHeader)) {
TimeUnit.MILLISECONDS.sleep(SLEEP_TIMEOUT_IN_MS);
waitCounter -= SLEEP_TIMEOUT_IN_MS;
} else if("HTTP/1.1 200 OK".equals(statusHeader)) {
} else if("HTTP/1.1 200".equals(statusHeader)) {
result = statusRequest;
} else {
throw new RuntimeException("Unexpected status header ('" + statusHeader +

View File

@ -130,7 +130,7 @@ public class ODataVersionConformanceITCase extends AbstractBaseTestITCase {
assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
assertEquals("4.0", connection.getHeaderField(HttpHeader.ODATA_VERSION));
assertEquals("application/json; odata.metadata=minimal",
assertEquals("application/json;odata.metadata=minimal",
connection.getHeaderField(HttpHeader.CONTENT_TYPE));
final String content = IOUtils.toString(connection.getInputStream(), Charset.defaultCharset());
@ -149,7 +149,7 @@ public class ODataVersionConformanceITCase extends AbstractBaseTestITCase {
assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
assertEquals("4.0", connection.getHeaderField(HttpHeader.ODATA_VERSION));
assertEquals("application/json; odata.metadata=minimal",
assertEquals("application/json;odata.metadata=minimal",
connection.getHeaderField(HttpHeader.CONTENT_TYPE));
final String content = IOUtils.toString(connection.getInputStream(), Charset.defaultCharset());

View File

@ -95,7 +95,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

View File

@ -28,7 +28,7 @@ Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2
HTTP/1.1 200 OK
HTTP/1.1 200
DataServiceVersion: 2.0
Content-Type: text/plain;charset=utf-8
Content-length: 13

View File

@ -28,7 +28,7 @@ Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2
HTTP/1.1 200 OK
HTTP/1.1 200
DataServiceVersion: 2.0
Content-Type: text/plain;charset=utf-8
Content-length: 13

View File

@ -52,7 +52,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -41,9 +41,9 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -18,8 +18,8 @@
*/
package org.apache.olingo.server.api;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.olingo.server.api.debug.DebugSupport;
import org.apache.olingo.server.api.etag.CustomETagSupport;

View File

@ -50,11 +50,17 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta.annotation.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -62,7 +68,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@ -80,21 +86,10 @@
<artifactId>tomcat-embed-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

View File

@ -20,8 +20,8 @@ package org.apache.olingo.server.core;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;

View File

@ -267,7 +267,6 @@ public class NettyServiceDispatcherTest {
handler.processNettyRequest(nettyRequest, nettyResponse, requestParams);
assertNotNull(new String (nettyResponse.content().array()));
assertEquals(200, nettyResponse.status().code());
assertEquals("OK", nettyResponse.status().reasonPhrase());
}
@Test

View File

@ -27,9 +27,9 @@ import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.catalina.Context;
import org.apache.catalina.startup.Tomcat;
@ -60,6 +60,7 @@ import org.apache.olingo.server.core.responses.NoContentResponse;
import org.apache.olingo.server.core.responses.PrimitiveValueResponse;
import org.apache.olingo.server.core.responses.PropertyResponse;
import org.apache.olingo.server.core.responses.StreamResponse;
import org.junit.After;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
@ -102,11 +103,13 @@ public class ServiceDispatcherTest {
tomcat.getHost().setAppBase(baseDir.getAbsolutePath());
Context cxt = tomcat.addContext("/trippin", baseDir.getAbsolutePath());
Tomcat.addServlet(cxt, "trippin", new SampleODataServlet(serviceHandler, metadata));
cxt.addServletMapping("/*", "trippin");
cxt.addServletMappingDecoded("/*", "trippin");
tomcat.setPort(TOMCAT_PORT);
tomcat.getConnector().setSecure(false);
tomcat.start();
}
@After
public void afterTest() throws Exception {
tomcat.stop();
tomcat.destroy();
@ -136,7 +139,6 @@ public class ServiceDispatcherTest {
beforeTest(handler);
httpGET("http://localhost:" + TOMCAT_PORT + "/" + path);
validator.validate();
afterTest();
}
private void helpTest(ServiceHandler handler, String path, String method, String payload,
@ -163,7 +165,6 @@ public class ServiceDispatcherTest {
http.execute(getLocalhost(), request);
validator.validate();
afterTest();
}
@Test
@ -186,7 +187,7 @@ public class ServiceDispatcherTest {
@Override
public void validate() throws Exception {
ArgumentCaptor<DataRequest> arg1 = ArgumentCaptor.forClass(DataRequest.class);
ArgumentCaptor<EntityResponse> arg2 = ArgumentCaptor.forClass(EntityResponse.class);
ArgumentCaptor<EntitySetResponse> arg2 = ArgumentCaptor.forClass(EntitySetResponse.class);
Mockito.verify(handler).read(arg1.capture(), arg2.capture());
DataRequest request = arg1.getValue();
@ -323,7 +324,7 @@ public class ServiceDispatcherTest {
@Override
public void validate() throws Exception {
ArgumentCaptor<FunctionRequest> arg1 = ArgumentCaptor.forClass(FunctionRequest.class);
ArgumentCaptor<PropertyResponse> arg3 = ArgumentCaptor.forClass(PropertyResponse.class);
ArgumentCaptor<EntityResponse> arg3 = ArgumentCaptor.forClass(EntityResponse.class);
ArgumentCaptor<HttpMethod> arg2 = ArgumentCaptor.forClass(HttpMethod.class);
Mockito.verify(handler).invoke(arg1.capture(), arg2.capture(), arg3.capture());

View File

@ -41,6 +41,8 @@ import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.http.impl.conn.SchemeRegistryFactory;
import org.apache.http.util.EntityUtils;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.junit.AfterClass;
@ -67,13 +69,21 @@ public class TripPinServiceTest {
@BeforeClass
public static void beforeTest() throws Exception {
PoolingClientConnectionManager conMan =
new PoolingClientConnectionManager(SchemeRegistryFactory.createDefault());
conMan.setMaxTotal(200);
conMan.setDefaultMaxPerRoute(200);
http = new DefaultHttpClient(conMan);
tomcat.setPort(TOMCAT_PORT);
File baseDir = new File(System.getProperty("java.io.tmpdir"));
tomcat.setBaseDir(baseDir.getAbsolutePath());
tomcat.getHost().setAppBase(baseDir.getAbsolutePath());
tomcat.getHost().setDeployOnStartup(true);
tomcat.getConnector().setSecure(false);
tomcat.setSilent(true);
Context cxt = tomcat.addContext("/trippin", baseDir.getAbsolutePath());
Tomcat.addServlet(cxt, "trippin", new TripPinServlet());
cxt.addServletMapping("/*", "trippin");
cxt.addServletMappingDecoded("/*", "trippin");
baseURL = "http://" + tomcat.getHost().getName() + ":"+ TOMCAT_PORT+"/trippin";
tomcat.start();
}
@ -192,7 +202,7 @@ public class TripPinServiceTest {
public void testErrorResponse() throws Exception {
HttpResponse response = httpGET(baseURL + "/Airlines(1)", 400);
Header[] headers = response.getHeaders("Content-Type");
assertEquals("application/json; odata.metadata=minimal", headers[0].getValue());
assertEquals("application/json;odata.metadata=minimal", headers[0].getValue());
assertEquals("{\"error\":{\"code\":null,\"message\":\"The key value '' is invalid.\"}}",
IOUtils.toString(response.getEntity().getContent()));
}

View File

@ -21,11 +21,11 @@ package org.apache.olingo.server.example;
import java.io.FileReader;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import javax.xml.stream.XMLStreamException;
import org.apache.olingo.server.api.OData;

View File

@ -46,9 +46,9 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -77,7 +77,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -32,8 +32,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.http.HttpHeader;

View File

@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;

View File

@ -19,8 +19,7 @@
package org.apache.olingo.server.core;
import static org.junit.Assert.*;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -35,6 +34,7 @@ import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
import org.apache.olingo.server.api.serializer.RepresentationType;
import org.apache.olingo.server.api.uri.queryoption.FormatOption;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
public class ContentNegotiatorTest {
@ -297,7 +297,7 @@ public class ContentNegotiatorTest {
CustomContentTypeSupport customContentTypeSupport = mock(CustomContentTypeSupport.class);
when(customContentTypeSupport.modifySupportedContentTypes(
anyListOf(ContentType.class), any(RepresentationType.class)))
ArgumentMatchers.anyList(), any(RepresentationType.class)))
.thenReturn(types);
return customContentTypeSupport;
}

View File

@ -23,7 +23,7 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.ODataLibraryException;

View File

@ -84,65 +84,65 @@ public class MockedBatchHandlerTest {
@Test
public void test() throws Exception {
final String content = "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 3" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 4" + CRLF
+ CRLF
+ "PUT $3/PropertyInt32 HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "POST ESAllPrim HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 5" + CRLF
+ CRLF
+ "POST http://localhost:8080/odata/$1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 6" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 3" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 4" + CRLF
+ CRLF
+ "PUT $3/PropertyInt32 HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "POST ESAllPrim HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 5" + CRLF
+ CRLF
+ "POST http://localhost:8080/odata/$1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 6" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
final Map<String, List<String>> header = getMimeHeader();
final ODataResponse response = new ODataResponse();
final ODataRequest request = buildODataRequest(content, header);
@ -150,7 +150,7 @@ public class MockedBatchHandlerTest {
batchHandler.process(request, response, true);
BatchLineReader reader =
new BatchLineReader(response.getContent());
new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
reader.close();
@ -205,14 +205,14 @@ public class MockedBatchHandlerTest {
@Test
public void testGetRequest() throws Exception {
final String content = ""
+ "--batch_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ CRLF
+ "GET ESAllPrim(0) HTTP/1.1" + CRLF
+ CRLF
+ CRLF
+ "--batch_12345--";
+ "--batch_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ CRLF
+ "GET ESAllPrim(0) HTTP/1.1" + CRLF
+ CRLF
+ CRLF
+ "--batch_12345--";
final Map<String, List<String>> header = getMimeHeader();
final ODataResponse response = new ODataResponse();
@ -221,7 +221,7 @@ public class MockedBatchHandlerTest {
batchHandler.process(request, response, true);
BatchLineReader reader =
new BatchLineReader(response.getContent());
new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
int line = 0;
@ -245,54 +245,54 @@ public class MockedBatchHandlerTest {
@Test
public void testMultipleChangeSets() throws Exception {
final String content = ""
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_54321" + CRLF
+ CRLF
+ "--changeset_54321" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT http://localhost:8080/odata/ESAllPrim(2) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_54321" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_54321--" + CRLF
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_54321" + CRLF
+ CRLF
+ "--changeset_54321" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT http://localhost:8080/odata/ESAllPrim(2) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_54321" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_54321--" + CRLF
+ CRLF
+ "--batch_12345--";
+ CRLF
+ "--batch_12345--";
final Map<String, List<String>> header = getMimeHeader();
final ODataResponse response = new ODataResponse();
final ODataRequest request = buildODataRequest(content, header);
@ -300,7 +300,7 @@ public class MockedBatchHandlerTest {
batchHandler.process(request, response, true);
BatchLineReader reader =
new BatchLineReader(response.getContent());
new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
reader.close();
@ -367,49 +367,49 @@ public class MockedBatchHandlerTest {
@Test
public void mimeBodyPartTransitive() throws Exception {
final String content = ""
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 3" + CRLF
+ CRLF
+ "POST $2/NavPropertyETAllPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 4" + CRLF
+ CRLF
+ "POST $3/NavPropertyETTwoPrimOne HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 2" + CRLF
+ CRLF
+ "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 3" + CRLF
+ CRLF
+ "POST $2/NavPropertyETAllPrimMany HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 4" + CRLF
+ CRLF
+ "POST $3/NavPropertyETTwoPrimOne HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
+ CRLF
+ "--batch_12345--";
final Map<String, List<String>> header = getMimeHeader();
final ODataResponse response = new ODataResponse();
@ -418,7 +418,7 @@ public class MockedBatchHandlerTest {
batchHandler.process(request, response, true);
BatchLineReader reader =
new BatchLineReader(response.getContent());
new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
reader.close();
@ -468,21 +468,21 @@ public class MockedBatchHandlerTest {
@Test(expected = BatchDeserializerException.class)
public void testInvalidMethod() throws Exception {
final String content = ""
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
final Map<String, List<String>> header = getMimeHeader();
final ODataResponse response = new ODataResponse();
@ -495,21 +495,21 @@ public class MockedBatchHandlerTest {
@Test(expected = BatchDeserializerException.class)
public void testInvalidContentType() throws Exception {
final String content = ""
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
+ CRLF
+ "--changeset_12345" + CRLF
+ "Content-Type: application/http" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
+ "Content-Id: 1" + CRLF
+ CRLF
+ "PUT ESAllPrim(1) HTTP/1.1" + CRLF
+ "Content-Type: application/json;odata=verbose" + CRLF
+ CRLF
+ CRLF
+ "--changeset_12345--" + CRLF
+ CRLF
+ "--batch_12345--";
final Map<String, List<String>> header = new HashMap<String, List<String>>();
header.put(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] { "application/http" }));
@ -543,7 +543,7 @@ public class MockedBatchHandlerTest {
}
private ODataRequest buildODataRequest(final String content, final Map<String, List<String>> header)
throws Exception {
throws Exception {
final ODataRequest request = new ODataRequest();
for (final String key : header.keySet()) {
@ -591,11 +591,11 @@ public class MockedBatchHandlerTest {
@Override
public void processBatch(final BatchFacade fascade, final ODataRequest request, final ODataResponse response)
throws ODataApplicationException, BatchSerializerException, ODataLibraryException {
throws ODataApplicationException, BatchSerializerException, ODataLibraryException {
final String boundary = getBoundary(request.getHeader(HttpHeader.CONTENT_TYPE));
final BatchOptions options = BatchOptions.with().isStrict(true).rawBaseUri(BASE_URI).build();
final List<BatchRequestPart> parts =
odata.createFixedFormatDeserializer().parseBatchRequest(request.getBody(), boundary, options);
odata.createFixedFormatDeserializer().parseBatchRequest(request.getBody(), boundary, options);
final List<ODataResponsePart> responseParts = new ArrayList<ODataResponsePart>();
for (BatchRequestPart part : parts) {
@ -616,7 +616,7 @@ public class MockedBatchHandlerTest {
final String responeBoundary = "batch_" + UUID.randomUUID().toString();
final InputStream responseStream =
odata.createFixedFormatSerializer().batchResponse(responseParts, responeBoundary);
odata.createFixedFormatSerializer().batchResponse(responseParts, responeBoundary);
response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responeBoundary);

View File

@ -23,14 +23,14 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;

View File

@ -1178,7 +1178,7 @@ public class BatchRequestParserTest {
}
private InputStream readFile(final String fileName) throws IOException {
final InputStream in = ClassLoader.class.getResourceAsStream(fileName);
final InputStream in = BatchRequestParserTest.class.getResourceAsStream(fileName);
if (in == null) {
throw new IOException("Requested file '" + fileName + "' was not found.");
}

View File

@ -117,11 +117,16 @@
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.xml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
@ -163,7 +168,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>

View File

@ -23,11 +23,11 @@ import java.net.URI;
import java.util.Collections;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.apache.olingo.commons.api.edmx.EdmxReference;
import org.apache.olingo.commons.api.edmx.EdmxReferenceInclude;

View File

@ -18,8 +18,8 @@
*/
package org.apache.olingo.server.tecsvc;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService;

View File

@ -31,8 +31,8 @@ import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.processor.Processor;
import org.apache.olingo.server.api.serializer.SerializerException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.Closeable;
import java.io.IOException;

View File

@ -21,10 +21,10 @@ package org.apache.olingo.server.tecsvc.async;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
public class TechnicalStatusMonitorServlet extends HttpServlet {

View File

@ -23,7 +23,7 @@ import java.util.Iterator;
import java.util.ListIterator;
import java.util.Locale;
import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;

View File

@ -56,7 +56,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>

View File

@ -24,12 +24,12 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@ -791,19 +791,19 @@ public class ODataHandlerImplTest {
final MediaEntityProcessor processor = mock(MediaEntityProcessor.class);
dispatch(HttpMethod.GET, uri, processor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
dispatch(HttpMethod.POST, uri, processor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
dispatch(HttpMethod.PUT, uri, processor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
dispatch(HttpMethod.DELETE, uri, processor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
dispatch(HttpMethod.HEAD, uri, processor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
}
@Test
@ -1108,7 +1108,7 @@ public class ODataHandlerImplTest {
EntityProcessor processor = mock(EntityProcessor.class);
final ODataResponse response = dispatch(HttpMethod.POST, "ESAllPrim", null,
HttpHeader.CONTENT_TYPE, "*/*", processor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), response.getStatusCode());
}
@ -1117,7 +1117,7 @@ public class ODataHandlerImplTest {
EntityProcessor processor = mock(EntityProcessor.class);
ErrorProcessor errorProcessor = mock(ErrorProcessor.class);
dispatch(HttpMethod.POST, "ESAllPrim", null, HttpHeader.CONTENT_TYPE, "some/unsupported", errorProcessor);
verifyZeroInteractions(processor);
verifyNoInteractions(processor);
verify(errorProcessor).processError(any(ODataRequest.class), any(ODataResponse.class),
any(ODataServerError.class),
any(ContentType.class));

View File

@ -21,7 +21,7 @@ package org.apache.olingo.server.core;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

View File

@ -180,7 +180,7 @@ public class ParserTest {
.goPath().first()
.isNavProperty("Products", nameProducts, false)
.isType(nameProducts, false);
Mockito.verifyZeroInteractions(esProduct);
Mockito.verifyNoInteractions(esProduct);
}
/**

40
pom.xml
View File

@ -80,8 +80,7 @@
<commons.vfs.version>2.0</commons.vfs.version>
<esigate.version>4.4</esigate.version>
<servlet.version>3.1.0</servlet.version>
<cxf.version>3.0.16</cxf.version>
<spring.version>4.0.9.RELEASE</spring.version>
<cxf.version>4.0.1</cxf.version>
<netty.version>4.1.84.Final</netty.version>
<velocity.version>1.7</velocity.version>
@ -94,7 +93,7 @@
<jackson-databind.version>2.14.0</jackson-databind.version>
<aalto-xml.version>1.3.1</aalto-xml.version>
<xmlunit.version>1.6</xmlunit.version>
<mockito-all.version>1.10.19</mockito-all.version>
<mockito.core.version>5.3.1</mockito.core.version>
<junit.version>4.13.2</junit.version>
<android.platform.version>4.1.1.4</android.platform.version>
@ -103,7 +102,7 @@
<sl4j.version>1.7.36</sl4j.version>
<tomcat.servlet.port>9080</tomcat.servlet.port>
<tomcat.version>7.0.109</tomcat.version>
<tomcat.version>10.0.27</tomcat.version>
<!-- for osgi integration testing -->
<osgi.version>4.2.0</osgi.version>
@ -115,6 +114,14 @@
<project.build.source>8</project.build.source>
<project.build.outputTimestamp>${maven.build.timestamp}</project.build.outputTimestamp>
<olingo.deploy.skip>true</olingo.deploy.skip>
<jakarta.inject.version>2.0.1</jakarta.inject.version>
<jakarta.ws.version>3.1.0</jakarta.ws.version>
<jakarta.servlet.version>6.0.0</jakarta.servlet.version>
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
<jakarta.xml.version>4.0.0</jakarta.xml.version>
<spring.version>6.0.9</spring.version>
<javax.activation.version>1.1</javax.activation.version>
<geronimo.version>1.0.1</geronimo.version>
<!-- Setting needed for Java 8 release builds -->
<additionalparam>-Xdoclint:none</additionalparam>
@ -181,8 +188,8 @@
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
@ -220,14 +227,14 @@
<version>${esigate.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<version>1.7.1</version>
<groupId>org.apache.geronimo.javamail</groupId>
<artifactId>geronimo-javamail_1.6_mail</artifactId>
<version>${geronimo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
@ -255,11 +262,6 @@
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-log4j</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
@ -292,8 +294,8 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito-all.version}</version>
<artifactId>mockito-core</artifactId>
<version>${mockito.core.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -52,9 +52,9 @@
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>

View File

@ -21,11 +21,11 @@ package org.apache.olingo.server.sample;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.apache.olingo.commons.api.edmx.EdmxReference;
import org.apache.olingo.server.api.OData;

View File

@ -241,7 +241,7 @@ public class DemoEntityProcessor implements EntityProcessor, MediaEntityProcesso
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
* {
* "ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoActionProcessor;

View File

@ -158,7 +158,7 @@ public class DemoEntityProcessor implements EntityProcessor, MediaEntityProcesso
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;

View File

@ -33,7 +33,7 @@
<javax.version>2.5</javax.version>
<odata.version>4.10.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version>
<project.source>1.6</project.source>
<project.source>17</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -99,7 +99,7 @@ public class DemoEntityProcessor implements EntityProcessor {
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoBatchProcessor;

View File

@ -147,7 +147,7 @@ public class DemoEntityProcessor implements EntityProcessor {
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;

View File

@ -147,7 +147,7 @@ public class DemoEntityProcessor implements EntityProcessor {
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;

View File

@ -21,10 +21,10 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import myservice.mynamespace.service.DemoEdmProvider;
import myservice.mynamespace.service.DemoEntityCollectionProcessor;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -99,7 +99,7 @@ public class DemoEntityProcessor implements EntityProcessor {
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;

View File

@ -234,7 +234,7 @@ public class DemoEntityProcessor implements EntityProcessor {
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoActionProcessor;

View File

@ -158,7 +158,7 @@ public class DemoEntityProcessor implements EntityProcessor {
* Example request:
*
* POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
* Header: Content-Type: application/json; odata.metadata=minimal
* Header: Content-Type: application/json;odata.metadata=minimal
* Request body:
{
"ID":3,

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;

View File

@ -21,11 +21,11 @@ package myservice.mynamespace.web;
import java.io.IOException;
import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import myservice.mynamespace.data.Storage;
import myservice.mynamespace.service.DemoEdmProvider;