use of org.wso2.carbon.apimgt.api.model.Label in project carbon-apimgt by wso2.
the class WSDL11ProcessorImplTestCase method testSingleWSDL.
@Test
public void testSingleWSDL() throws Exception {
WSDL11ProcessorImpl wsdl11Processor = new WSDL11ProcessorImpl();
byte[] wsdlContentBytes = SampleTestObjectCreator.createDefaultWSDL11Content();
wsdl11Processor.init(wsdlContentBytes);
Assert.assertTrue(wsdl11Processor.canProcess());
assertDefaultSingleWSDLContent(wsdl11Processor.getWsdlInfo(), SampleTestObjectCreator.ORIGINAL_ENDPOINT_WEATHER, null);
// validate the content from getWSDL() after initializing the WSDL processor
byte[] originalWsdlContentFromProcessor = wsdl11Processor.getWSDL();
WSDL11ProcessorImpl wsdl11Processor2 = new WSDL11ProcessorImpl();
wsdl11Processor2.init(originalWsdlContentFromProcessor);
Assert.assertTrue(wsdl11Processor2.canProcess());
assertDefaultSingleWSDLContent(wsdl11Processor2.getWsdlInfo(), SampleTestObjectCreator.ORIGINAL_ENDPOINT_WEATHER, null);
// validate the content after updating endpoints using an API and Label
API api = SampleTestObjectCreator.createDefaultAPI().build();
Label label = SampleTestObjectCreator.createLabel(SAMPLE_LABEL_NAME, SampleTestObjectCreator.LABEL_TYPE_STORE).build();
byte[] updatedWSDLWithEndpoint = wsdl11Processor.getUpdatedWSDL(api, label);
// validate the content of wsdl11Processor's WSDL Info content after updating its endpoints
assertDefaultSingleWSDLContent(wsdl11Processor.getWsdlInfo(), UPDATED_ENDPOINT_API_LABEL, SampleTestObjectCreator.ORIGINAL_ENDPOINT_WEATHER);
// validate the content of wsdl11Processor's returned WSDL content after updating its endpoints
WSDL11ProcessorImpl wsdl11Processor3 = new WSDL11ProcessorImpl();
wsdl11Processor3.init(updatedWSDLWithEndpoint);
Assert.assertTrue(wsdl11Processor3.canProcess());
assertDefaultSingleWSDLContent(wsdl11Processor3.getWsdlInfo(), UPDATED_ENDPOINT_API_LABEL, SampleTestObjectCreator.ORIGINAL_ENDPOINT_WEATHER);
}
use of org.wso2.carbon.apimgt.api.model.Label in project carbon-apimgt by wso2.
the class WSDL20ProcessorImplTestCase method testWSDLArchive.
@Test
public void testWSDLArchive() throws Exception {
String extractedLocation = SampleTestObjectCreator.createDefaultWSDL20Archive();
WSDL20ProcessorImpl wsdl20Processor = new WSDL20ProcessorImpl();
wsdl20Processor.initPath(extractedLocation);
Assert.assertTrue(wsdl20Processor.canProcess());
assertDefaultArchivedWSDLContent(wsdl20Processor.getWsdlInfo(), new String[] { ORIGINAL_ENDPOINT_MY_SERVICE, ORIGINAL_ENDPOINT_PURCHASE_ORDER }, null);
API api = SampleTestObjectCreator.createDefaultAPI().build();
Label label = SampleTestObjectCreator.createLabel(SAMPLE_LABEL_NAME, SampleTestObjectCreator.LABEL_TYPE_STORE).build();
String updatedPath = wsdl20Processor.getUpdatedWSDLPath(api, label);
WSDL20ProcessorImpl wsdl20Processor2 = new WSDL20ProcessorImpl();
wsdl20Processor2.initPath(updatedPath);
Assert.assertTrue(wsdl20Processor2.canProcess());
assertDefaultArchivedWSDLContent(wsdl20Processor2.getWsdlInfo(), new String[] { UPDATED_ENDPOINT_API_LABEL }, new String[] { ORIGINAL_ENDPOINT_MY_SERVICE, ORIGINAL_ENDPOINT_PURCHASE_ORDER });
}
use of org.wso2.carbon.apimgt.api.model.Label in project carbon-apimgt by wso2.
the class WSDL20ProcessorImplTestCase method testSingleWSDL.
@Test
public void testSingleWSDL() throws Exception {
WSDL20ProcessorImpl wsdl20Processor = new WSDL20ProcessorImpl();
byte[] wsdlContentBytes = SampleTestObjectCreator.createDefaultWSDL20Content();
wsdl20Processor.init(wsdlContentBytes);
Assert.assertTrue(wsdl20Processor.canProcess());
assertDefaultSingleWSDLContent(wsdl20Processor.getWsdlInfo(), ORIGINAL_ENDPOINT_MY_SERVICE, null);
// validate the content from getWSDL() after initializing the WSDL processor
byte[] originalWsdlContentFromProcessor = wsdl20Processor.getWSDL();
WSDL20ProcessorImpl wsdl20Processor2 = new WSDL20ProcessorImpl();
wsdl20Processor2.init(originalWsdlContentFromProcessor);
Assert.assertTrue(wsdl20Processor2.canProcess());
assertDefaultSingleWSDLContent(wsdl20Processor2.getWsdlInfo(), ORIGINAL_ENDPOINT_MY_SERVICE, null);
// validate the content after updating endpoints using an API and Label
API api = SampleTestObjectCreator.createDefaultAPI().build();
Label label = SampleTestObjectCreator.createLabel(SAMPLE_LABEL_NAME, SampleTestObjectCreator.LABEL_TYPE_STORE).build();
byte[] updatedWSDLWithEndpoint = wsdl20Processor.getUpdatedWSDL(api, label);
// validate the content of wsdl20Processor's WSDL Info content after updating its endpoints
assertDefaultSingleWSDLContent(wsdl20Processor.getWsdlInfo(), UPDATED_ENDPOINT_API_LABEL, ORIGINAL_ENDPOINT_MY_SERVICE);
// validate the content of wsdl20Processor's returned WSDL content after updating its endpoints
WSDL20ProcessorImpl wsdl20Processor3 = new WSDL20ProcessorImpl();
wsdl20Processor3.init(updatedWSDLWithEndpoint);
Assert.assertTrue(wsdl20Processor3.canProcess());
assertDefaultSingleWSDLContent(wsdl20Processor3.getWsdlInfo(), UPDATED_ENDPOINT_API_LABEL, ORIGINAL_ENDPOINT_MY_SERVICE);
}
use of org.wso2.carbon.apimgt.api.model.Label in project carbon-apimgt by wso2.
the class MappingUtil method convertToLabels.
/**
* Converts labelDTOs into labels
*
* @param labelDTOs List of LabelDTOs
* @return List of Labels
*/
public static List<Label> convertToLabels(List<LabelDTO> labelDTOs) {
List<Label> labels = new ArrayList<>();
for (LabelDTO labelDTO : labelDTOs) {
String labelId = UUID.randomUUID().toString();
Label label = new Label.Builder().id(labelId).name(labelDTO.getName()).accessUrls(labelDTO.getAccessUrls()).build();
labels.add(label);
}
return labels;
}
use of org.wso2.carbon.apimgt.api.model.Label in project carbon-apimgt by wso2.
the class ConfigurationsAPI method environments.
/**
* Get environment configurations from deployment.yaml and returns the list of environments
*
* @return Response List of environments: {"environments":[
* {"host":"localhost:9292","loginTokenPath":"/login/token","label":"Development"},
* {"host":"localhost:9293","loginTokenPath":"/login/token","label":"Production"}
* ]}
*/
@GET
@Path("/environments")
@Produces(MediaType.APPLICATION_JSON)
public Response environments() {
APIMUIConfigurations apimUIConfigurations = ConfigurationService.getInstance().getApimUIConfigurations();
EnvironmentConfigBean environmentConfigBean = new EnvironmentConfigBean();
environmentConfigBean.setEnvironments(apimUIConfigurations.getEnvironments());
return Response.ok(environmentConfigBean, MediaType.APPLICATION_JSON).build();
}
Aggregations