tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1614742 - in /tomee/tomee/trunk/examples/bean-validation-design-by-contract/src: main/resources/ main/resources/META-INF/ main/resources/META-INF/beans.xml test/java/org/superbiz/designbycontract/OlympicGamesTest.java
Date Wed, 30 Jul 2014 19:05:28 GMT
Author: rmannibucau
Date: Wed Jul 30 19:05:28 2014
New Revision: 1614742

URL: http://svn.apache.org/r1614742
Log:
fixing bean-validation-design-by-contract example using new bean validation...ie configuring
nothing :)

Added:
    tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/
    tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/META-INF/
    tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/META-INF/beans.xml
Modified:
    tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/test/java/org/superbiz/designbycontract/OlympicGamesTest.java

Added: tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/META-INF/beans.xml?rev=1614742&view=auto
==============================================================================
--- tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/META-INF/beans.xml
(added)
+++ tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/main/resources/META-INF/beans.xml
Wed Jul 30 19:05:28 2014
@@ -0,0 +1,18 @@
+<?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.
+-->
+<beans />

Modified: tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/test/java/org/superbiz/designbycontract/OlympicGamesTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/test/java/org/superbiz/designbycontract/OlympicGamesTest.java?rev=1614742&r1=1614741&r2=1614742&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/test/java/org/superbiz/designbycontract/OlympicGamesTest.java
(original)
+++ tomee/tomee/trunk/examples/bean-validation-design-by-contract/src/test/java/org/superbiz/designbycontract/OlympicGamesTest.java
Wed Jul 30 19:05:28 2014
@@ -15,8 +15,6 @@ package org.superbiz.designbycontract;/*
  * limitations under the License.
  */
 
-import org.apache.openejb.BeanContext;
-import org.apache.openejb.bval.BeanValidationAppendixInterceptor;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -25,9 +23,7 @@ import org.junit.Test;
 import javax.ejb.EJB;
 import javax.ejb.EJBException;
 import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
 import javax.validation.ConstraintViolationException;
-import java.util.Properties;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -35,7 +31,7 @@ import static org.junit.Assert.fail;
 
 public class OlympicGamesTest {
 
-    private static Context context;
+    private static EJBContainer ejbContainer;
 
     @EJB
     private OlympicGamesManager gamesManager;
@@ -45,20 +41,18 @@ public class OlympicGamesTest {
 
     @BeforeClass
     public static void start() {
-        Properties properties = new Properties();
-        properties.setProperty(BeanContext.USER_INTERCEPTOR_KEY, BeanValidationAppendixInterceptor.class.getName());
-        context = EJBContainer.createEJBContainer(properties).getContext();
+        ejbContainer = EJBContainer.createEJBContainer();
     }
 
     @Before
     public void inject() throws Exception {
-        context.bind("inject", this);
+        ejbContainer.getContext().bind("inject", this);
     }
 
     @AfterClass
     public static void stop() throws Exception {
-        if (context != null) {
-            context.close();
+        if (ejbContainer != null) {
+            ejbContainer.close();
         }
     }
 
@@ -72,7 +66,7 @@ public class OlympicGamesTest {
         try {
             gamesManager.addSportMan("I lose", "EN");
             fail("no space should be in names");
-        } catch (EJBException wrappingException) {
+        } catch (final EJBException wrappingException) {
             assertTrue(wrappingException.getCause() instanceof ConstraintViolationException);
             ConstraintViolationException exception = ConstraintViolationException.class.cast(wrappingException.getCausedByException());
             assertEquals(1, exception.getConstraintViolations().size());
@@ -84,7 +78,7 @@ public class OlympicGamesTest {
         try {
             gamesManager.addSportMan("ILoseTwo", "TOO-LONG");
             fail("country should be between 2 and 4 characters");
-        } catch (EJBException wrappingException) {
+        } catch (final EJBException wrappingException) {
             assertTrue(wrappingException.getCause() instanceof ConstraintViolationException);
             ConstraintViolationException exception = ConstraintViolationException.class.cast(wrappingException.getCausedByException());
             assertEquals(1, exception.getConstraintViolations().size());
@@ -101,7 +95,7 @@ public class OlympicGamesTest {
         try {
             poleVaultingManager.points(119);
             fail("the jump is too short");
-        } catch (EJBException wrappingException) {
+        } catch (final EJBException wrappingException) {
             assertTrue(wrappingException.getCause() instanceof ConstraintViolationException);
             ConstraintViolationException exception = ConstraintViolationException.class.cast(wrappingException.getCausedByException());
             assertEquals(1, exception.getConstraintViolations().size());



Mime
View raw message