}
@Test
public void testAppInterface(){
try {
ApplicationInterface appInterface = appcatalog.getApplicationInterface();
ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
String wrfModuleId = addAppModule("WRF");
String amberModuleId = addAppModule("AMBER");
List<String> modules = new ArrayList<String>();
modules.add(wrfModuleId);
modules.add(amberModuleId);
InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING);
InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER);
List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
inputs.add(appInput1);
inputs.add(appInput2);
OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING);
OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING);
List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
outputs.add(output1);
outputs.add(output2);
description.setApplicationName("testApplication");
description.setApplicationDesription("my testApplication");
description.setApplicationModules(modules);
description.setApplicationInputs(inputs);
description.setApplicationOutputs(outputs);
String appID = appInterface.addApplicationInterface(description);
System.out.println("********** application id ************* : " + appID);
ApplicationInterfaceDescription ainterface = null;
if (appInterface.isApplicationInterfaceExists(appID)){
ainterface = appInterface.getApplicationInterface(appID);
System.out.println("********** application name ************* : " + ainterface.getApplicationName());
System.out.println("********** application description ************* : " + ainterface.getApplicationDesription());
}
ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId);
System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName());
ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId);
System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName());
List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID);
System.out.println("********** App Input size ************* : " + applicationInputs.size());
List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID);
System.out.println("********** App output size ************* : " + applicationOutputs.size());
description.setApplicationName("testApplication2");
appInterface.updateApplicationInterface(appID, description);
if (appInterface.isApplicationInterfaceExists(appID)){
ainterface = appInterface.getApplicationInterface(appID);
System.out.println("********** updated application name ************* : " + ainterface.getApplicationName());
}
wrfModule.setAppModuleVersion("1.0.1");
appInterface.updateApplicationModule(wrfModuleId, wrfModule);
wrfModule = appInterface.getApplicationModule(wrfModuleId);
System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion());
Map<String, String> filters = new HashMap<String, String>();
filters.put(AbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2");
List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
System.out.println("********** Size og app interfaces ************* : " + apps.size());
List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces();
System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size());
assertTrue("App interface saved successfully", ainterface != null);
}catch (AppCatalogException e) {
e.printStackTrace();