-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/test/java/sirius/web/security/AnotherExampleHelper.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,52 @@ | ||
/* | ||
* Made with all the love in the world | ||
* by scireum in Remshalden, Germany | ||
* | ||
* Copyright by scireum GmbH | ||
* http://www.scireum.de - info@scireum.de | ||
*/ | ||
|
||
package sirius.web.security; | ||
|
||
import sirius.kernel.commons.Explain; | ||
import sirius.kernel.di.std.Register; | ||
import sirius.kernel.health.Exceptions; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class AnotherExampleHelper { | ||
|
||
@Register | ||
public static class AnotherExampleHelperFactory implements HelperFactory<AnotherExampleHelper> { | ||
|
||
@Nonnull | ||
@Override | ||
public Class<AnotherExampleHelper> getHelperType() { | ||
return AnotherExampleHelper.class; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getName() { | ||
return "example2"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
@SuppressWarnings("squid:S2925") | ||
@Explain("We need this delay here to test loading friend helpers.") | ||
public AnotherExampleHelper make(@Nonnull ScopeInfo scope) { | ||
try { | ||
Thread.sleep(100); | ||
} catch (InterruptedException e) { | ||
throw Exceptions.handle(e); | ||
} | ||
|
||
return new AnotherExampleHelper(); | ||
} | ||
} | ||
|
||
public String getTestValue() { | ||
return "test"; | ||
} | ||
} |
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,45 @@ | ||
/* | ||
* Made with all the love in the world | ||
* by scireum in Remshalden, Germany | ||
* | ||
* Copyright by scireum GmbH | ||
* http://www.scireum.de - info@scireum.de | ||
*/ | ||
|
||
package sirius.web.security; | ||
|
||
import sirius.kernel.di.std.Register; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class ExampleHelper { | ||
|
||
@Register | ||
public static class ExampleHelperFactory implements HelperFactory<ExampleHelper> { | ||
|
||
@Nonnull | ||
@Override | ||
public Class<ExampleHelper> getHelperType() { | ||
return ExampleHelper.class; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getName() { | ||
return "example1"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public ExampleHelper make(@Nonnull ScopeInfo scope) { | ||
return new ExampleHelper(); | ||
} | ||
} | ||
|
||
@Helper | ||
private AnotherExampleHelper anotherExampleHelper; | ||
|
||
public String getTestValue() { | ||
return anotherExampleHelper.getTestValue(); | ||
} | ||
} |
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