/*** * Helper which takes a single ApiMode, and checks if we are running in that mode. * @param mode * @return */ public boolean isInApiMode(ApiMode mode) { final ApiMode currentMode = ApiMode.forValue(getMode()); return (currentMode == mode); }
@Override public String toString(){ // Get a string to represent our internal property state. Multimap<String, String> entries = new CaseInsensitiveKeyMultimap<>(); entries.put("api.mode", getMode()); entries.put("api.webservice.url", getWebServiceUrl()); entries.put("api.direct.repository", getRepository()); entries.put("api.web.useget", String.valueOf(getUseHttpGet())); entries.put("api.web.httpclientbuilderclass", getHttpClientBuilderClass()); entries.put("api.streams.cache", String.valueOf(getStreamsCacheEnabled())); entries.put("api.admin.basedata", String.valueOf(getAdminBaseDataEnabled())); return StringHelper.mapToHtml(entries); }
public IntegrationTestBase() { // in certain cases we now have to shutdown the main ApiApplicationInstance as once a profile has been activated // it doesn't remove itself, it has to be rebuilt. As such a quick request here will ensure we have a new context. // if it has been removed. if (genericApplicationContext == null) { genericApplicationContext = new CorePolicyApplicationContext(); genericApplicationContext.refresh(); } apiProperties = genericApplicationContext.getBean(ApiProperties.class); try { // let our deployment type setup the usercontext correctly. depending on iod/web switch (apiProperties.getMode()) { case "direct": case "web": { // set the real user context now! userContext = genericApplicationContext.getBean(UserContext.class); userContext.setProjectId(UUID.randomUUID().toString()); break; } } } catch (Exception ex) { getLogger().trace("Exception in IntegrationTestBase... ", ex); throw new RuntimeException(ex); } classificationApi = genericApplicationContext.getBean(ClassificationApi.class); }
if(apiProperties.getMode()!=null){ if(!apiProperties.getMode().equalsIgnoreCase("none")){ configurableEnvironment.addActiveProfile("api"); if(apiProperties.getMode().equalsIgnoreCase("web")){ configurableEnvironment.addActiveProfile("apiweb"); if(apiProperties.getMode().equalsIgnoreCase("direct")){ configurableEnvironment.addActiveProfile("apidirect");