Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

Commit

Permalink
fix IT for subscription and operator services
Browse files Browse the repository at this point in the history
  • Loading branch information
MiethanerR committed Oct 28, 2016
1 parent 315929d commit 913632c
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static void setup(TestContainer container) throws Exception {
@Override
public List<TriggerProcessMessageData> sendSuspendingMessages(
List<TriggerMessage> messageData) {
List<TriggerProcessMessageData> result = new ArrayList<TriggerProcessMessageData>();
List<TriggerProcessMessageData> result = new ArrayList<>();
for (TriggerMessage m : messageData) {
TriggerProcess tp = new TriggerProcess();
tp.setUser(adminUser);
Expand Down Expand Up @@ -260,9 +260,8 @@ private static LocalizerServiceLocal mockLocalizer() {
doReturn(EMPTY_STRING).when(localizerMock).getLocalizedTextFromBundle(
any(LocalizedObjectTypes.class), any(Marketplace.class),
any(String.class), any(String.class));
doReturn(EMPTY_STRING).when(localizerMock)
.getLocalizedTextFromDatabase(any(String.class), anyLong(),
any(LocalizedObjectTypes.class));
doReturn(EMPTY_STRING).when(localizerMock).getLocalizedTextFromDatabase(
any(String.class), anyLong(), any(LocalizedObjectTypes.class));
return localizerMock;
}

Expand All @@ -288,6 +287,20 @@ public PlatformUser getPlatformUser(String userId,
}
return user;
}

@Override
public PlatformUser getPlatformUser(String userId, String tenantId,
boolean validateOrganization) {
PlatformUser user = null;
try {
user = container.get(IdentityServiceLocal.class)
.getPlatformUser(userId, tenantId, false);
} catch (ObjectNotFoundException
| OperationNotPermittedException exception) {
throw new UnsupportedOperationException();
}
return user;
}
});
}

Expand Down Expand Up @@ -317,7 +330,8 @@ public TenantProvisioningResult createProductInstance(
TenantProvisioningResult result = new TenantProvisioningResult();
ProvisioningType provType = subscription.getProduct()
.getTechnicalProduct().getProvisioningType();
result.setAsyncProvisioning(provType == ProvisioningType.ASYNCHRONOUS);
result.setAsyncProvisioning(
provType == ProvisioningType.ASYNCHRONOUS);
return result;
}

Expand Down Expand Up @@ -421,21 +435,21 @@ public static VOMarketplace createMarketplace(TestContainer container,
marketplace.setName(name);
marketplace.setOwningOrganizationId(ownerId);
marketplace.setOpen(true);
return container.get(MarketplaceService.class).createMarketplace(
marketplace);
return container.get(MarketplaceService.class)
.createMarketplace(marketplace);
}

public static void importTechnicalService(TestContainer container,
String technicalService) throws Exception {
ServiceProvisioningService provisioningService = container
.get(ServiceProvisioningService.class);
provisioningService.importTechnicalServices(technicalService
.getBytes("UTF-8"));
provisioningService
.importTechnicalServices(technicalService.getBytes("UTF-8"));
}

public static VOService createAndPublishFreeProduct(
TestContainer container, VOTechnicalService technicalService,
VOMarketplace marketplace) throws Exception {
public static VOService createAndPublishFreeProduct(TestContainer container,
VOTechnicalService technicalService, VOMarketplace marketplace)
throws Exception {

double oneTimeFee = 0D;
double pricePerPeriod = 0D;
Expand Down Expand Up @@ -549,8 +563,8 @@ private static VOService createAndPublishMarketableService(

VOServiceDetails voServiceDetails = new VOServiceDetails();
voServiceDetails.setServiceId(serviceId);
VOServiceDetails serviceDetails = provisioningService.createService(
technicalService, voServiceDetails, null);
VOServiceDetails serviceDetails = provisioningService
.createService(technicalService, voServiceDetails, null);

VOPriceModel priceModel = new VOPriceModel();
priceModel.setType(priceModelType);
Expand All @@ -572,16 +586,16 @@ private static VOService createAndPublishMarketableService(

public static VOService activateService(TestContainer container,
VOService service) throws Exception {
return container.get(ServiceProvisioningService.class).activateService(
service);
return container.get(ServiceProvisioningService.class)
.activateService(service);
}

public static void defineUpgradePath(TestContainer container,
VOService... services) throws Exception {
ServiceProvisioningService provisioningService = container
.get(ServiceProvisioningService.class);

List<VOService> allServices = new ArrayList<VOService>();
List<VOService> allServices = new ArrayList<>();
allServices.addAll(Arrays.asList(services));

for (VOService srv : services) {
Expand All @@ -593,7 +607,7 @@ public static void defineUpgradePath(TestContainer container,

public static List<VOService> getServices(TestContainer container,
List<VOService> services) throws Exception {
List<VOService> serviceList = new ArrayList<VOService>();
List<VOService> serviceList = new ArrayList<>();
for (VOService service : services) {
serviceList.add(getServiceDetails(container, service));
}
Expand Down Expand Up @@ -637,7 +651,8 @@ private static VOPaymentType getPaymentTypeVO(
Set<VOPaymentType> defaultPaymentTypes,
PaymentInfoType paymentInfoType) {
for (VOPaymentType voPaymentType : defaultPaymentTypes) {
if (voPaymentType.getPaymentTypeId().equals(paymentInfoType.name())) {
if (voPaymentType.getPaymentTypeId()
.equals(paymentInfoType.name())) {
return voPaymentType;
}
}
Expand Down
Loading

0 comments on commit 913632c

Please sign in to comment.