forked from atuttle/Taffy
-
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.
https://github.com/atuttle/Taffy/issues/239
Added the ability to specify a comma delimited list of URIs for taffy_uri, allowing you to specify multiple endpoint URIs to be served by the same resource . It will not recognize commas inside of regular expression brackets {}. Fixed an issue where status.skippedResources was being overwritten when hot-swapping. Added tests for the new alias', as well as reconfiguring the tests to keep testing the skippedResources properly. Added a test for conflicting URI errors.
- Loading branch information
Showing
8 changed files
with
199 additions
and
67 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<cfcomponent extends="taffy.core.resource" taffy:uri="/conflict/{URI}, /conflict/{URI}" hint="I have multiple uris"> | ||
|
||
<cffunction name="get"> | ||
<cfargument name="uri" type="string" default="0" /> | ||
<cfset local.res = {} /> | ||
<cfset local.res.uri = arguments.uri /> | ||
|
||
<cfreturn representationOf(local.res) /> | ||
</cffunction> | ||
|
||
</cfcomponent> |
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,21 @@ | ||
<cfcomponent extends="taffy.core.resource" taffy:uri="/echo_alias/{id}, /echo_alias" hint="I have multiple uris"> | ||
|
||
<cffunction name="get"> | ||
<cfargument name="id" default="0" /> | ||
<cfset local.res = {} /> | ||
<cfset local.res.id = arguments.id /> | ||
|
||
<cfreturn representationOf(local.res) /> | ||
</cffunction> | ||
|
||
<cffunction name="put"> | ||
<cfargument name="id" /> | ||
<cfreturn representationOf(arguments).withStatus(200) /> | ||
</cffunction> | ||
|
||
<cffunction name="post"> | ||
<cfargument name="id" /> | ||
<cfreturn representationOf(arguments).withStatus(200) /> | ||
</cffunction> | ||
|
||
</cfcomponent> |
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,26 @@ | ||
<cfcomponent extends="base"> | ||
|
||
<cffunction name="setup"> | ||
<cfset local.apiRootURL = getDirectoryFromPath(cgi.script_name) /> | ||
<cfset local.apiRootURL = listDeleteAt(local.apiRootURL,listLen(local.apiRootURL,'/'),'/') /> | ||
<cfhttp method="GET" url="http://#CGI.SERVER_NAME#:#CGI.SERVER_PORT##local.apiRootURL#/index.cfm?#application._taffy.settings.reloadkey#=#application._taffy.settings.reloadPassword#" /> | ||
</cffunction> | ||
|
||
<cfscript> | ||
function beforeTests(){ | ||
variables.taffy = createObject("component","taffy.tests.Application"); | ||
makePublic(variables.taffy, "getBeanFactory"); | ||
variables.factory = variables.taffy.getBeanFactory(); | ||
variables.factory.loadBeansFromPath( expandPath('/taffy/tests/resourcesConflict'), 'taffy.tests.resourcesConflict', expandPath('/taffy/tests/resourcesConflict'), true, variables.taffy); | ||
|
||
} | ||
|
||
function conflicting_URIs_get_skipped() { | ||
assertEquals(1, arrayLen(application._taffy.status.skippedResources), "Conflicting URIs not showing in errors"); | ||
var err = application._taffy.status.skippedResources[1]; | ||
assertEquals("taffy.resources.DuplicateUriPattern", local.err.Exception.ErrorCode); | ||
} | ||
</cfscript> | ||
|
||
|
||
</cfcomponent> |
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
Oops, something went wrong.