Skip to content

Commit

Permalink
refactor: rename sap login wizard pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nickchecan committed Jan 16, 2025
1 parent 5f9e5a5 commit 75ee5bf
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class LoginOptionsWizardDialog extends WizardDialog {

public LoginOptionsWizardDialog(Shell parentShell, LoginWizard wizard) {
public LoginOptionsWizardDialog(final Shell parentShell, final LoginWizard wizard) {
super(parentShell, wizard);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryDeployment;
import com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryResourceGroup;
import com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryServiceKey;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondSapLoginWizardPage;

/**
* A wizard for logging into SAP AI Core.
Expand Down Expand Up @@ -51,14 +51,14 @@ public SapLoginWizard(final Browser browser) {
* <p>
* This method initializes:
* <ul>
* <li>The {@link FirstLoginWizardPage} for entering credentials.</li>
* <li>The {@link SecondLoginWizardPage} for selecting resources and configurations.</li>
* <li>The {@link FirstSapLoginWizardPage} for entering credentials.</li>
* <li>The {@link SecondSapLoginWizardPage} for selecting resources and configurations.</li>
* </ul>
*/
@Override
public void addPages() {
addPage(new FirstLoginWizardPage(sapLoginClient));
addPage(new SecondLoginWizardPage(sapLoginClient, TemporaryMemoryResourceGroup.getInstance(), TemporaryMemoryDeployment.getInstance()));
addPage(new FirstSapLoginWizardPage(sapLoginClient));
addPage(new SecondSapLoginWizardPage(sapLoginClient, TemporaryMemoryResourceGroup.getInstance(), TemporaryMemoryDeployment.getInstance()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import com.developer.nefarious.zjoule.plugin.login.pages.SecondLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.memory.IMemoryObject;
import com.developer.nefarious.zjoule.plugin.models.Deployment;

Expand All @@ -18,20 +18,20 @@
public class DeploymentSelectionAdapter extends SelectionAdapter {

/** The second login wizard page associated with this adapter. */
private SecondLoginWizardPage secondLoginWizardPage;
private SecondSapLoginWizardPage secondLoginWizardPage;

/** The memory manager for storing the selected deployment. */
private IMemoryObject<Deployment> memoryDeployment;

/**
* Constructs a new {@code DeploymentSelectionAdapter}.
*
* @param secondLoginWizardPage the {@link SecondLoginWizardPage} containing the deployment dropdown.
* @param secondLoginWizardPage the {@link SecondSapLoginWizardPage} containing the deployment dropdown.
* @param memoryDeployment the {@link IMemoryObject<Deployment>} used to store the selected deployment.
*/
// @formatter:off
public DeploymentSelectionAdapter(
final SecondLoginWizardPage secondLoginWizardPage,
final SecondSapLoginWizardPage secondLoginWizardPage,
final IMemoryObject<Deployment> memoryDeployment) {
// @formatter:on
this.secondLoginWizardPage = secondLoginWizardPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.developer.nefarious.zjoule.plugin.login.api.GetDeploymentsResponse;
import com.developer.nefarious.zjoule.plugin.login.api.ISapLoginClient;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.memory.IMemoryObject;
import com.developer.nefarious.zjoule.plugin.models.ServiceKey;

Expand All @@ -21,7 +21,7 @@
public class ResourceGroupSelectionAdapter extends SelectionAdapter {

/** The second login wizard page associated with this adapter. */
private SecondLoginWizardPage secondLoginWizardPage;
private SecondSapLoginWizardPage secondLoginWizardPage;

/** The login client for retrieving deployments. */
private ISapLoginClient sapLoginClient;
Expand All @@ -32,13 +32,13 @@ public class ResourceGroupSelectionAdapter extends SelectionAdapter {
/**
* Constructs a new {@code ResourceGroupSelectionAdapter}.
*
* @param secondLoginWizardPage the {@link SecondLoginWizardPage} containing the resource group dropdown.
* @param secondLoginWizardPage the {@link SecondSapLoginWizardPage} containing the resource group dropdown.
* @param sapLoginClient the {@link ISapLoginClient} for retrieving deployments.
* @param memoryResourceGroup the {@link IMemoryObject<String>} used to store the selected resource group.
*/
// @formatter:off
public ResourceGroupSelectionAdapter(
final SecondLoginWizardPage secondLoginWizardPage,
final SecondSapLoginWizardPage secondLoginWizardPage,
final ISapLoginClient sapLoginClient,
final IMemoryObject<String> memoryResourceGroup) {
// @formatter:on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.developer.nefarious.zjoule.plugin.login.api.GetResourceGroupsResponse;
import com.developer.nefarious.zjoule.plugin.login.api.ISapLoginClient;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.utils.JsonValidator;
import com.developer.nefarious.zjoule.plugin.models.ServiceKey;
import com.google.gson.Gson;
Expand All @@ -21,7 +21,7 @@
public class ServiceKeyModifyListener implements ModifyListener {

/** The first page of the login wizard associated with this listener. */
private FirstLoginWizardPage firstLoginWizardPage;
private FirstSapLoginWizardPage firstLoginWizardPage;

/** The login client used for validating the service key and retrieving resource groups. */
private ISapLoginClient sapLoginClient;
Expand All @@ -32,13 +32,13 @@ public class ServiceKeyModifyListener implements ModifyListener {
/**
* Constructs a new {@code ServiceKeyModifyListener}.
*
* @param firstLoginWizardPage the {@link FirstLoginWizardPage} containing the service key input field.
* @param firstLoginWizardPage the {@link FirstSapLoginWizardPage} containing the service key input field.
* @param sapLoginClient the {@link ISapLoginClient} for validating the service key and retrieving resource groups.
* @param gson the {@link Gson} instance for parsing the service key JSON.
*/
// @formatter:off
public ServiceKeyModifyListener(
final FirstLoginWizardPage firstLoginWizardPage,
final FirstSapLoginWizardPage firstLoginWizardPage,
final ISapLoginClient sapLoginClient,
final Gson gson) {
// @formatter:on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* <li>Logic to propagate resource group information to subsequent wizard pages.</li>
* </ul>
*/
public class FirstLoginWizardPage extends WizardPage {
public class FirstSapLoginWizardPage extends WizardPage {

/** The unique identifier for this wizard page. */
public static final String PAGE_ID = "First Page";
Expand Down Expand Up @@ -54,7 +54,7 @@ public class FirstLoginWizardPage extends WizardPage {
*
* @param sapLoginClient the {@link ISapLoginClient} used for API interactions during the login process.
*/
public FirstLoginWizardPage(final ISapLoginClient sapLoginClient) {
public FirstSapLoginWizardPage(final ISapLoginClient sapLoginClient) {
super(PAGE_ID);
setTitle("Provide credentials");
setDescription("Attach the Service Key json file content for the SAP AI Core service.");
Expand Down Expand Up @@ -116,7 +116,7 @@ public ServiceKey getServiceKey() {
* @param getResourceGroupsResponse the response containing available resource groups.
*/
public void setResourceGroupsOnTheSecondPage(final GetResourceGroupsResponse getResourceGroupsResponse) {
SecondLoginWizardPage secondPage = (SecondLoginWizardPage) getWizard().getPage(SecondLoginWizardPage.PAGE_ID);
SecondSapLoginWizardPage secondPage = (SecondSapLoginWizardPage) getWizard().getPage(SecondSapLoginWizardPage.PAGE_ID);
List<String> resourceGroupsAvailableForSelection = ResourceGroupIdExtractor.extractResourceGroupIds(getResourceGroupsResponse);
secondPage.setResourceGroupsForSelection(resourceGroupsAvailableForSelection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
* <li>A dropdown for selecting a resource group.</li>
* <li>A dropdown for selecting a deployment ID (enabled after selecting a resource group).</li>
* </ul>
* It also communicates with {@link FirstLoginWizardPage} to retrieve service key data.
* It also communicates with {@link FirstSapLoginWizardPage} to retrieve service key data.
*/
public class SecondLoginWizardPage extends WizardPage {
public class SecondSapLoginWizardPage extends WizardPage {

/** The unique identifier for this wizard page. */
public static final String PAGE_ID = "Second Page";
Expand Down Expand Up @@ -64,7 +64,7 @@ public class SecondLoginWizardPage extends WizardPage {
* @param memoryDeployment the {@link IMemoryObject<Deployment>} for deployment memory management.
*/
// @formatter:off
public SecondLoginWizardPage(
public SecondSapLoginWizardPage(
final ISapLoginClient sapLoginClient,
final IMemoryObject<String> memoryResourceGroup,
final IMemoryObject<Deployment> memoryDeployment) {
Expand Down Expand Up @@ -146,7 +146,7 @@ public Combo getResourceGroupDropdown() {
* @return the {@link ServiceKey} provided on the first page.
*/
public ServiceKey getServiceKey() {
FirstLoginWizardPage firstPage = (FirstLoginWizardPage) getWizard().getPage(FirstLoginWizardPage.PAGE_ID);
FirstSapLoginWizardPage firstPage = (FirstSapLoginWizardPage) getWizard().getPage(FirstSapLoginWizardPage.PAGE_ID);
return firstPage.getServiceKey();
}

Expand Down Expand Up @@ -181,7 +181,7 @@ public void setVisible(final boolean visible) {
super.setVisible(visible);
if (visible) {
// Retrieve data from the first page
FirstLoginWizardPage firstPage = (FirstLoginWizardPage) getWizard().getPage(FirstLoginWizardPage.PAGE_ID);
FirstSapLoginWizardPage firstPage = (FirstSapLoginWizardPage) getWizard().getPage(FirstSapLoginWizardPage.PAGE_ID);
String data = firstPage.getInputText();

// Dynamically populate resource group dropdown based on first page's data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.mockito.MockitoAnnotations;

import com.developer.nefarious.zjoule.plugin.login.events.DeploymentSelectionAdapter;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.memory.IMemoryObject;
import com.developer.nefarious.zjoule.plugin.models.Deployment;

Expand All @@ -25,7 +25,7 @@ public class DeploymentSelectionAdapterTest {
private DeploymentSelectionAdapter cut;

@Mock
private SecondLoginWizardPage mockSecondLoginWizardPage;
private SecondSapLoginWizardPage mockSecondLoginWizardPage;

@Mock
private IMemoryObject<Deployment> mockMemoryDeployment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.developer.nefarious.zjoule.plugin.login.api.GetDeploymentsResponse;
import com.developer.nefarious.zjoule.plugin.login.api.ISapLoginClient;
import com.developer.nefarious.zjoule.plugin.login.events.ResourceGroupSelectionAdapter;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.SecondSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.memory.IMemoryObject;
import com.developer.nefarious.zjoule.plugin.models.Deployment;
import com.developer.nefarious.zjoule.plugin.models.ServiceKey;
Expand All @@ -27,7 +27,7 @@ public class ResourceGroupSelectionAdapterTest {
private ResourceGroupSelectionAdapter cut;

@Mock
private SecondLoginWizardPage mockSecondLoginWizardPage;
private SecondSapLoginWizardPage mockSecondLoginWizardPage;

@Mock
private ISapLoginClient mockSapLoginClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.developer.nefarious.zjoule.plugin.login.api.GetResourceGroupsResponse;
import com.developer.nefarious.zjoule.plugin.login.api.ISapLoginClient;
import com.developer.nefarious.zjoule.plugin.login.events.ServiceKeyModifyListener;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.pages.FirstSapLoginWizardPage;
import com.developer.nefarious.zjoule.plugin.login.utils.JsonValidator;
import com.developer.nefarious.zjoule.plugin.models.ServiceKey;
import com.google.gson.Gson;
Expand All @@ -30,7 +30,7 @@ public class ServiceKeyModifyListenerTest {
private ServiceKeyModifyListener cut;

@Mock
private FirstLoginWizardPage mockFirstLoginWizardPage;
private FirstSapLoginWizardPage mockFirstLoginWizardPage;

@Mock
private ISapLoginClient mockSapLoginClient;
Expand Down

0 comments on commit 75ee5bf

Please sign in to comment.