forked from slemesle/selma
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from Musikolo/feature#137-cdi-support
New Feature #137: Implement withIoC={CDI, CDI_SINGLETON} options
- Loading branch information
Showing
9 changed files
with
228 additions
and
67 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
31 changes: 31 additions & 0 deletions
31
processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomCdiMapperInMaps.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,31 @@ | ||
/*- | ||
* Copyright 2013 Xebia and Séven Le Mesle | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package fr.xebia.extras.selma.it.custom.mapper; | ||
|
||
import fr.xebia.extras.selma.IoC; | ||
import fr.xebia.extras.selma.Mapper; | ||
import fr.xebia.extras.selma.beans.Book; | ||
import fr.xebia.extras.selma.beans.BookDTO; | ||
|
||
@Mapper(withIoC = IoC.CDI) | ||
public interface CustomCdiMapperInMaps { | ||
|
||
public Book asBook(BookDTO source); | ||
|
||
public BookDTO asBookDto(Book source); | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
processor/src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomCdiMapperInMapsIT.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,37 @@ | ||
/*- | ||
* Copyright 2013 Xebia and Séven Le Mesle | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package fr.xebia.extras.selma.it.custom.mapper; | ||
|
||
import static org.hamcrest.CoreMatchers.notNullValue; | ||
import static org.junit.Assert.assertThat; | ||
|
||
import org.junit.Test; | ||
|
||
import fr.xebia.extras.selma.Selma; | ||
import fr.xebia.extras.selma.it.utils.Compile; | ||
import fr.xebia.extras.selma.it.utils.IntegrationTestBase; | ||
|
||
@Compile(withClasses = CustomCdiMapperInMaps.class) | ||
public class CustomCdiMapperInMapsIT extends IntegrationTestBase { | ||
|
||
@Test | ||
public void given_cdi_mapper_should_be_annotated_with_Inject() { | ||
|
||
final CustomCdiMapperInMaps mapper = Selma.getMapper(CustomCdiMapperInMaps.class); | ||
assertThat(mapper.getClass().getAnnotation(javax.inject.Named.class), notNullValue()); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
.../src/test/java/fr/xebia/extras/selma/it/custom/mapper/CustomCdiSingletonMapperInMaps.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,31 @@ | ||
/*- | ||
* Copyright 2013 Xebia and Séven Le Mesle | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package fr.xebia.extras.selma.it.custom.mapper; | ||
|
||
import fr.xebia.extras.selma.IoC; | ||
import fr.xebia.extras.selma.Mapper; | ||
import fr.xebia.extras.selma.beans.Book; | ||
import fr.xebia.extras.selma.beans.BookDTO; | ||
|
||
@Mapper(withIoC = IoC.CDI_SINGLETON) | ||
public interface CustomCdiSingletonMapperInMaps { | ||
|
||
public Book asBook(BookDTO source); | ||
|
||
public BookDTO asBookDto(Book source); | ||
|
||
} |
Oops, something went wrong.