http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java b/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java index 8a94814..8a80684 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/AbstractMetadataElement.java @@ -6,9 +6,9 @@ * to you 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
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java index 5277f23..aa0ce6d 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java b/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java index f94a62f..9bda9db 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java index fefdea1..aab6143 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java b/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java index d35dfc0..15285d2 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/EntitySet.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java b/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java index 46d9c41..70b808c 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/EntityType.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java index e31d2cd..6482143 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java @@ -6,9 +6,9 @@ * to you 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 @@ -47,7 +47,6 @@ public class Metadata extends AbstractMetadataElement { */ protected static final Logger LOG = LoggerFactory.getLogger(Metadata.class); - private final Map<String, Schema> schemas; private final String DEF_NS; @@ -234,7 +233,7 @@ public class Metadata extends AbstractMetadataElement { if (event.isStartElement() && (event.asStartElement().getName().equals(new QName(DEF_NS, "EntitySet")) - || event.asStartElement().getName().equals(new QName(DEF_NS, "Singleton")))) { + || event.asStartElement().getName().equals(new QName(DEF_NS, "Singleton")))) { final EntitySet entitySet = getEntitySet(event.asStartElement(), reader); container.addEntitySet(entitySet.getName(), entitySet); } else if (event.isStartElement() @@ -365,31 +364,31 @@ public class Metadata extends AbstractMetadataElement { private EntitySet getEntitySet(final StartElement start, final XMLEventReader reader) throws XMLStreamException { final EntitySet entitySet = "Singleton".equals(start.getName().getLocalPart()) ? new EntitySet(start.getAttributeByName(new QName("Name")).getValue(), true) - : new EntitySet(start.getAttributeByName(new QName("Name")).getValue()); - - Attribute type = start.getAttributeByName(new QName("EntityType")); - if (type == null) { - type = start.getAttributeByName(new QName("Type")); - entitySet.setType(type == null ? null : type.getValue()); - } else { - entitySet.setType(type.getValue()); - } + : new EntitySet(start.getAttributeByName(new QName("Name")).getValue()); + + Attribute type = start.getAttributeByName(new QName("EntityType")); + if (type == null) { + type = start.getAttributeByName(new QName("Type")); + entitySet.setType(type == null ? null : type.getValue()); + } else { + entitySet.setType(type.getValue()); + } - boolean completed = false; + boolean completed = false; - while (!completed && reader.hasNext()) { - XMLEvent event = reader.nextEvent(); + while (!completed && reader.hasNext()) { + XMLEvent event = reader.nextEvent(); - if (event.isStartElement() - && event.asStartElement().getName().equals(new QName(DEF_NS, "NavigationPropertyBinding"))) { - final String path = event.asStartElement().getAttributeByName(new QName("Path")).getValue(); - final String target = event.asStartElement().getAttributeByName(new QName("Target")).getValue(); - entitySet.addBinding(path, target); - } else if (event.isEndElement() && event.asEndElement().getName().equals(start.getName())) { - completed = true; - } - } + if (event.isStartElement() + && event.asStartElement().getName().equals(new QName(DEF_NS, "NavigationPropertyBinding"))) { + final String path = event.asStartElement().getAttributeByName(new QName("Path")).getValue(); + final String target = event.asStartElement().getAttributeByName(new QName("Target")).getValue(); + entitySet.addBinding(path, target); + } else if (event.isEndElement() && event.asEndElement().getName().equals(start.getName())) { + completed = true; + } + } - return entitySet; + return entitySet; } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java index b506279..0e27dc1 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/Property.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Property.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Property.java index 5716fcb..1e5d383 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Property.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Property.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java index 7df5d38..9a23f40 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java b/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java index 95fd87f..8115826 100644 --- a/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java +++ b/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,15 +18,16 @@ */ package org.apache.olingo.fit.methods; -import javax.ws.rs.HttpMethod; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import javax.ws.rs.HttpMethod; + @Target({ ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @HttpMethod("MERGE") public @interface MERGE { - //No additional methods needed for now. + // No additional methods needed for now. } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/methods/PATCH.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/methods/PATCH.java b/fit/src/main/java/org/apache/olingo/fit/methods/PATCH.java index 9977e9a..eb3f5aa 100644 --- a/fit/src/main/java/org/apache/olingo/fit/methods/PATCH.java +++ b/fit/src/main/java/org/apache/olingo/fit/methods/PATCH.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,15 +18,16 @@ */ package org.apache.olingo.fit.methods; -import javax.ws.rs.HttpMethod; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import javax.ws.rs.HttpMethod; + @Target({ ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @HttpMethod("PATCH") public @interface PATCH { -//No additional methods needed for now. + // No additional methods needed for now. } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2Provider.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2Provider.java b/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2Provider.java index 7000650..0e3abf8 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2Provider.java +++ b/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2Provider.java @@ -1,23 +1,26 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.fit.rest; +import java.util.Collections; +import java.util.List; + import org.apache.cxf.rs.security.oauth2.common.AccessTokenRegistration; import org.apache.cxf.rs.security.oauth2.common.Client; import org.apache.cxf.rs.security.oauth2.common.OAuthPermission; @@ -29,9 +32,6 @@ import org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGran import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException; import org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken; -import java.util.Collections; -import java.util.List; - public class OAuth2Provider implements AuthorizationCodeDataProvider { public static final String CLIENT_ID = "odataOAuth2SVC"; @@ -57,8 +57,8 @@ public class OAuth2Provider implements AuthorizationCodeDataProvider { @Override public ServerAccessToken getPreauthorizedToken( - final Client client, final List<String> list, final UserSubject us, final String string) - throws OAuthServiceException { + final Client client, final List<String> list, final UserSubject us, final String string) + throws OAuthServiceException { return null; } @@ -70,24 +70,24 @@ public class OAuth2Provider implements AuthorizationCodeDataProvider { @Override public ServerAuthorizationCodeGrant createCodeGrant(final AuthorizationCodeRegistration acr) - throws OAuthServiceException { + throws OAuthServiceException { grant = new ServerAuthorizationCodeGrant(client, 3600L); grant.setRedirectUri(acr.getRedirectUri()); grant.setSubject(acr.getSubject()); final List<String> scope = acr.getApprovedScope().isEmpty() - ? acr.getRequestedScope() - : acr.getApprovedScope(); - grant.setApprovedScopes(scope); + ? acr.getRequestedScope() + : acr.getApprovedScope(); + grant.setApprovedScopes(scope); - return grant; + return grant; } @Override public ServerAuthorizationCodeGrant removeCodeGrant(final String code) throws OAuthServiceException { return grant == null || !grant.getCode().equals(code) - ? null - : grant; + ? null + : grant; } @Override @@ -95,13 +95,13 @@ public class OAuth2Provider implements AuthorizationCodeDataProvider { token = new BearerAccessToken(atr.getClient(), 3600L); final List<String> scope = atr.getApprovedScope().isEmpty() - ? atr.getRequestedScope() - : atr.getApprovedScope(); - token.setScopes(convertScopeToPermissions(atr.getClient(), scope)); - token.setSubject(atr.getSubject()); - token.setGrantType(atr.getGrantType()); + ? atr.getRequestedScope() + : atr.getApprovedScope(); + token.setScopes(convertScopeToPermissions(atr.getClient(), scope)); + token.setSubject(atr.getSubject()); + token.setGrantType(atr.getGrantType()); - return token; + return token; } @Override @@ -111,8 +111,8 @@ public class OAuth2Provider implements AuthorizationCodeDataProvider { @Override public ServerAccessToken refreshAccessToken( - final Client client, final String string, final List<String> list) - throws OAuthServiceException { + final Client client, final String string, final List<String> list) + throws OAuthServiceException { throw new UnsupportedOperationException("Not supported yet."); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2RequestFilter.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2RequestFilter.java b/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2RequestFilter.java index 9022374..17476dd 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2RequestFilter.java +++ b/fit/src/main/java/org/apache/olingo/fit/rest/OAuth2RequestFilter.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -21,6 +21,7 @@ package org.apache.olingo.fit.rest; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.ext.Provider; + import org.apache.commons.lang3.StringUtils; import org.apache.cxf.rs.security.oauth2.filters.OAuthRequestFilter; @@ -30,7 +31,7 @@ public class OAuth2RequestFilter extends OAuthRequestFilter implements Container @Override public void filter(final ContainerRequestContext context) { final String svcName = - StringUtils.substringBefore(StringUtils.substringAfter(context.getUriInfo().getPath(), "/"), "/"); + StringUtils.substringBefore(StringUtils.substringAfter(context.getUriInfo().getPath(), "/"), "/"); if ("OAuth2.svc".equals(svcName)) { super.filter(context); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rest/ResolvingReferencesInterceptor.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rest/ResolvingReferencesInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/rest/ResolvingReferencesInterceptor.java index 6b882b6..d9ecd0e 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rest/ResolvingReferencesInterceptor.java +++ b/fit/src/main/java/org/apache/olingo/fit/rest/ResolvingReferencesInterceptor.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,16 +18,16 @@ */ package org.apache.olingo.fit.rest; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLDecoder; + import org.apache.commons.lang3.StringUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLDecoder; - public class ResolvingReferencesInterceptor extends AbstractPhaseInterceptor<Message> { public ResolvingReferencesInterceptor() { @@ -41,7 +41,7 @@ public class ResolvingReferencesInterceptor extends AbstractPhaseInterceptor<Mes try { if (path.endsWith("$entity") && StringUtils.isNotBlank(query) - && URLDecoder.decode(query, "UTF-8").contains("$id=")) { + && URLDecoder.decode(query, "UTF-8").contains("$id=")) { final String id = URLDecoder.decode(query, "UTF-8"); final String newURL = id.substring(id.indexOf("$id=") + 4); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rest/ServiceNameResponseFilter.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rest/ServiceNameResponseFilter.java b/fit/src/main/java/org/apache/olingo/fit/rest/ServiceNameResponseFilter.java index 31828b8..9540c1e 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rest/ServiceNameResponseFilter.java +++ b/fit/src/main/java/org/apache/olingo/fit/rest/ServiceNameResponseFilter.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,32 +18,33 @@ */ package org.apache.olingo.fit.rest; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.fit.utils.Constants; +import java.io.ByteArrayInputStream; +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 java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.olingo.fit.utils.Constants; @Provider public class ServiceNameResponseFilter implements ContainerResponseFilter { @Override public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) - throws IOException { + throws IOException { final String svcName = - StringUtils.substringBefore(StringUtils.substringAfter(requestContext.getUriInfo().getPath(), "/"), "/"); + StringUtils.substringBefore(StringUtils.substringAfter(requestContext.getUriInfo().getPath(), "/"), "/"); if ("OAuth2.svc".equals(svcName) && responseContext.getEntity() != null) { final String content = IOUtils.toString((InputStream) responseContext.getEntity(), Constants.ENCODING). - replaceAll("Static\\.svc", svcName); + replaceAll("Static\\.svc", svcName); final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rest/StaticSecurityInterceptor.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rest/StaticSecurityInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/rest/StaticSecurityInterceptor.java index e9fef0c..453c086 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rest/StaticSecurityInterceptor.java +++ b/fit/src/main/java/org/apache/olingo/fit/rest/StaticSecurityInterceptor.java @@ -1,23 +1,31 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.fit.rest; +import java.security.Principal; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + import org.apache.cxf.common.security.SimplePrincipal; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; @@ -26,13 +34,6 @@ import org.apache.cxf.phase.Phase; import org.apache.cxf.security.SecurityContext; import org.apache.geronimo.mail.util.Base64; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import java.security.Principal; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - public class StaticSecurityInterceptor extends AbstractPhaseInterceptor<Message> { private static final String AUTHORIZATION_PROPERTY = "Authorization"; @@ -58,7 +59,7 @@ public class StaticSecurityInterceptor extends AbstractPhaseInterceptor<Message> final String encodedUserPassword = auth.get(0).replaceFirst(AUTHENTICATION_SCHEME + " ", ""); final String usernameAndPassword = new String(Base64.decode(encodedUserPassword)); - //Split username and password tokens + // Split username and password tokens final StringTokenizer tokenizer = new StringTokenizer(usernameAndPassword, ":"); final String username = tokenizer.nextToken(); final String password = tokenizer.nextToken(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rest/XHTTPMethodInterceptor.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rest/XHTTPMethodInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/rest/XHTTPMethodInterceptor.java index 63a6b48..73ecd36 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rest/XHTTPMethodInterceptor.java +++ b/fit/src/main/java/org/apache/olingo/fit/rest/XHTTPMethodInterceptor.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,6 +18,9 @@ */ package org.apache.olingo.fit.rest; +import java.util.List; +import java.util.Map; + import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; @@ -25,9 +28,6 @@ import org.apache.cxf.phase.Phase; import org.apache.olingo.fit.utils.ConstantKey; import org.apache.olingo.fit.utils.Constants; -import java.util.List; -import java.util.Map; - public class XHTTPMethodInterceptor extends AbstractPhaseInterceptor<Message> { public XHTTPMethodInterceptor() { @@ -41,7 +41,7 @@ public class XHTTPMethodInterceptor extends AbstractPhaseInterceptor<Message> { if (headers.containsKey(Constants.get(ConstantKey.XHTTP_HEADER_NAME))) { message.put(Message.HTTP_REQUEST_METHOD, - headers.get(Constants.get(ConstantKey.XHTTP_HEADER_NAME)).iterator().next()); + headers.get(Constants.get(ConstantKey.XHTTP_HEADER_NAME)).iterator().next()); } } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewrite.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewrite.java b/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewrite.java index effe31d..5840ae3 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewrite.java +++ b/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewrite.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,6 +18,8 @@ */ package org.apache.olingo.fit.rproxy; +import java.util.Properties; + import org.esigate.Driver; import org.esigate.DriverConfiguration; import org.esigate.events.Event; @@ -28,8 +30,6 @@ import org.esigate.events.impl.RenderEvent; import org.esigate.extension.Extension; import org.esigate.util.HttpRequestHelper; -import java.util.Properties; - public class LinkRewrite implements Extension, IEventListener { private DriverConfiguration config; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewriteRenderer.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewriteRenderer.java b/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewriteRenderer.java index 6e6d8b6..46b5a31 100644 --- a/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewriteRenderer.java +++ b/fit/src/main/java/org/apache/olingo/fit/rproxy/LinkRewriteRenderer.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,12 +18,12 @@ */ package org.apache.olingo.fit.rproxy; -import org.apache.http.HttpEntityEnclosingRequest; -import org.esigate.Renderer; - import java.io.IOException; import java.io.Writer; +import org.apache.http.HttpEntityEnclosingRequest; +import org.esigate.Renderer; + public class LinkRewriteRenderer implements Renderer { private static final char SLASH = '/'; @@ -45,7 +45,7 @@ public class LinkRewriteRenderer implements Renderer { final int lastCharPosition = src.length() - 1; return src.charAt(lastCharPosition) == SLASH ? src.substring(0, lastCharPosition) - : src; + : src; } @Override http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java b/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java index f667d93..8ad62fe 100644 --- a/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java +++ b/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java index 5574211..9fb15f5 100644 --- a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java +++ b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,21 +18,6 @@ ******************************************************************************/ package org.apache.olingo.fit.server; -import org.apache.catalina.Context; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleState; -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.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 java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -45,6 +30,21 @@ import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.SimpleFormatter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.LifecycleState; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Server for integration tests. */ @@ -53,11 +53,11 @@ public class TomcatTestServer { private final Tomcat tomcat; - private TomcatTestServer(Tomcat tomcat) { + private TomcatTestServer(final Tomcat tomcat) { this.tomcat = tomcat; } - public static void main(String[] params) { + public static void main(final String[] params) { try { LOG.trace("Start tomcat embedded server from main()"); TestServerBuilder server = TomcatTestServer.init(9180) @@ -90,7 +90,7 @@ public class TomcatTestServer { } } - public static int extractPortParam(String portParameter) { + public static int extractPortParam(final String portParameter) { String[] portParam = portParameter.split("="); if (portParam.length == 2) { try { @@ -107,13 +107,13 @@ public class TomcatTestServer { private final String uri; private final String resource; - public StaticContent(String uri, String resource) { + public StaticContent(final String uri, final String resource) { this.uri = uri; this.resource = resource; } @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) + protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { String result; @@ -133,7 +133,7 @@ public class TomcatTestServer { private static TestServerBuilder builder; - public static TestServerBuilder init(int port) { + public static TestServerBuilder init(final int port) { if (builder == null) { builder = new TestServerBuilder(port); } @@ -150,9 +150,9 @@ public class TomcatTestServer { private TomcatTestServer server; private Properties properties; - private TestServerBuilder(int fixedPort) { + private TestServerBuilder(final int fixedPort) { initializeProperties(); - //baseDir = new File(System.getProperty("java.io.tmpdir"), "tomcat-test"); + // baseDir = new File(System.getProperty("java.io.tmpdir"), "tomcat-test"); baseDir = getFileForDirProperty(TOMCAT_BASE_DIR); if (!baseDir.exists() && !baseDir.mkdirs()) { throw new RuntimeException("Unable to create temporary test directory at {" + baseDir.getAbsolutePath() + "}"); @@ -181,7 +181,7 @@ public class TomcatTestServer { } } - public void enableLogging(Level level) { + public void enableLogging(final Level level) { tomcat.setSilent(false); try { Handler fileHandler = new FileHandler(tomcat.getHost().getAppBase() + "/catalina.out", true); @@ -193,7 +193,7 @@ public class TomcatTestServer { } } - public void atPort(int port) { + public void atPort(final int port) { tomcat.setPort(port); } @@ -201,14 +201,14 @@ public class TomcatTestServer { return addWebApp(true); } - public TestServerBuilder addWebApp(boolean copy) throws IOException { + public TestServerBuilder addWebApp(final boolean copy) throws IOException { if (server != null) { return this; } File webAppProjectDir = getFileForDirProperty(PROJECT_WEB_APP_DIR); final File webAppDir; - if(copy) { + if (copy) { webAppDir = new File(baseDir, webAppProjectDir.getName()); FileUtils.deleteDirectory(webAppDir); if (!webAppDir.mkdirs()) { @@ -227,7 +227,7 @@ public class TomcatTestServer { return this; } - private File getFileForDirProperty(String propertyName) { + private File getFileForDirProperty(final String propertyName) { File targetFile = new File(properties.getProperty(propertyName)); if (targetFile.exists() && targetFile.isDirectory()) { return targetFile; @@ -243,7 +243,7 @@ public class TomcatTestServer { return new File(targetURL.getFile()); } - public TestServerBuilder addServlet(final Class<? extends HttpServlet> factoryClass, String path) + public TestServerBuilder addServlet(final Class<? extends HttpServlet> factoryClass, final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException { if (server != null) { return this; @@ -259,7 +259,7 @@ public class TomcatTestServer { return this; } - public TestServerBuilder addStaticContent(String uri, String resourceName) throws IOException { + public TestServerBuilder addStaticContent(final String uri, final String resourceName) throws IOException { File targetResourcesDir = getFileForDirProperty(PROJECT_RESOURCES_DIR); String resource = new File(targetResourcesDir, resourceName).getAbsolutePath(); LOG.info("Added static content from '{}' at uri '{}'.", resource, uri); @@ -267,12 +267,13 @@ public class TomcatTestServer { return addServlet(staticContent, String.valueOf(uri.hashCode()), uri); } - public TestServerBuilder addServlet(HttpServlet httpServlet, String path) throws IOException { + public TestServerBuilder addServlet(final HttpServlet httpServlet, final String path) throws IOException { String name = UUID.randomUUID().toString(); return addServlet(httpServlet, name, path); } - public TestServerBuilder addServlet(HttpServlet httpServlet, String name, String path) throws IOException { + public TestServerBuilder addServlet(final HttpServlet httpServlet, final String name, final String path) + throws IOException { if (server != null) { return this; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java index 6639f7f..7fa9201 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java @@ -6,9 +6,9 @@ * to you 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 @@ -122,7 +122,7 @@ public abstract class AbstractUtilities { */ protected abstract InputStream addLinks( final String entitySetName, final String entitykey, final InputStream is, final Set<String> links) - throws Exception; + throws Exception; /** * Retrieve all entity link names. @@ -155,7 +155,7 @@ public abstract class AbstractUtilities { */ protected abstract InputStream normalizeLinks( final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links) - throws Exception; + throws Exception; public InputStream saveSingleEntity( final String key, @@ -168,7 +168,7 @@ public abstract class AbstractUtilities { // ----------------------------------------- final String path = entitySetName + File.separatorChar + Commons.getEntityKey(key) + File.separatorChar - + Constants.get(ConstantKey.ENTITY); + + Constants.get(ConstantKey.ENTITY); // ----------------------------------------- // ----------------------------------------- @@ -354,7 +354,7 @@ public abstract class AbstractUtilities { final Map.Entry<String, List<String>> currents = extractLinkURIs(entitySetName, entityKey, linkName); uris.addAll(currents.getValue()); } catch (Exception ignore) { - //Expected exception + // Expected exception } } @@ -365,7 +365,7 @@ public abstract class AbstractUtilities { public void putLinksInMemory( final String basePath, final String entitySetName, final String linkName, final Collection<String> uris) - throws Exception { + throws Exception { fsManager.putInMemory( Commons.getLinksAsJSON(entitySetName, new SimpleEntry<String, Collection<String>>(linkName, uris)), @@ -533,7 +533,7 @@ public abstract class AbstractUtilities { throws ODataDeserializerException { return accept == Accept.ATOM || accept == Accept.XML ? atomDeserializer.toEntity(entity) - : jsonDeserializer.toEntity(entity); + : jsonDeserializer.toEntity(entity); } public Entity readEntity(final Accept accept, final InputStream entity) @@ -718,7 +718,7 @@ public abstract class AbstractUtilities { */ public LinkInfo readLinks( final String entitySetName, final String entityId, final String linkName, final Accept accept) - throws Exception { + throws Exception { final String basePath = getLinksBasePath(entitySetName, entityId); @@ -733,16 +733,16 @@ public abstract class AbstractUtilities { public InputStream putMediaInMemory( final String entitySetName, final String entityId, final InputStream value) - throws IOException { + throws IOException { return putMediaInMemory(entitySetName, entityId, null, value); } public InputStream putMediaInMemory( final String entitySetName, final String entityId, final String name, final InputStream value) - throws IOException { + throws IOException { final FileObject fo = fsManager.putInMemory(value, fsManager.getAbsolutePath( Commons.getEntityBasePath(entitySetName, entityId) - + (name == null ? Constants.get(ConstantKey.MEDIA_CONTENT_FILENAME) : name), null)); + + (name == null ? Constants.get(ConstantKey.MEDIA_CONTENT_FILENAME) : name), null)); return fo.getContent().getInputStream(); } @@ -774,7 +774,7 @@ public abstract class AbstractUtilities { final String entitySetName, final String entityId, final String linkName) - throws Exception { + throws Exception { // -------------------------------- // 0. Retrieve all 'linkName' navigation link uris (NotFoundException if missing) @@ -799,7 +799,7 @@ public abstract class AbstractUtilities { final String entityId, final InputStream entity, final String linkName) - throws Exception { + throws Exception { // -------------------------------- // 2. Retrieve expanded object (entry or feed) // -------------------------------- @@ -832,11 +832,11 @@ public abstract class AbstractUtilities { public abstract InputStream readEntities( final List<String> links, final String linkName, final String next, final boolean forceFeed) - throws Exception; + throws Exception; protected abstract InputStream replaceLink( final InputStream toBeChanged, final String linkName, final InputStream replacement) - throws Exception; + throws Exception; public abstract InputStream selectEntity(final InputStream entity, final String[] propertyNames) throws Exception; @@ -850,11 +850,11 @@ public abstract class AbstractUtilities { public abstract InputStream addOperation( final InputStream content, final String name, final String metaAnchor, final String href) - throws Exception; + throws Exception; protected abstract InputStream replaceProperty( final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue) - throws Exception; + throws Exception; protected abstract InputStream deleteProperty(final InputStream src, final List<String> path) throws Exception; @@ -864,5 +864,5 @@ public abstract class AbstractUtilities { public abstract Map.Entry<String, List<String>> extractLinkURIs( final String entitySetName, final String entityId, final String linkName) - throws Exception; + throws Exception; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java b/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java index 3bd86e3..5f9a724 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/Accept.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java index 7ebed0d..32644d9 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,23 +18,6 @@ */ package org.apache.olingo.fit.utils; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; -import org.apache.olingo.fit.metadata.Metadata; -import org.codehaus.plexus.util.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -51,6 +34,24 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; +import org.apache.olingo.fit.metadata.Metadata; +import org.codehaus.plexus.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; + public abstract class Commons { /** @@ -184,8 +185,8 @@ public abstract class Commons { } public static InputStream - getLinksAsJSON(final String entitySetName, final Map.Entry<String, Collection<String>> link) - throws IOException { + getLinksAsJSON(final String entitySetName, final Map.Entry<String, Collection<String>> link) + throws IOException { final ObjectNode links = new ObjectNode(JsonNodeFactory.instance); links.put( http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java b/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java index 9b9a20d..7315652 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java index b63c117..c2eaa7d 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java index 158807c..02dcadd 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,6 +18,18 @@ */ package org.apache.olingo.fit.utils; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.EnumMap; +import java.util.Map; + +import javax.ws.rs.NotFoundException; + import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; @@ -35,17 +47,6 @@ import org.apache.olingo.commons.core.serialization.JsonSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.NotFoundException; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.util.EnumMap; -import java.util.Map; - public class FSManager { /** http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/InjectableSerializerProvider.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/InjectableSerializerProvider.java b/fit/src/main/java/org/apache/olingo/fit/utils/InjectableSerializerProvider.java index a8587c5..02ada09 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/InjectableSerializerProvider.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/InjectableSerializerProvider.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java index 67931be..8be6b11 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/JSONUtilities.java @@ -6,9 +6,9 @@ * to you 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 @@ -60,8 +60,8 @@ public class JSONUtilities extends AbstractUtilities { mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(), mapper.getSerializationConfig(). - // withAttribute(ODataServiceVersion.class, version). - withAttribute(Boolean.class, Boolean.TRUE), + // withAttribute(ODataServiceVersion.class, version). + withAttribute(Boolean.class, Boolean.TRUE), mapper.getSerializerFactory())); } @@ -73,7 +73,7 @@ public class JSONUtilities extends AbstractUtilities { @Override protected InputStream addLinks( final String entitySetName, final String entitykey, final InputStream is, final Set<String> links) - throws IOException { + throws IOException { final ObjectNode srcNode = (ObjectNode) mapper.readTree(is); IOUtils.closeQuietly(is); @@ -153,7 +153,7 @@ public class JSONUtilities extends AbstractUtilities { @Override protected InputStream normalizeLinks( final String entitySetName, final String entityKey, final InputStream is, final NavigationLinks links) - throws IOException { + throws IOException { final ObjectNode srcNode = (ObjectNode) mapper.readTree(is); @@ -259,7 +259,7 @@ public class JSONUtilities extends AbstractUtilities { @Override public InputStream readEntities( final List<String> links, final String linkName, final String next, final boolean forceFeed) - throws IOException { + throws IOException { if (links.isEmpty()) { throw new NotFoundException(); @@ -307,7 +307,7 @@ public class JSONUtilities extends AbstractUtilities { @Override protected InputStream replaceLink( final InputStream toBeChanged, final String linkName, final InputStream replacement) - throws IOException { + throws IOException { final ObjectNode toBeChangedNode = (ObjectNode) mapper.readTree(toBeChanged); final ObjectNode replacementNode = (ObjectNode) mapper.readTree(replacement); @@ -403,7 +403,7 @@ public class JSONUtilities extends AbstractUtilities { @Override public InputStream replaceProperty( final InputStream src, final InputStream replacement, final List<String> path, final boolean justValue) - throws IOException { + throws IOException { final ObjectNode srcNode = (ObjectNode) mapper.readTree(src); IOUtils.closeQuietly(src); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/LinkInfo.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/LinkInfo.java b/fit/src/main/java/org/apache/olingo/fit/utils/LinkInfo.java index 1f8abf4..51340cb 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/LinkInfo.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/LinkInfo.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java b/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java index e83dd81..e79ce96 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,12 +18,13 @@ */ package org.apache.olingo.fit.utils; -import javax.ws.rs.NotFoundException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import javax.ws.rs.NotFoundException; + public class MetadataLinkInfo { private Map<String, EntitySet> entitySets = new HashMap<String, EntitySet>(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/NavigationLinks.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/NavigationLinks.java b/fit/src/main/java/org/apache/olingo/fit/utils/NavigationLinks.java index 38a4c2d..6bb915f 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/NavigationLinks.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/NavigationLinks.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,8 +18,6 @@ */ package org.apache.olingo.fit.utils; -import org.apache.commons.io.IOUtils; - import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; @@ -28,6 +26,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.io.IOUtils; + public class NavigationLinks { private final Map<String, List<InputStream>> inlines = new HashMap<String, List<InputStream>>(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/XMLElement.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XMLElement.java b/fit/src/main/java/org/apache/olingo/fit/utils/XMLElement.java index 84d4ba5..3dc1a90 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/XMLElement.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/XMLElement.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java b/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java index bacc6e7..14936fc 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/XMLEventReaderWrapper.java @@ -6,9 +6,9 @@ * to you 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 @@ -49,11 +49,11 @@ public class XMLEventReaderWrapper implements XMLEventReader { throws IOException, XMLStreamException { final StringBuilder startBuilder = new StringBuilder(); startBuilder.append("<").append(CONTENT). - append(" xmlns:m").append("=\"").append(Constants.get(ConstantKey.METADATA_NS)).append("\""). - append(" xmlns:d").append("=\"").append(Constants.get(ConstantKey.DATASERVICES_NS)).append("\""). - append(" xmlns:georss").append("=\"").append(Constants.get(ConstantKey.GEORSS_NS)).append("\""). - append(" xmlns:gml").append("=\"").append(Constants.get(ConstantKey.GML_NS)).append("\""). - append(">"); + append(" xmlns:m").append("=\"").append(Constants.get(ConstantKey.METADATA_NS)).append("\""). + append(" xmlns:d").append("=\"").append(Constants.get(ConstantKey.DATASERVICES_NS)).append("\""). + append(" xmlns:georss").append("=\"").append(Constants.get(ConstantKey.GEORSS_NS)).append("\""). + append(" xmlns:gml").append("=\"").append(Constants.get(ConstantKey.GML_NS)).append("\""). + append(">"); CONTENT_STAG = startBuilder.toString(); @@ -63,7 +63,7 @@ public class XMLEventReaderWrapper implements XMLEventReader { new ByteArrayInputStream((CONTENT_STAG + IOUtils.toString(stream, ENCODING).replaceAll("^<\\?xml.*\\?>", "") + XMLEventReaderWrapper.CONTENT_ETAG).getBytes(ENCODING)), - Constants.DECODER); + Constants.DECODER); wrapped = factory.createXMLEventReader(reader); @@ -79,7 +79,7 @@ public class XMLEventReaderWrapper implements XMLEventReader { } while (nextGivenEvent.isStartDocument() || (nextGivenEvent.isStartElement() - && CONTENT.equals(nextGivenEvent.asStartElement().getName().getLocalPart()))); + && CONTENT.equals(nextGivenEvent.asStartElement().getName().getLocalPart()))); } catch (Exception ignore) { // ignore @@ -148,6 +148,6 @@ public class XMLEventReaderWrapper implements XMLEventReader { // discard content end element tag ... return event != null && (!event.isEndElement() - || !CONTENT.equals(event.asEndElement().getName().getLocalPart())); + || !CONTENT.equals(event.asEndElement().getName().getLocalPart())); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java index 823592d..523aedd 100644 --- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java @@ -6,9 +6,9 @@ * to you 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 @@ -30,11 +30,11 @@ import javax.servlet.http.HttpServletResponse; import org.apache.catalina.LifecycleException; import org.apache.commons.io.IOUtils; import org.apache.olingo.client.api.ODataClient; -import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.client.api.domain.ClientEntity; import org.apache.olingo.client.api.domain.ClientProperty; import org.apache.olingo.client.api.domain.ClientValue; +import org.apache.olingo.commons.api.data.Entity; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; import org.apache.olingo.fit.server.TomcatTestServer; @@ -56,17 +56,17 @@ public abstract class AbstractBaseTestITCase { public static void init() throws LifecycleException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException { TomcatTestServer.init(9080) - .addServlet(TechnicalServlet.class, "/odata-server-tecsvc/odata.svc/*") - .addServlet(StaticContent.create("org-odata-core-v1.xml"), - "/odata-server-tecsvc/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml") + .addServlet(TechnicalServlet.class, "/odata-server-tecsvc/odata.svc/*") + .addServlet(StaticContent.create("org-odata-core-v1.xml"), + "/odata-server-tecsvc/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml") .addWebApp(false) .start(); } -// @AfterClass -// public static void cleanUp() throws LifecycleException { -// server.stop(); -// } + // @AfterClass + // public static void cleanUp() throws LifecycleException { + // server.stop(); + // } protected void debugEntity(final Entity entity, final String message) { if (LOG.isDebugEnabled()) { @@ -140,16 +140,17 @@ public abstract class AbstractBaseTestITCase { private static final long serialVersionUID = -6663569573355398997L; private final String resourceName; - public StaticContent(String resourceName) { + public StaticContent(final String resourceName) { this.resourceName = resourceName; } - public static HttpServlet create(String resourceName) { + public static HttpServlet create(final String resourceName) { return new StaticContent(resourceName); } @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, + IOException { resp.getOutputStream().write(IOUtils.toByteArray( Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName))); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/test/java/org/apache/olingo/fit/CXFOAuth2HttpClientFactory.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/CXFOAuth2HttpClientFactory.java b/fit/src/test/java/org/apache/olingo/fit/CXFOAuth2HttpClientFactory.java index 3a72508..59f351f 100644 --- a/fit/src/test/java/org/apache/olingo/fit/CXFOAuth2HttpClientFactory.java +++ b/fit/src/test/java/org/apache/olingo/fit/CXFOAuth2HttpClientFactory.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -56,7 +56,7 @@ 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); + new OAuthClientUtils.Consumer(OAuth2Provider.CLIENT_ID, OAuth2Provider.CLIENT_SECRET); private ClientAccessToken accessToken; @@ -70,7 +70,7 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory bean.setUsername("odatajclient"); bean.setPassword("odatajclient"); return bean.createWebClient(). - type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON_TYPE); + type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON_TYPE); } @Override @@ -81,11 +81,11 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory @Override protected void init() throws OAuth2Exception { final URI authURI = OAuthClientUtils.getAuthorizationURI( - oauth2GrantServiceURI.toASCIIString(), - OAuth2Provider.CLIENT_ID, - OAuth2Provider.REDIRECT_URI, - null, - null); + oauth2GrantServiceURI.toASCIIString(), + OAuth2Provider.CLIENT_ID, + OAuth2Provider.REDIRECT_URI, + null, + null); // Disable automatic redirects handling final HttpParams params = new BasicHttpParams(); @@ -116,11 +116,11 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory try { // 3. Submit the HTTP form for allowing access to the application final URI location = new URIBuilder(oAuthAuthorizationData.get("replyTo").asText()). - addParameter("session_authenticity_token", oAuthAuthorizationData.get("authenticityToken").asText()). - addParameter("client_id", oAuthAuthorizationData.get("clientId").asText()). - addParameter("redirect_uri", oAuthAuthorizationData.get("redirectUri").asText()). - addParameter("oauthDecision", "allow"). - build(); + addParameter("session_authenticity_token", oAuthAuthorizationData.get("authenticityToken").asText()). + addParameter("client_id", oAuthAuthorizationData.get("clientId").asText()). + addParameter("redirect_uri", oAuthAuthorizationData.get("redirectUri").asText()). + addParameter("oauthDecision", "allow"). + build(); final HttpGet method = new HttpGet(location); method.addHeader("Authorization", "Basic " + Base64.encodeBase64String("odatajclient:odatajclient".getBytes())); method.addHeader("Cookie", authenticityCookie); @@ -143,7 +143,7 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory // 5. Obtain the access token try { accessToken = OAuthClientUtils.getAccessToken( - getAccessTokenService(), OAUTH2_CONSUMER, new AuthorizationCodeGrant(code)); + getAccessTokenService(), OAUTH2_CONSUMER, new AuthorizationCodeGrant(code)); } catch (OAuthServiceException e) { throw new OAuth2Exception(e); } @@ -175,7 +175,7 @@ public class CXFOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory // refresh the token try { accessToken = OAuthClientUtils.getAccessToken( - getAccessTokenService(), OAUTH2_CONSUMER, new RefreshTokenGrant(refreshToken)); + getAccessTokenService(), OAUTH2_CONSUMER, new RefreshTokenGrant(refreshToken)); } catch (OAuthServiceException e) { throw new OAuth2Exception(e); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java index 3c5cc3c..260d35b 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java @@ -6,9 +6,9 @@ * to you 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 @@ -32,7 +32,7 @@ import java.sql.Timestamp; import java.util.Calendar; import java.util.TimeZone; -//CHECKSTYLE:OFF (Maven checkstyle) +// CHECKSTYLE:OFF (Maven checkstyle) import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.olingo.client.api.EdmEnabledODataClient; @@ -62,7 +62,7 @@ import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.service import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollectionComposableInvoker; -//CHECKSTYLE:ON (Maven checkstyle) +// CHECKSTYLE:ON (Maven checkstyle) import org.junit.Test; public class APIBasicDesignTestITCase extends AbstractTestITCase { @@ -110,7 +110,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase { * See OData Spec 11.4.6.3 * Alternatively, a relationship MAY be updated as part of an update to the source entity by including * the required binding information for the new target entity. - * + * * => use PATCH instead of PUT */ final Person person1 = container.getPeople().getByKey(1).load(); @@ -515,10 +515,10 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase { // Complex/Entity collection (available filter, select, expand, orderBy, skip and top) invoker1.operations().discount(10). // discount is an operation of ProductCollecton - filter("Name eq XXXX"). - select("Name", "ProductDetail"). - expand("ProductDetail"). - orderBy("Name").skip(3).top(5).execute(); + filter("Name eq XXXX"). + select("Name", "ProductDetail"). + expand("ProductDetail"). + orderBy("Name").skip(3).top(5).execute(); // Complex/Entity final PersonComposableInvoker invoker2 = container.operations().getPerson2("London"); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java index 8984bd9..7ef9511 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -87,7 +87,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected void createPatchAndDeleteOrder( - final InMemoryEntities container, final AbstractService<EdmEnabledODataClient> service) { + final InMemoryEntities container, final AbstractService<EdmEnabledODataClient> service) { // Create order .... final Order order = container.newEntityInstance(Order.class); @@ -138,7 +138,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { container.getOrders().getByKey(105).load(); fail(); } catch (IllegalArgumentException e) { - //Expected Exception + // Expected Exception } }
