-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved Device::getAbsoluteURL() to return the specified URL more co…
…rrectly. git-svn-id: https://svn.code.sf.net/p/cgupnpjava/code/trunk@179 8e852ebd-950f-0410-afcc-dbedaebff0b6
- Loading branch information
skonno
committed
Mar 14, 2012
1 parent
8d1d2b7
commit 0cd1285
Showing
5 changed files
with
322 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
2012-03-14 Satoshi Konno <[email protected]> | ||
* Improved Device::getAbsoluteURL() to return the specified URL more correctly. | ||
|
||
2011-02-08 Satoshi Konno <[email protected]> | ||
* Changed the trunk directory into 'trunk' instead of 'trunk/cyberlink' | ||
* Fixed some pom files to run normally. | ||
|
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
61 changes: 61 additions & 0 deletions
61
upnp-stack/src/test/java/org/cybergarage/http/HTTPTest.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,61 @@ | ||
/****************************************************************** | ||
* | ||
* CyberLink for Java | ||
* | ||
* Copyright (C) Satoshi Konno 2002-2012 | ||
* | ||
* This is licensed under BSD-style license, see file COPYING. | ||
* | ||
******************************************************************/ | ||
|
||
package org.cybergarage.http; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestCase; | ||
import junit.framework.TestSuite; | ||
|
||
public class HTTPTest extends TestCase | ||
{ | ||
/** | ||
* Create the test case | ||
* | ||
* @param testName name of the test case | ||
*/ | ||
public HTTPTest( String testName ) | ||
{ | ||
super( testName ); | ||
} | ||
|
||
/** | ||
* @return the suite of tests being tested | ||
*/ | ||
public static Test suite() | ||
{ | ||
return new TestSuite( HTTPTest.class ); | ||
} | ||
|
||
public void testToRelativeURL() | ||
{ | ||
String urlString; | ||
|
||
urlString = HTTP.toRelativeURL("/testURL"); | ||
assertTrue(urlString, urlString.equals("/testURL")); | ||
|
||
urlString = HTTP.toRelativeURL("testURL"); | ||
assertTrue(urlString, urlString.equals("/testURL")); | ||
} | ||
|
||
public void testGetAbsoluteURL() | ||
{ | ||
String urlString; | ||
|
||
urlString = HTTP.getAbsoluteURL("http://192.168.0.1:80/", "/testURL"); | ||
assertTrue(urlString, urlString.equals("http://192.168.0.1:80/testURL")); | ||
|
||
urlString = HTTP.getAbsoluteURL("http://192.168.0.1:80/", "testURL"); | ||
assertTrue(urlString, urlString.equals("http://192.168.0.1:80/testURL")); | ||
|
||
urlString = HTTP.getAbsoluteURL("http://192.168.0.1:80", "/testURL"); | ||
assertTrue(urlString, urlString.equals("http://192.168.0.1:80/testURL")); | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
upnp-stack/src/test/java/org/cybergarage/upnp/DeviceTest.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,136 @@ | ||
/****************************************************************** | ||
* | ||
* CyberLink for Java | ||
* | ||
* Copyright (C) Satoshi Konno 2002-2012 | ||
* | ||
* This is licensed under BSD-style license, see file COPYING. | ||
* | ||
******************************************************************/ | ||
|
||
package org.cybergarage.upnp; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestCase; | ||
import junit.framework.TestSuite; | ||
|
||
public class DeviceTest extends TestCase | ||
{ | ||
/** | ||
* Create the test case | ||
* | ||
* @param testName name of the test case | ||
*/ | ||
public DeviceTest( String testName ) | ||
{ | ||
super( testName ); | ||
} | ||
|
||
/** | ||
* @return the suite of tests being tested | ||
*/ | ||
public static Test suite() | ||
{ | ||
return new TestSuite( DeviceTest.class ); | ||
} | ||
|
||
/** | ||
* Rigourous Test :-) | ||
*/ | ||
public void testDeviceAbsoluteURL() | ||
{ | ||
Device dev = new Device(); | ||
String devAbsUrl; | ||
|
||
/******************************************************************************** | ||
* O:serviceURLStr ?:baseURLStr ?:locationURLStr | ||
********************************************************************************/ | ||
|
||
// O:serviceURLStr -:baseURLStr -:locationURLStr | ||
devAbsUrl = dev.getAbsoluteURL("http://192.168.0.1:80/serviceURL", null, null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.1:80/serviceURL")); | ||
|
||
/* O:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("http://192.168.0.1:80/serviceURL", "http://192.168.0.2:80/", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.1:80/serviceURL")); | ||
|
||
/* O:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("http://192.168.0.1:80/serviceURL", null, "http://192.168.0.3:80/"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.1:80/serviceURL")); | ||
|
||
/* O:serviceURLStr O:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("http://192.168.0.1:80/serviceURL", "http://192.168.0.2:80/", "http://192.168.0.3:80/"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.1:80/serviceURL")); | ||
|
||
/******************************************************************************** | ||
* X:serviceURLStr X:baseURLStr X:locationURLStr | ||
********************************************************************************/ | ||
|
||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", null, null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("/serviceURL")); | ||
|
||
/******************************************************************************** | ||
* X:serviceURLStr O:baseURLStr -:locationURLStr (CASE01) | ||
********************************************************************************/ | ||
|
||
/* X:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", "http://192.168.0.2:80/", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.2:80/serviceURL")); | ||
|
||
/* X:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("serviceURL", "http://192.168.0.2:80", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.2:80/serviceURL")); | ||
|
||
/* X:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("serviceURL", "http://192.168.0.2:80/", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.2:80/serviceURL")); | ||
|
||
/* X:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", "http://192.168.0.2:80", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.2:80/serviceURL")); | ||
|
||
/******************************************************************************** | ||
* X:serviceURLStr O:baseURLStr -:locationURLStr (CASE02) | ||
********************************************************************************/ | ||
|
||
/* X:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", "http://192.168.0.2:80/device/", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.2:80/device/serviceURL")); | ||
|
||
/* X:serviceURLStr O:baseURLStr -:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("serviceURL", "http://192.168.0.2:80/device/", null); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.2:80/device/serviceURL")); | ||
|
||
/******************************************************************************** | ||
* X:serviceURLStr -:baseURLStr O:locationURLStr (CASE01) | ||
********************************************************************************/ | ||
|
||
/* X:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", null, "http://192.168.0.3:80/"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.3:80/serviceURL")); | ||
|
||
/* X:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("serviceURL", null, "http://192.168.0.3:80"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.3:80/serviceURL")); | ||
|
||
/* X:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("serviceURL", null, "http://192.168.0.3:80/"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.3:80/serviceURL")); | ||
|
||
/* X:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", null, "http://192.168.0.3:80"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.3:80/serviceURL")); | ||
|
||
/******************************************************************************** | ||
* X:serviceURLStr -:baseURLStr O:locationURLStr (CASE02) | ||
********************************************************************************/ | ||
|
||
/* X:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("/serviceURL", null, "http://192.168.0.3:80/"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.3:80/serviceURL")); | ||
|
||
/* X:serviceURLStr -:baseURLStr O:locationURLStr */ | ||
devAbsUrl = dev.getAbsoluteURL("serviceURL", null, "http://192.168.0.3:80/device/"); | ||
assertTrue(devAbsUrl, devAbsUrl.equals("http://192.168.0.3:80/device/serviceURL")); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
upnp-stack/src/test/java/org/cybergarage/upnp/ServiceTest.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,40 @@ | ||
/****************************************************************** | ||
* | ||
* CyberLink for Java | ||
* | ||
* Copyright (C) Satoshi Konno 2002-2012 | ||
* | ||
* This is licensed under BSD-style license, see file COPYING. | ||
* | ||
******************************************************************/ | ||
|
||
package org.cybergarage.upnp; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestCase; | ||
import junit.framework.TestSuite; | ||
|
||
public class ServiceTest extends TestCase | ||
{ | ||
/** | ||
* Create the test case | ||
* | ||
* @param testName name of the test case | ||
*/ | ||
public ServiceTest( String testName ) | ||
{ | ||
super( testName ); | ||
} | ||
|
||
/** | ||
* @return the suite of tests being tested | ||
*/ | ||
public static Test suite() | ||
{ | ||
return new TestSuite( ServiceTest.class ); | ||
} | ||
|
||
public void testServiceAbsoluteURL() | ||
{ | ||
} | ||
} |