jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641136151


##########
components/camel-test/camel-test-blueprint-junit5/src/test/java/org/apache/camel/test/blueprint/ContextCreationTimeoutTest.java:
##########
@@ -0,0 +1,146 @@
+/*
+ * 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.camel.test.blueprint;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class ContextCreationTimeoutTest {
+    
+    @AfterEach
+    public void cleanup() {
+        
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);
+    }
+
+    @Test
+    public void testDefault() {
+        
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);

Review Comment:
   Done



##########
components/camel-test/camel-test-blueprint-junit5/src/test/java/org/apache/camel/test/blueprint/ContextCreationTimeoutTest.java:
##########
@@ -0,0 +1,146 @@
+/*
+ * 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.camel.test.blueprint;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class ContextCreationTimeoutTest {
+    
+    @AfterEach
+    public void cleanup() {
+        
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);
+    }
+
+    @Test
+    public void testDefault() {
+        
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);
+        CamelBlueprintTestSupport ts = new DefaultTestSupport();
+        assertNull(ts.getCamelContextCreationTimeout());
+    }
+
+    @Test
+    public void testSystemPropertyNormal() {
+        final Long someValue = 60000L;
+        System.setProperty(
+                CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+                someValue.toString());
+        CamelBlueprintTestSupport ts = new DefaultTestSupport();
+        assertEquals(someValue, ts.getCamelContextCreationTimeout());
+    }
+    
+    @Test
+    public void testSystemPropertyMaxVal() {
+        final Long someValue = Long.MAX_VALUE;
+        System.setProperty(
+                CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+                someValue.toString());
+        CamelBlueprintTestSupport ts = new DefaultTestSupport();
+        assertEquals(someValue, ts.getCamelContextCreationTimeout());
+    }
+    
+    @Test
+    public void testSystemPropertyZero() {
+        final Long zeroValue = 0L;
+        System.setProperty(
+                CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+                zeroValue.toString());
+        CamelBlueprintTestSupport ts = new DefaultTestSupport();
+        assertEquals(zeroValue, ts.getCamelContextCreationTimeout());
+    }
+
+    @Test
+    public void testSystemPropertyNegative() {
+        System.setProperty(
+                CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+                "-100");
+        CamelBlueprintTestSupport ts = new DefaultTestSupport();
+        try {
+            ts.getCamelContextCreationTimeout();
+            fail();
+        } catch (IllegalArgumentException e) {
+            assertNull(e.getCause());
+        }
+    }
+
+    @Test
+    public void testSystemPropertyWrongFormat() {
+        System.setProperty(
+                CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+                "NaN");
+        CamelBlueprintTestSupport ts = new DefaultTestSupport();
+        try {
+            ts.getCamelContextCreationTimeout();
+            fail();
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getCause() instanceof NumberFormatException);
+        }
+    }
+    
+    @Test
+    public void testOverrideNormal() {
+        final Long someValue = 60000L;
+        
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to