Ray, I owe you one.

Added to build.gradle:
testImplementation 
"org.apereo.cas:cas-server-core-authentication-api:${project.'cas.version'}"

Copied over following java files in their expected packages in 
src/test/java:
CoreAuthenticationTestUtils.java
SimpleTestUsernamePasswordAuthenticationHandler.java

I was able to mock the principle and get my junit test completed.

Let me know what your vice is and I'll do my best to send it over.

-psv











On Tuesday, September 28, 2021 at 12:32:58 PM UTC-5 Ray Bon wrote:

> Pablo,
>
> Sorry, I missed an important point.
> You will have to copy that file, CoreAuthenticationTestUtils, into your 
> project (src/test/java/...). And update it during upgrades.
>
> The test classes are not part of the jar files; just the files under 
> src/main/java/...
>
> When you build, if the included file has dependencies, you will get 
> errors. Just repeat the steps to find the missing file and package.
> The test classes that you might include should 'not' depend on too many 
> other test classes, just the main classes (hopefully). I have only 2. If 
> you find that you are copying in many test classes, then perhaps the 
> feature you are working on would be better suited to inclusion in the cas 
> project, https://fawnoos.com/2020/10/22/cas63x-codebase-feature-build/
>
> Ray 
>
> P.S. This is my list of library includes (some may not be needed)
>
>     testCompileOnly "org.apereo.cas:cas-server-core-webflow-api"
>     testCompileOnly "org.apereo.cas:cas-server-core-util-api"
>     testImplementation 
> "org.apereo.cas:cas-server-core-services-authentication"
>     testImplementation "org.apereo.cas:cas-server-core-authentication-api"
>     testImplementation "org.apereo.cas:cas-server-core-services"
>     testImplementation "org.apereo.cas:cas-server-core"
>     testImplementation "org.apereo.cas:cas-server-core-api"
>     testImplementation "org.apereo.cas:cas-server-support-person-directory"
>
> On Tue, 2021-09-28 at 09:17 -0700, Pablo Vidaurri wrote:
>
> Notice: This message was sent from outside the University of Victoria 
> email system. Please be cautious with links and sensitive information. 
>
> Maybe you were not implying that I clone the subproject and include it in 
> my overlay project. 
>
> My problem is that I include the following in my build.gradle:
> testImplementation 
> "org.apereo.cas:cas-server-core-authentication-api:${project.'cas.version'}"
>
> and in my test class I import:
> import org.apereo.cas.authentication.CoreAuthenticationTestUtils;
>
> I see the jar when I do a gradlew dependencies 
>
> But I get a compile error when building:
>    MyActionTest.java:27: error: cannot find symbol
>    import org.apereo.cas.authentication.CoreAuthenticationTestUtils;
>                                     ^
>      symbol:   class CoreAuthenticationTestUtils
>      location: package org.apereo.cas.authentication
>      1 error
>
>      > Task :compileTestJava FAILED
>
>
> -psv
>
>
> On Monday, September 27, 2021 at 6:02:27 PM UTC-5 Ray Bon wrote:
>
> Pablo,
>
> Clone the cas repo, https://github.com/apereo/cas
> Then search for that file
> $ find . -name CoreAuthenticationTestUtils.java
>
> ./core/cas-server-core-authentication-api/src/test/java/org/apereo/cas/authentication/CoreAuthenticationTestUtils.java
>
> Then
>
>     testImplementation "org.apereo.cas:cas-server-core-authentication-api"
>
> Ray
>
> On Mon, 2021-09-27 at 15:23 -0700, Pablo Vidaurri wrote:
>
> Notice: This message was sent from outside the University of Victoria 
> email system. Please be cautious with links and sensitive information. 
>
>
> I'm trying to test my custom webflow, for a few of the actions I have a 
> principle. How do I mock the principle? I've reviewed cas code and see the 
> use of  CoreAuthenticationTestUtil but for the life of me I cannot get the 
> dependency included in my project. 
>
> -- 
>
>
> Ray Bon
> Programmer Analyst
> Development Services, University Systems
> 2507218831 <(250)%20721-8831> | CLE 019 | [email protected]
>
> I acknowledge and respect the lək̓ʷəŋən peoples on whose traditional 
> territory the university stands, and the Songhees, Esquimalt and WSÁNEĆ 
> peoples whose historical relationships with the land continue to this day.  
>
> -- 
>
> Ray Bon
> Programmer Analyst
> Development Services, University Systems
> 2507218831 <(250)%20721-8831> | CLE 019 | [email protected]
>
> I acknowledge and respect the lək̓ʷəŋən peoples on whose traditional 
> territory the university stands, and the Songhees, Esquimalt and WSÁNEĆ 
> peoples whose historical relationships with the land continue to this day.
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/dcc160d9-5c66-433d-96d2-8d538ee0570bn%40apereo.org.

Reply via email to