Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wss4j removal #12344

Merged
merged 4 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
--add-exports java.base/sun.nio.cs=ALL-UNNAMED
</argLine>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.wso2.org.ops4j.pax.logging:pax-logging-api</classpathDependencyExclude>
<classpathDependencyExclude>org.wso2.org.ops4j.pax.logging</classpathDependencyExclude>
<classpathDependencyExclude>org.wso2.orbit.com.fasterxml.jackson.core:jackson-core</classpathDependencyExclude>
</classpathDependencyExcludes>
<systemProperties>
Expand Down
16 changes: 2 additions & 14 deletions components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,24 +223,12 @@
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.custom.lifecycles.checklist</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.poi.wso2</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
</dependency>

<dependency>
<groupId>org.wso2.carbon.event-processing</groupId>
<artifactId>org.wso2.carbon.event.processor.stub</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.wso2.carbon.apimgt.impl.importexport.ExportFormat;
import org.wso2.carbon.apimgt.impl.importexport.ImportExportAPI;
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import org.wso2.carbon.apimgt.impl.lifecycle.CheckListItem;
import org.wso2.carbon.apimgt.impl.monetization.DefaultMonetizationImpl;
import org.wso2.carbon.apimgt.impl.notification.NotificationDTO;
import org.wso2.carbon.apimgt.impl.notification.NotificationExecutor;
Expand Down Expand Up @@ -96,7 +97,6 @@
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.databridge.commons.Event;
import org.wso2.carbon.governance.custom.lifecycles.checklist.util.CheckListItem;
import org.wso2.carbon.identity.application.common.model.IdentityProvider;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.apimgt.impl.lifecycle;
public class CheckListItem implements Comparable {
private String lifeCycleStatus;
private String name;
private String value;
private String order;
private String propertyName;
private String isVisible;
private static final Object HASH_CODE_OBJECT = new Object();

Check warning on line 26 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L26

Added line #L26 was not covered by tests

public String getVisible() {
return this.isVisible;

Check warning on line 29 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L29

Added line #L29 was not covered by tests
}

public void setVisible(String visible) {
this.isVisible = visible;
}

Check warning on line 34 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L33-L34

Added lines #L33 - L34 were not covered by tests

public String getPropertyName() {
return this.propertyName;

Check warning on line 37 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L37

Added line #L37 was not covered by tests
}

public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}

Check warning on line 42 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L41-L42

Added lines #L41 - L42 were not covered by tests

public String getLifeCycleStatus() {
return this.lifeCycleStatus;

Check warning on line 45 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L45

Added line #L45 was not covered by tests
}

public void setLifeCycleStatus(String lifeCycleStatus) {
this.lifeCycleStatus = lifeCycleStatus;
}

Check warning on line 50 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L49-L50

Added lines #L49 - L50 were not covered by tests

public String getName() {
return this.name;

Check warning on line 53 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L53

Added line #L53 was not covered by tests
}

public void setName(String name) {
this.name = name;
}

Check warning on line 58 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L57-L58

Added lines #L57 - L58 were not covered by tests

public String getValue() {
return this.value;

Check warning on line 61 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L61

Added line #L61 was not covered by tests
}

public void setValue(String value) {
this.value = value;
}

Check warning on line 66 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L65-L66

Added lines #L65 - L66 were not covered by tests

public String getOrder() {
return this.order;

Check warning on line 69 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L69

Added line #L69 was not covered by tests
}

public void setOrder(String order) {
this.order = order;
}

Check warning on line 74 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L73-L74

Added lines #L73 - L74 were not covered by tests

public CheckListItem(String lifeCycleStatus, String name, String value, String order) {
this.lifeCycleStatus = lifeCycleStatus;
this.name = name;
this.value = value;
this.order = order;
}

Check warning on line 81 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L76-L81

Added lines #L76 - L81 were not covered by tests

public CheckListItem() {
}

Check warning on line 84 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L83-L84

Added lines #L83 - L84 were not covered by tests

public boolean matchLifeCycleStatus(String status, boolean ignoreCase) {
if (this.lifeCycleStatus != null && status != null) {
return ignoreCase ? this.lifeCycleStatus.equalsIgnoreCase(status) : this.lifeCycleStatus.equals(status);
} else {
return false;

Check warning on line 90 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L90

Added line #L90 was not covered by tests
}
}

public boolean matchLifeCycleStatus(String status) {
return this.matchLifeCycleStatus(status, true);

Check warning on line 95 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L95

Added line #L95 was not covered by tests
}

