[jboss-jira] [JBoss JIRA] Commented: (JBAS-4286) users.properties file not being correctly located in CustomSecurityManagerTestCase
Richard Achmatowicz (JIRA)
jira-events at lists.jboss.org
Thu Apr 19 18:58:30 EDT 2007
[ http://jira.jboss.com/jira/browse/JBAS-4286?page=comments#action_12359997 ]
Richard Achmatowicz commented on JBAS-4286:
-------------------------------------------
This turned out to be a curious one, due to differences in line termination in UNIX and DOS. In the multi-line replace command
<replace>
<replacetoken></replacetoken>
<replacevalue></replacevalue>
</replace>
everything between <replacetoken> and </replacetoken> is treated as the token to be searched for. So, this token:
<replacetoken>ABCDE</replacetoken>
is very different from this token:
<replacetoken>ABCDE
</replacetoken>
If created on a UNIX machine, the second includes an additional CR (x00D) character.
I created a small text file on UNIX containing
--------------------------------
ABCDE
---------------------------------
(where the second line was obrained by pressing enter and so inserting a CR) and ran the replace command against it.
It identified the token and performed the replacement. I copied the same files to Windows and ran the same replace command, and the replace failed. I edited the small text file, and 'recreated' the end of line termination, and the replace now succeeeded.
In the test case for this JIRA issue, exactly the same thing happened: which is why the replacement worked on UNIX
but failed on Windows.
In the end, I changed the code simply moved the </replacetoken> and <replacevalue> tags so that there was no intervening
line termination:
<replace file="${jboss.dist}/server/jacc-security-external/deploy/jboss-web.deployer/server.xml">
<replacetoken><![CDATA[className="org.jboss.web.tomcat.security.JaccAuthorizationRealm"]]>
</replacetoken>
<replacevalue>
<![CDATA[className="org.jboss.web.tomcat.security.JaccAuthorizationRealm" unprotectedResourceDelegation="true" securityConstraintProviderClass="org.jboss.test.security.test.CustomSecurityConstraintProvider" ]]>
</replacevalue>
was replaced by
<replace file="${jboss.dist}/server/jacc-security-external/deploy/jboss-web.deployer/server.xml">
<replacetoken><![CDATA[className="org.jboss.web.tomcat.security.JaccAuthorizationRealm"]]></replacetoken>
<replacevalue><![CDATA[className="org.jboss.web.tomcat.security.JaccAuthorizationRealm" unprotectedResourceDelegation="true" securityConstraintProviderClass="org.jboss.test.security.test.CustomSecurityConstraintProvider" ]]></replacevalue>
</replace>
I did this for all targets for which this was a problem:
tests-jacc-security-external
tests-jacc-security-allstarrole
tests-custom-securitymgr
I also removed the unnecessary <waitfor> stuff.
Tested the changes on RHEL and Windows.
> users.properties file not being correctly located in CustomSecurityManagerTestCase
> ----------------------------------------------------------------------------------
>
> Key: JBAS-4286
> URL: http://jira.jboss.com/jira/browse/JBAS-4286
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Security
> Affects Versions: JBossAS-4.2.0.CR1
> Environment: Windows 2003, x86_64, x86, BEA JVM
> Reporter: Richard Achmatowicz
> Assigned To: Anil Saldhana
> Fix For: JBossAS-4.2.0.GA
>
> Attachments: output.log, server.log
>
>
> The following tests are failing due to a common error:
> testGetCallerPrinciple, testStatefulCreateCaller, testMethodAccess, testDomainMethodAccess
> testMethodAccess2, testLocalMethodAccess, testUncheckedRemote, testRemoteUnchecked, testUnchecked
> testUncheckedWithLogin, testExcluded, testRunAs, testDeepRunAs
> and others
> The common error is:
> Suite: org.jboss.test.security.test.CustomSecurityManagerTestCase(custom-secmgr)
> Test: testDomainMethodAccess
> Type: error
> Exception: java.rmi.AccessException
> Message: SecurityException; nested exception is: javax.security.auth.login.LoginException: Missing users.properties file.
> ---------------------------------
> The test case CunstomSecurityManagerTestCase is a subclass of the test case EJBSpecUnitTestCase.
> EJBSpecUnitTestCase deploys the jar security-spec.jar which contains users.properties and roles.properties files, but these seem not to be located.
> From the output.log, it seems that the security-spec.jar is not being deployed before the custom-secmgrtests.ear. I have attached the log.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list