Skip to content

Commit 98b08c4

Browse files
committed
Fix tests
1 parent b7cf789 commit 98b08c4

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ public static GatewayDeployer getTenantGatewayInstance(String organization, Stri
9999
if (environment != null) {
100100
GatewayAgentConfiguration gatewayAgentConfiguration = ServiceReferenceHolder.getInstance().
101101
getExternalGatewayConnectorConfiguration(environment.getGatewayType());
102-
GatewayDeployer deployer = (GatewayDeployer) Class.forName(gatewayAgentConfiguration.getImplementation())
103-
.getDeclaredConstructor().newInstance();
104-
deployer.init(environment);
105-
return deployer;
102+
if (gatewayAgentConfiguration != null) {
103+
GatewayDeployer deployer = (GatewayDeployer) Class.forName(gatewayAgentConfiguration.getImplementation())
104+
.getDeclaredConstructor().newInstance();
105+
deployer.init(environment);
106+
return deployer;
107+
108+
}
109+
return null;
106110
}
107111
} catch (APIManagementException | ClassNotFoundException | NoSuchMethodException |
108112
InstantiationException | IllegalAccessException | InvocationTargetException e) {

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/notifier/ExternalGatewayNotifier.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@
4242
import java.util.Set;
4343

4444
public class ExternalGatewayNotifier extends DeployAPIInGatewayNotifier {
45-
protected ApiMgtDAO apiMgtDAO;
4645
private static final Log log = LogFactory.getLog(ExternalGatewayNotifier.class);
4746

4847
@Override
4948
public boolean publishEvent(Event event) throws NotifierException {
5049
if (APIUtil.isAnyExternalGateWayProviderExists(event.getTenantDomain())) {
51-
apiMgtDAO = ApiMgtDAO.getInstance();
5250
process(event);
5351
}
5452
return true;
@@ -78,8 +76,8 @@ private void process(Event event) throws NotifierException {
7876
* @throws NotifierException if error occurs when deploying APIs to external gateway
7977
*/
8078
private void deployApi(DeployAPIInGatewayEvent deployAPIInGatewayEvent) throws NotifierException {
81-
8279
boolean deployed;
80+
ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance();
8381
Set<String> gateways = deployAPIInGatewayEvent.getGatewayLabels();
8482
String apiId = deployAPIInGatewayEvent.getUuid();
8583

@@ -130,6 +128,7 @@ private void deployApi(DeployAPIInGatewayEvent deployAPIInGatewayEvent) throws N
130128
private void unDeployApi(DeployAPIInGatewayEvent deployAPIInGatewayEvent) throws NotifierException {
131129

132130
boolean deleted;
131+
ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance();
133132
Set<String> gateways = deployAPIInGatewayEvent.getGatewayLabels();
134133
String apiId = deployAPIInGatewayEvent.getUuid();
135134
try {

0 commit comments

Comments
 (0)