RouteDefinitionServiceImpl implements RouteDefinitionService { @Nullable @Override public RouteType findRouteType(RouteTypeInfo routeTypeInfo) { Assert.notNull(routeTypeInfo, "routeTypeInfo must not be null"); RouteType result = null; if (!CollectionUtils.isEmpty(routeTypeResolvers)) { for (RouteTypeResolver routeTypeResolver : routeTypeResolvers) { result = routeTypeResolver.findRouteType(routeTypeInfo); if (result != null) { break; } } } return result; }  @Nullable @Override RouteType findRouteType(RouteTypeInfo routeTypeInfo); @Override boolean isInputRoute(RouteTypeInfo routeTypeInfo);  }
@Test public void testFindRouteType() throws Exception { assertThat(routeDefinitionService.findRouteType( new RouteTypeInfo(getCamelContext().getRoute("inputTestRouteOne"), null, null, null)), is(RouteTypeEnum.INPUT)); assertThat(routeDefinitionService.findRouteType( new RouteTypeInfo(getCamelContext().getRoute("inputTestRouteTwo"), null, null, null)), is(RouteTypeEnum.INPUT)); assertThat(routeDefinitionService.findRouteType( new RouteTypeInfo(getCamelContext().getRoute("outputTestRouteOne"), null, null, null)), nullValue()); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, null, getCamelContext().getRouteDefinition("inputTestRouteOne"))), is(RouteTypeEnum.INPUT)); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, null, getCamelContext().getRouteDefinition("inputTestRouteTwo"))), is(RouteTypeEnum.INPUT)); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, null, getCamelContext().getRouteDefinition("outputTestRouteOne"))), nullValue()); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, AbstractBasicRoute.getRouteId(ServiceTestEnum.CUSTOMER, "operation"), null)), nullValue()); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, AbstractBasicRoute.getExternalRouteId(ExternalSystemTestEnum.CRM, "operation"), null)), nullValue()); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, AbstractBasicRoute.getOutRouteId(ServiceTestEnum.ACCOUNT, "operation"), null)), nullValue()); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, AbstractBasicRoute.getInRouteId(ServiceTestEnum.ACCOUNT, "operation"), null)), is(RouteTypeEnum.INPUT)); assertThat(routeDefinitionService.findRouteType(new RouteTypeInfo(null, null, AbstractBasicRoute.getInRouteId(ServiceTestEnum.CUSTOMER, "test"), null)), is(RouteTypeEnum.INPUT)); }