-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix to remove duplicate call to grant application access to api.
- Loading branch information
rathnapandi
committed
Oct 23, 2024
1 parent
10ea640
commit 53189f5
Showing
6 changed files
with
160 additions
and
47 deletions.
There are no files selected for viewing
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
99 changes: 99 additions & 0 deletions
99
modules/apis/src/test/java/com/axway/apim/apiimport/actions/ManageClientAppsTest.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,99 @@ | ||
package com.axway.apim.apiimport.actions; | ||
|
||
import com.axway.apim.WiremockWrapper; | ||
import com.axway.apim.api.API; | ||
import com.axway.apim.api.model.Organization; | ||
import com.axway.apim.api.model.apps.ClientApplication; | ||
import com.axway.apim.lib.CoreParameters; | ||
import com.axway.apim.lib.utils.Utils; | ||
import org.testng.Assert; | ||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ManageClientAppsTest extends WiremockWrapper { | ||
|
||
@BeforeClass | ||
public void initWiremock() { | ||
super.initWiremock(); | ||
CoreParameters coreParameters = new CoreParameters(); | ||
coreParameters.setHostname("localhost"); | ||
coreParameters.setUsername("test"); | ||
coreParameters.setPassword(Utils.getEncryptedPassword()); | ||
} | ||
|
||
@AfterClass | ||
public void close() { | ||
super.close(); | ||
} | ||
|
||
|
||
@Test | ||
public void containsAppNameEqual() throws Exception { | ||
API desiredState = new API(); | ||
API actualState = new API(); | ||
|
||
ManageClientApps manageClientApps = new ManageClientApps(desiredState, actualState, null); | ||
List<ClientApplication> source = new ArrayList<>(); | ||
Organization organization = new Organization(); | ||
organization.setName("Test Organization"); | ||
ClientApplication clientApplication = new ClientApplication(); | ||
clientApplication.setOrganization(organization); | ||
clientApplication.setName("Test Client Application"); | ||
source.add(clientApplication); | ||
Assert.assertTrue(manageClientApps.containsAppName(source, clientApplication)); | ||
|
||
} | ||
|
||
@Test | ||
public void containsAppNameNotEqual() throws Exception { | ||
API desiredState = new API(); | ||
API actualState = new API(); | ||
|
||
ManageClientApps manageClientApps = new ManageClientApps(desiredState, actualState, null); | ||
List<ClientApplication> source = new ArrayList<>(); | ||
Organization organization = new Organization(); | ||
organization.setName("Test Organization"); | ||
ClientApplication clientApplication = new ClientApplication(); | ||
clientApplication.setOrganization(organization); | ||
clientApplication.setName("Test Client Application"); | ||
source.add(clientApplication); | ||
|
||
ClientApplication newClientApplication = new ClientApplication(); | ||
newClientApplication.setOrganization(organization); | ||
newClientApplication.setName("Test Client Application2"); | ||
source.add(clientApplication); | ||
|
||
|
||
Assert.assertFalse(manageClientApps.containsAppName(source, newClientApplication)); | ||
|
||
} | ||
|
||
@Test | ||
|
||
public void getMissingApps() throws Exception { | ||
API desiredState = new API(); | ||
API actualState = new API(); | ||
|
||
List<ClientApplication> source = new ArrayList<>(); | ||
Organization organization = new Organization(); | ||
organization.setName("Test Organization"); | ||
ClientApplication clientApplication = new ClientApplication(); | ||
clientApplication.setOrganization(organization); | ||
clientApplication.setName("Test Client Application"); | ||
source.add(clientApplication); | ||
List<ClientApplication> target = new ArrayList<>(); | ||
ClientApplication clientApplicationTarget = new ClientApplication(); | ||
clientApplicationTarget.setOrganization(organization); | ||
clientApplicationTarget.setName("Test Client Application Target"); | ||
target.add(clientApplicationTarget); | ||
|
||
ManageClientApps manageClientApps = new ManageClientApps(desiredState, actualState, null); | ||
List<ClientApplication> missingApps = manageClientApps.getMissingApps(source, target); | ||
Assert.assertEquals(missingApps.get(0).getName(), "Test Client Application"); | ||
|
||
} | ||
} |