public int hashCode() {
int hashCode = HASH_CODE_OBJECT.hashCode();

Check warning on line 99 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L99

Added line #L99 was not covered by tests
if (this.order != null) {
hashCode &= this.order.hashCode();

Check warning on line 101 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L101

Added line #L101 was not covered by tests
}

if (this.name != null) {
hashCode &= this.name.hashCode();

Check warning on line 105 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L105

Added line #L105 was not covered by tests
}

if (this.value != null) {
hashCode &= this.value.hashCode();

Check warning on line 109 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L109

Added line #L109 was not covered by tests
}

if (this.lifeCycleStatus != null) {
hashCode &= this.lifeCycleStatus.hashCode();

Check warning on line 113 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L113

Added line #L113 was not covered by tests
}

if (this.propertyName != null) {
hashCode &= this.propertyName.hashCode();

Check warning on line 117 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L117

Added line #L117 was not covered by tests
}

return hashCode;

Check warning on line 120 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L120

Added line #L120 was not covered by tests
}

public boolean equals(Object obj) {
if (!(obj instanceof CheckListItem)) {
return false;

Check warning on line 125 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L125

Added line #L125 was not covered by tests
} else {
CheckListItem item = (CheckListItem)obj;

Check warning on line 127 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L127

Added line #L127 was not covered by tests
return (this.order != null && this.order.equals(item.order) || this.order == null && item.order == null) && (this.lifeCycleStatus != null && this.lifeCycleStatus.equals(item.lifeCycleStatus) || this.lifeCycleStatus == null && item.lifeCycleStatus == null) && (this.name != null && this.name.equals(item.name) || this.name == null && item.name == null) && (this.value != null && this.value.equals(item.value) || this.value == null && item.value == null) && (this.propertyName != null && this.propertyName.equals(item.propertyName) || this.propertyName == null && item.propertyName == null);
}
}

