-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 27799 dot cli do not require the dot service yml (#28389)
* #27799 Adding support for a dotCMS URL and bypass the yml file configuration * #27799 Adding support for a dotCMS URL and bypass the yml file configuration * #27799 Adding support for a dotCMS URL and bypass the yml file configuration * #27799 Fixing IT * #27799 Applying sonarlint feedback * #27799 Renaming test class * #27799 Handling nulls * #27799 Improving cleanup in IT * #27799 Implemented Resetable interface in API models Added a new Resetable interface and implemented it in the AuthenticationParam and RemoteURLParam classes. This implementation standardized the way objects reset to their original state across the API models. As a result, removed the reset method from these classes as it's now inherited from the Resetable interface.
- Loading branch information
1 parent
318564e
commit 1e05f0e
Showing
37 changed files
with
529 additions
and
61 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/Resetable.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,13 @@ | ||
package com.dotcms.api; | ||
|
||
/** | ||
* The Resetable interface represents an object that can be reset to its original state. | ||
*/ | ||
public interface Resetable { | ||
|
||
/** | ||
* Resets the object to its original state. | ||
*/ | ||
void reset(); | ||
|
||
} |
8 changes: 5 additions & 3 deletions
8
...cms-cli/api-data-model/src/main/java/com/dotcms/api/client/model/AuthenticationParam.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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
package com.dotcms.api.client.model; | ||
|
||
import com.dotcms.api.Resetable; | ||
import java.util.Optional; | ||
|
||
|
||
/*** | ||
* This interface is used to pass the token from the CLI to the API client. | ||
* If the token is present here we use directly instead of trying to load it from the service manager. | ||
*/ | ||
public interface AuthenticationParam { | ||
void setToken(char[] token); | ||
public interface AuthenticationParam extends Resetable { | ||
|
||
Optional<char[] > getToken(); | ||
void setToken(char[] token); | ||
|
||
Optional<char[]> getToken(); | ||
|
||
} |
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
17 changes: 17 additions & 0 deletions
17
...s/dotcms-cli/api-data-model/src/main/java/com/dotcms/api/client/model/RemoteURLParam.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,17 @@ | ||
package com.dotcms.api.client.model; | ||
|
||
import com.dotcms.api.Resetable; | ||
import java.net.URL; | ||
import java.util.Optional; | ||
|
||
/** | ||
* The RemoteURLParam interface is used in the {@link com.dotcms.cli.common.AuthenticationMixin} to | ||
* set and get the dotCMS URL parameter. It provides methods to set and retrieve the URL. | ||
*/ | ||
public interface RemoteURLParam extends Resetable { | ||
|
||
void setURL(URL remoteURL); | ||
|
||
Optional<URL> getURL(); | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...i/api-data-model/src/main/java/com/dotcms/api/client/model/RemoteURLParamContextImpl.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,36 @@ | ||
package com.dotcms.api.client.model; | ||
|
||
import io.quarkus.arc.DefaultBean; | ||
import java.net.URL; | ||
import java.util.Optional; | ||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
/** | ||
* This class is used to pass the token from the CLI to the API client. If the token is present here | ||
* we use directly | ||
*/ | ||
@DefaultBean | ||
@ApplicationScoped | ||
public class RemoteURLParamContextImpl implements RemoteURLParam { | ||
|
||
URL remoteURL; | ||
|
||
@Override | ||
public void setURL(final URL remoteURL) { | ||
this.remoteURL = remoteURL; | ||
} | ||
|
||
@Override | ||
public Optional<URL> getURL() { | ||
if (null == remoteURL) { | ||
return Optional.empty(); | ||
} | ||
return Optional.of(remoteURL); | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
remoteURL = null; | ||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.