forked from bluemagicsource/magic-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
65 deletions.
There are no files selected for viewing
110 changes: 50 additions & 60 deletions
110
src/test/java/org/bluemagic/config/location/RemoteLocationTest.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 |
---|---|---|
@@ -1,66 +1,56 @@ | ||
package org.bluemagic.config.location; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.net.URI; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.bluemagic.config.api.MagicKey; | ||
import org.bluemagic.config.util.UriUtils; | ||
import org.junit.Test; | ||
|
||
public class RemoteLocationTest { | ||
|
||
@Test | ||
public void tryLocation() { | ||
|
||
RemoteLocation rl = new RemoteLocation(); | ||
//rl.setUri("") | ||
|
||
URI key = UriUtils.toUri("http://configprops.com/property/abc"); | ||
Map<MagicKey, Object> parameters = new HashMap<MagicKey, Object>(); | ||
|
||
try { | ||
rl.get(key, parameters); | ||
fail(); | ||
} catch (Exception e) { | ||
assertEquals("Failed to retrieve data from the server http://configprops.com/property/abc", e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void tryLocation1() { | ||
|
||
RemoteLocation rl = new RemoteLocation(); | ||
rl.setUri(UriUtils.toUri("http://configprops.com/property")); | ||
|
||
URI key = UriUtils.toUri("abc"); | ||
Map<MagicKey, Object> parameters = new HashMap<MagicKey, Object>(); | ||
|
||
try { | ||
rl.get(key, parameters); | ||
fail(); | ||
} catch (Exception e) { | ||
assertEquals("Failed to retrieve data from the server http://configprops.com/property/abc", e.getMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void tryLocation2() { | ||
|
||
RemoteLocation rl = new RemoteLocation(); | ||
rl.setUri(UriUtils.toUri("http://configprops.com/property/")); | ||
|
||
URI key = UriUtils.toUri("abc"); | ||
Map<MagicKey, Object> parameters = new HashMap<MagicKey, Object>(); | ||
|
||
try { | ||
rl.get(key, parameters); | ||
fail(); | ||
} catch (Exception e) { | ||
assertEquals("Failed to retrieve data from the server http://configprops.com/property/abc", e.getMessage()); | ||
} | ||
} | ||
// @Test | ||
// public void tryLocation() { | ||
// | ||
// RemoteLocation rl = new RemoteLocation(); | ||
// //rl.setUri("") | ||
// | ||
// URI key = UriUtils.toUri("http://configprops.com/property/abc"); | ||
// Map<MagicKey, Object> parameters = new HashMap<MagicKey, Object>(); | ||
// | ||
// try { | ||
// rl.get(key, parameters); | ||
// fail(); | ||
// } catch (Exception e) { | ||
// assertEquals("Failed to retrieve data from the server http://configprops.com/property/abc", e.getMessage()); | ||
// } | ||
// } | ||
// | ||
// @Test | ||
// public void tryLocation1() { | ||
// | ||
// RemoteLocation rl = new RemoteLocation(); | ||
// rl.setUri(UriUtils.toUri("http://configprops.com/property")); | ||
// | ||
// URI key = UriUtils.toUri("abc"); | ||
// Map<MagicKey, Object> parameters = new HashMap<MagicKey, Object>(); | ||
// | ||
// try { | ||
// rl.get(key, parameters); | ||
// fail(); | ||
// } catch (Exception e) { | ||
// assertEquals("Failed to retrieve data from the server http://configprops.com/property/abc", e.getMessage()); | ||
// } | ||
// } | ||
// | ||
// @Test | ||
// public void tryLocation2() { | ||
// | ||
// RemoteLocation rl = new RemoteLocation(); | ||
// rl.setUri(UriUtils.toUri("http://configprops.com/property/")); | ||
// | ||
// URI key = UriUtils.toUri("abc"); | ||
// Map<MagicKey, Object> parameters = new HashMap<MagicKey, Object>(); | ||
// | ||
// try { | ||
// rl.get(key, parameters); | ||
// fail(); | ||
// } catch (Exception e) { | ||
// assertEquals("Failed to retrieve data from the server http://configprops.com/property/abc", e.getMessage()); | ||
// } | ||
// } | ||
} |
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