Created
May 31, 2009 12:30
-
-
Save virtix/120881 to your computer and use it in GitHub Desktop.
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
function getAFuckingLifeYouAsshatMonkeyShitHurler() { | |
var null = ''; | |
var methodProxy = javacast('null',chr(0)); | |
var args = {1='scum sucking asshat-wearing Neanderfuck'}; | |
var ctx = getPageContext().getFusionContext(); | |
ctx.parent._set('methodProxy', ctx.parent.createObject('java','coldfusion.runtime.java.JavaProxy').init( ctx.parent._autoscalarize( ctx.parent._get('plainOldComponent').echo )) ); | |
actual = methodProxy.invoke(null, null, ctx.parent, args); | |
debug(actual); | |
assertEquals( 'scum sucking asshat-wearing Neanderfuck' , actual ); | |
} |
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
function two_Totally_DumbAssWaysOfInvokingFunctionsUsingFusionContextAndCFCProxy(){ | |
var fusionCtx = getPageContext().getFusionContext(); | |
var stupidCfcPath = fusionCtx.parent.getDirectoryFromPath(fusionCtx.getPagePath()) & 'PlainOldStupidAssCFC.cfc'; | |
var cfcproxy = CreateObject("java", "coldfusion.cfc.CFCProxy").init(stupidCfcPath); | |
var args = ['dumb ass puke breath punk']; | |
var alias = cfcproxy.getMethod('echo'); | |
assertEquals( args[1] , alias('dumb ass puke breath punk') ); | |
assertEquals( args[1] , cfcproxy.invoke('echo', args) ); | |
} |
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
function wasteMoreTimeYouTurdSuckingMongralFromAnotherPlanet(){ | |
var args = ['Yow! Am I having fun yet?']; | |
var ctx = getPageContext().getFusionContext(); | |
var actual = ctx.parent._invoke( ctx.parent.createObject('component','PlainOldStupidAssCFC'), 'echo', args ); | |
debug(actual); | |
assertEquals( args[1] , actual ); | |
} |
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
function boneheadedTimeWasterWalkingAroundInCirclesLikeADoucheBag(){ | |
var actual = getPageContext().getFusionContext().parent.plainOldComponent.echo('Now this is a fucking waste of time'); | |
assertEquals('Now this is a fucking waste of time', actual); | |
} |
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
function loserJavaWeanieInvocationUsingCfJspPage(){ | |
var page = getPageContext().getPage(); | |
var actual = page.createObject('java','java.lang.String').init(chr(0)); | |
var args = ['hey, loser, you suck.']; | |
actual = createObject('java' ,'coldfusion.runtime.CfJspPage')._invokeUDF(page._get('plainOldComponent.echo'), 'echo', page, args); | |
debug(actual); | |
assertEquals( 'hey, loser, you suck.', actual ); | |
} |
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
function freakinIdioticInvocationUsingPageContextAndRequestScope(){ | |
var localFunc = 'localFunc'; | |
var page = getPageContext().getRequest().setAttribute( localFunc , plainOldComponent.echo ); | |
assertEquals('Hey, let''s hang out at BestBuy and give the computer staff shit.', request.localFunc('Hey, let''s hang out at BestBuy and give the computer staff shit.') ); | |
} |
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
function uselessUltraRedundantCallbacksForMorons(){ | |
var callBackFunc = whatever( plainOldComponent.echo ); | |
assertEquals('I LIKE spam.', callBackFunc('I LIKE spam.') ); | |
} |
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
<cfcomponent output="false" extends="mxunit.framework.TestCase"> | |
<cfscript> | |
function setUp(){ | |
plainOldComponent = createObject('component' ,'PlainOldStupidAssCFC'); | |
assertSame(plainOldComponent,plainOldComponent); | |
} | |
</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
<cffunction name="whatever" access="package"> | |
<cfargument name="func" /> | |
<cfset var localFunction = arguments.func /> | |
<cfreturn localFunction /> | |
</cffunction> |
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
<cfcomponent output="false" extends="mxunit.framework.TestCase"> | |
<cfscript> | |
function setUp(){ | |
plainOldComponent = createObject('component' ,'PlainOldStupidAssCFC'); | |
assertSame(plainOldComponent,plainOldComponent); | |
} | |
//#7 | |
function uselessUltraRedundantCallbacksForMorons(){ | |
var callBackFunc = whatever( plainOldComponent.echo ); | |
assertEquals('I LIKE spam.', callBackFunc('I LIKE spam.') ); | |
} | |
//#6 | |
function freakinIdioticInvocationUsingPageContextAndRequestScope(){ | |
var localFunc = 'localFunc'; | |
var page = getPageContext().getRequest().setAttribute( localFunc , plainOldComponent.echo ); | |
assertEquals('Hey, let''s hang out at BestBuy and give the computer staff shit.', request.localFunc('Hey, let''s hang out at BestBuy and give the computer staff shit.') ); | |
} | |
//#5 | |
function loserJavaWeanieInvocationUsingCfJspPage(){ | |
var page = getPageContext().getPage(); | |
var actual = page.createObject('java','java.lang.String').init(chr(0)); | |
var args = ['hey, loser, you suck.']; | |
actual = createObject('java' ,'coldfusion.runtime.CfJspPage')._invokeUDF(page._get('plainOldComponent.echo'), 'echo', page, args); | |
debug(actual); | |
assertEquals( 'hey, loser, you suck.', actual ); | |
} | |
//#4 | |
function boneheadedTimeWasterWalkingAroundInCirclesLikeADoucheBag(){ | |
var actual = getPageContext().getFusionContext().parent.plainOldComponent.echo('Now this is a fucking waste of time'); | |
assertEquals('Now this is a fucking waste of time', actual); | |
} | |
//#3 | |
function wasteMoreTimeYouTurdSuckingMongralFromAnotherPlanet(){ | |
var args = ['Yow! Am I having fun yet?']; | |
var ctx = getPageContext().getFusionContext(); | |
var actual = ctx.parent._invoke( ctx.parent.createObject('component','PlainOldStupidAssCFC'), 'echo', args ); | |
debug(actual); | |
assertEquals( args[1] , actual ); | |
} | |
//#2 | |
function two_Totally_DumbAssWaysOfInvokingFunctionsUsingFusionContextAndCFCProxy(){ | |
var fusionCtx = getPageContext().getFusionContext(); | |
var stupidCfcPath = fusionCtx.parent.getDirectoryFromPath(fusionCtx.getPagePath()) & 'PlainOldStupidAssCFC.cfc'; | |
var cfcproxy = CreateObject("java", "coldfusion.cfc.CFCProxy").init(stupidCfcPath); | |
var args = ['dumb ass puke breath punk']; | |
var alias = cfcproxy.getMethod('echo'); | |
assertEquals( args[1] , alias('dumb ass puke breath punk') ); | |
assertEquals( args[1] , cfcproxy.invoke('echo', args) ); | |
} | |
//#1 | |
function getAFuckingLifeYouAsshatMonkeyShitHurler() { | |
var null = ''; | |
var methodProxy = javacast('null',chr(0)); | |
var args = {1='scum sucking asshat-wearing Neanderfuck'}; | |
var ctx = getPageContext().getFusionContext(); | |
ctx.parent._set('methodProxy', ctx.parent.createObject('java','coldfusion.runtime.java.JavaProxy').init( ctx.parent._autoscalarize( ctx.parent._get('plainOldComponent').echo )) ); | |
actual = methodProxy.invoke(null, null, ctx.parent, args); | |
debug(actual); | |
assertEquals( 'scum sucking asshat-wearing Neanderfuck' , actual ); | |
} | |
</cfscript> | |
<!---~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
"Private" Utility Functions | |
The scope is package so they are visible via | |
introspection yet are not recognized as tests by | |
MXUnit. | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~---> | |
<cffunction name="whatever" access="package"> | |
<cfargument name="func" /> | |
<cfset var localFunction = arguments.func /> | |
<cfreturn localFunction /> | |
</cffunction> | |
</cfcomponent> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment