-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CXF-7346: CDI Extension ignores producer methods and fields
- Loading branch information
Showing
27 changed files
with
1,193 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one | ||
~ or more contributor license agreements. See the NOTICE file | ||
~ distributed with this work for additional information | ||
~ 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 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.apache.cxf.systests</groupId> | ||
<artifactId>cxf-systests-cdi-owb</artifactId> | ||
<version>3.2.0-SNAPSHOT</version> | ||
<relativePath>../</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>cxf-systests-cdi-owb-producers</artifactId> | ||
<name>Apache CXF CDI Integration System Tests - OWB with producers</name> | ||
<description>Apache CXF CDI Integration System Tests - OpenWebBeans with producers</description> | ||
<url>http://cxf.apache.org</url> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.cxf</groupId> | ||
<artifactId>cxf-rt-rs-extension-providers</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.abdera</groupId> | ||
<artifactId>abdera-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.abdera</groupId> | ||
<artifactId>abdera-parser</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
56 changes: 56 additions & 0 deletions
56
...i-owb/cdi-producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreFeed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* 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 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.cxf.systest.jaxrs.cdi; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotNull; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
|
||
import org.apache.abdera.model.Feed; | ||
import org.apache.abdera.parser.stax.FOMEntry; | ||
import org.apache.abdera.parser.stax.FOMFeed; | ||
import org.apache.cxf.systests.cdi.base.Book; | ||
import org.apache.cxf.systests.cdi.base.BookStoreService; | ||
|
||
@Path("/bookstore/") | ||
public class BookStoreFeed { | ||
private final BookStoreService service; | ||
|
||
public BookStoreFeed(BookStoreService service) { | ||
this.service = service; | ||
} | ||
|
||
@GET | ||
@Path("/books/feed") | ||
@NotNull @Valid | ||
@Produces("application/atom+xml") | ||
public Feed getBooks() { | ||
final FOMFeed feed = new FOMFeed(); | ||
|
||
for (final Book book: service.all()) { | ||
final FOMEntry entry = new FOMEntry(); | ||
entry.addLink("/bookstore/books/" + book.getId()); | ||
feed.addEntry(entry); | ||
} | ||
|
||
return feed; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...cers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreProducerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* 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 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.cxf.systest.jaxrs.cdi; | ||
|
||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.ApplicationPath; | ||
import javax.ws.rs.core.Application; | ||
import javax.ws.rs.core.Feature; | ||
|
||
import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationFeature; | ||
import org.apache.cxf.jaxrs.validation.ValidationExceptionMapper; | ||
import org.apache.cxf.systests.cdi.base.BookStoreService; | ||
|
||
@ApplicationPath("/") | ||
public class BookStoreProducerApplication extends Application { | ||
@Produces protected BookStoreValidatingFeed bookStoreValidatingFeed = new BookStoreValidatingFeed(); | ||
@Inject private BookStoreService service; | ||
|
||
@Produces | ||
public ValidationExceptionMapper validationExceptionMapper() { | ||
return new ValidationExceptionMapper(); | ||
} | ||
|
||
@Produces | ||
public Feature sampleFeature() { | ||
return new SampleFeature(); | ||
} | ||
|
||
@Produces | ||
public BookStoreFeed bookStoreFeed() { | ||
return new BookStoreFeed(service); | ||
} | ||
|
||
@Produces | ||
public org.apache.cxf.feature.Feature validationFeature() { | ||
return new JAXRSBeanValidationFeature(); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreValidatingFeed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* 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 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.cxf.systest.jaxrs.cdi; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Size; | ||
import javax.ws.rs.FormParam; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.Context; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.core.UriInfo; | ||
|
||
@Path("/bookstore/") | ||
public class BookStoreValidatingFeed { | ||
@POST | ||
@Path("/books/feed") | ||
@Produces("application/atom+xml") | ||
public Response addBook(@Context final UriInfo uriInfo, | ||
@NotNull @Size(min = 1, max = 50) @FormParam("id") String id, | ||
@NotNull @FormParam("name") String name) { | ||
return Response.created(uriInfo.getRequestUriBuilder().path(id).build()).build(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...i-owb/cdi-producers-owb/src/test/java/org/apache/cxf/systest/jaxrs/cdi/SampleFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* 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 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.cxf.systest.jaxrs.cdi; | ||
|
||
import javax.ws.rs.core.Feature; | ||
import javax.ws.rs.core.FeatureContext; | ||
|
||
import org.apache.cxf.jaxrs.provider.atom.AtomFeedProvider; | ||
|
||
public class SampleFeature implements Feature { | ||
@Override | ||
public boolean configure(FeatureContext context) { | ||
context.register(AtomFeedProvider.class); | ||
return false; | ||
} | ||
} |
Oops, something went wrong.