-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
noProxy
setting with wildcard char support
Signed-off-by: aboyko <[email protected]>
- Loading branch information
Showing
3 changed files
with
106 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
51 changes: 51 additions & 0 deletions
51
...server/src/test/java/org/springframework/ide/vscode/boot/app/RestTemplateFactoryTest.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,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Broadcom, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Broadcom, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springframework.ide.vscode.boot.app; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.ide.vscode.boot.app.RestTemplateFactory.HostExclusions; | ||
|
||
public class RestTemplateFactoryTest { | ||
|
||
@Test | ||
void testHostExclusionSet() { | ||
HostExclusions exclusions = new RestTemplateFactory.HostExclusions(List.of("my-host", "foo-*", "*.bar")); | ||
assertEquals(exclusions.hosts(), Set.of("my-host")); | ||
assertEquals(exclusions.regexs().stream().map(r -> r.pattern()).collect(Collectors.toList()), List.of("foo-.*", ".*\\.bar")); | ||
|
||
assertTrue(exclusions.contains("my-host")); | ||
assertFalse(exclusions.contains("my_host")); | ||
|
||
assertTrue(exclusions.contains("foo-bar")); | ||
assertTrue(exclusions.contains("foo-bar-baz")); | ||
assertFalse(exclusions.contains("bar-foo")); | ||
|
||
assertTrue(exclusions.contains("foo.bar")); | ||
assertTrue(exclusions.contains(".bar")); | ||
assertFalse(exclusions.contains("foo.bar.baz")); | ||
assertFalse(exclusions.contains("bar.foo")); | ||
|
||
exclusions = new RestTemplateFactory.HostExclusions(List.of("*")); | ||
assertTrue(exclusions.contains("my_host")); | ||
assertTrue(exclusions.contains("foo.bar.baz")); | ||
assertTrue(exclusions.contains("bar.foo")); | ||
|
||
} | ||
|
||
} |