public int compareTo(Object anotherItem) {
if (this.equals(anotherItem)) {
return 0;

Check warning on line 134 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L134

Added line #L134 was not covered by tests
} else {
CheckListItem item = (CheckListItem)anotherItem;
int otherItemOrder = Integer.parseInt(item.getOrder());
int itemOrder = Integer.parseInt(this.order);
return itemOrder - otherItemOrder;

Check warning on line 139 in components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/lifecycle/CheckListItem.java#L136-L139

Added lines #L136 - L139 were not covered by tests
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,10 @@
import org.wso2.carbon.apimgt.impl.dto.ThrottleProperties;
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import org.wso2.carbon.apimgt.impl.loader.KeyManagerConfigurationDataRetriever;
import org.wso2.carbon.apimgt.impl.service.KeyMgtRegistrationService;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.governance.lcm.util.CommonUtil;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.utils.AbstractAxis2ConfigurationContextObserver;

import java.io.FileNotFoundException;

import javax.xml.stream.XMLStreamException;

/**
* This task provisions mandatory configs & Artifacts needed by any tenant. The reason for introducing this task is
* to prevent {@link org.wso2.carbon.apimgt.impl.observers.TenantServiceCreator} class being run on None-synapse
Expand Down Expand Up @@ -124,17 +117,6 @@ public void run() {
} catch (Exception e) { // The generic Exception is handled explicitly so execution does not stop during config deployment
log.error("Exception when creating default roles for tenant " + tenantDomain, e);
}
try {
CommonUtil.addDefaultLifecyclesIfNotAvailable(ServiceReferenceHolder.getInstance().getRegistryService()
.getConfigSystemRegistry(tenantId), CommonUtil
.getRootSystemRegistry(tenantId));
} catch (RegistryException e) {
log.error("Error while accessing registry", e);
} catch (FileNotFoundException e) {
log.error("Error while find lifecycle.xml", e);
} catch (XMLStreamException e) {
log.error("Error while parsing Lifecycle.xml", e);
}
KeyManagerConfigurationDataRetriever keyManagerConfigurationDataRetriever =
new KeyManagerConfigurationDataRetriever(tenantDomain);
keyManagerConfigurationDataRetriever.startLoadKeyManagerConfigurations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
Expand Down Expand Up @@ -105,7 +104,6 @@
import org.wso2.carbon.governance.api.generic.GenericArtifactManager;
import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
import org.wso2.carbon.governance.api.util.GovernanceUtils;
import org.wso2.carbon.governance.custom.lifecycles.checklist.util.LifecycleBeanPopulator;
import org.wso2.carbon.registry.core.Collection;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.Resource;
Expand Down Expand Up @@ -152,7 +150,7 @@
@SuppressStaticInitializationFor("org.wso2.carbon.context.PrivilegedCarbonContext")
@PrepareForTest({ ServiceReferenceHolder.class, ApiMgtDAO.class, APIUtil.class, APIGatewayManager.class,
GovernanceUtils.class, PrivilegedCarbonContext.class, WorkflowExecutorFactory.class, JavaUtils.class,
APIProviderImpl.class, APIManagerFactory.class, RegistryUtils.class, LifecycleBeanPopulator.class,
APIProviderImpl.class, APIManagerFactory.class, RegistryUtils.class,
Caching.class, PaginationContext.class, MultitenantUtils.class, AbstractAPIManager.class, OASParserUtil.class,
KeyManagerHolder.class, CertificateManagerImpl.class , PublisherAPI.class, Organization.class,
APIPersistence.class, GatewayArtifactsMgtDAO.class, RegistryPersistenceUtil.class})
Expand Down Expand Up @@ -183,7 +181,6 @@ public void init() throws Exception {
PowerMockito.mockStatic(RegistryUtils.class);
PowerMockito.mockStatic(GovernanceUtils.class);
PowerMockito.mockStatic(WorkflowExecutorFactory.class);
PowerMockito.mockStatic(LifecycleBeanPopulator.class);
PowerMockito.mockStatic(KeyManagerHolder.class);
PowerMockito.mockStatic(Caching.class);
PowerMockito.mockStatic(PaginationContext.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,20 @@
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.governance.lcm.util.CommonUtil;
import org.wso2.carbon.registry.core.service.RegistryService;

import static org.wso2.carbon.base.CarbonBaseConstants.CARBON_HOME;


@RunWith(PowerMockRunner.class)
@PrepareForTest({APIUtil.class, PrivilegedCarbonContext.class, ServiceReferenceHolder.class, CommonUtil.class})
@PrepareForTest({APIUtil.class, PrivilegedCarbonContext.class, ServiceReferenceHolder.class})
public class CommonConfigDeployerTestCase {

private final int TENANT_ID = 1234;
private final String TENANT_DOMAIN = "foo.com";

@Test
public void testCreatedConfigurationContext() throws APIManagementException {
PowerMockito.mockStatic(CommonUtil.class);
System.setProperty(CARBON_HOME, "");
PrivilegedCarbonContext privilegedCarbonContext = Mockito.mock(PrivilegedCarbonContext.class);
PowerMockito.mockStatic(PrivilegedCarbonContext.class);
Expand Down Expand Up @@ -84,16 +82,12 @@ public void testCreatedConfigurationContext() throws APIManagementException {

PowerMockito.verifyStatic(APIUtil.class);
APIUtil.loadAndSyncTenantConf(TENANT_DOMAIN);

//PowerMockito.verifyStatic(APIUtil.class);
//APIUtil.addDefaultTenantAdvancedThrottlePolicies(TENANT_DOMAIN, TENANT_ID);
}


@Test
public void testExceptions() throws Exception {
PowerMockito.mockStatic(APIUtil.class);
PowerMockito.mockStatic(CommonUtil.class);
System.setProperty(CARBON_HOME, "");
PrivilegedCarbonContext privilegedCarbonContext = Mockito.mock(PrivilegedCarbonContext.class);
PowerMockito.mockStatic(PrivilegedCarbonContext.class);
Expand Down Expand Up @@ -144,7 +138,6 @@ public void testExceptions() throws Exception {
@Test
public void testCreatedConfigurationContextRuntimeException() throws APIManagementException {
System.setProperty(CARBON_HOME, "");
PowerMockito.mockStatic(CommonUtil.class);
PrivilegedCarbonContext privilegedCarbonContext = Mockito.mock(PrivilegedCarbonContext.class);
PowerMockito.mockStatic(PrivilegedCarbonContext.class);
PowerMockito.when(PrivilegedCarbonContext.getThreadLocalCarbonContext()).thenReturn(privilegedCarbonContext);
Expand Down
28 changes: 16 additions & 12 deletions components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<Import-Package>
org.apache.commons.logging.*; version="${import.package.version.commons.logging}",
org.wso2.carbon.registry.core.*; version="${carbon.registry.imp.pkg.version}",
org.wso2.carbon.governance.lcm.* version="${carbon.governance.version}",
org.apache.cxf.jaxrs.ext.multipart.* version="${cxf.version}"
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
Expand Down Expand Up @@ -100,17 +99,22 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
<exclusions>
<exclusion>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.indexing</artifactId>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3080,7 +3080,6 @@ protected RegistryHolder getRegistry(String requestedTenantDomain) throws APIPer
loadTenantRegistry(tenantId);
registry = getRegistryService().getGovernanceSystemRegistry(tenantId);
RegistryPersistenceUtil.loadloadTenantAPIRXT(null, tenantId);
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
RegistryPersistenceUtil.registerCustomQueries(registry, null, userTenantDomain);
holder.setTenantId(tenantId);
}
Expand All @@ -3089,7 +3088,6 @@ protected RegistryHolder getRegistry(String requestedTenantDomain) throws APIPer
loadTenantRegistry(tenantId);
registry = getRegistryService().getGovernanceSystemRegistry(tenantId);
RegistryPersistenceUtil.loadloadTenantAPIRXT(null, tenantId);
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
RegistryPersistenceUtil.registerCustomQueries(registry, null, userTenantDomain);
holder.setTenantId(tenantId);
}
Expand Down Expand Up @@ -3151,7 +3149,6 @@ protected RegistryHolder getRegistry(String username, String requestedTenantDoma
holder.setTenantId(tenantId);
}
RegistryPersistenceUtil.registerCustomQueries(configRegistry, username, userTenantDomain);
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
} catch (RegistryException | UserStoreException | PersistenceException e) {
String msg = "Failed to get API";
throw new APIPersistenceException(msg, e);
Expand Down
Loading
Loading