@Test void migrate() { final Map<String, String> migrated = base .path("component/migrate/{id}/{version}") .resolveTemplate("id", client.getJdbcId()) .resolveTemplate("version", 1) .request(APPLICATION_JSON_TYPE) .post(entity(new HashMap<String, String>() { { } }, APPLICATION_JSON_TYPE), new GenericType<Map<String, String>>() { }); assertEquals(1, migrated.size()); assertEquals("true", migrated.get("migrated")); }
@Override public Map<String, String> migrate(final String id, final int version, final Map<String, String> config) { if (virtualComponents.isExtensionEntity(id)) { return config; } return ofNullable(componentDao.findById(id)) .orElseThrow(() -> new WebApplicationException(Response .status(Response.Status.NOT_FOUND) .entity(new ErrorPayload(ErrorDictionary.COMPONENT_MISSING, "Didn't find component " + id)) .build())) .getMigrationHandler() .get() .migrate(version, config); }
ComponentResourceImpl implements ComponentResource { @Override public Map<String, String> migrate(final String id, final int version, final Map<String, String> config) { if (virtualComponents.isExtensionEntity(id)) { return config; } return ofNullable(componentDao.findById(id)) .orElseThrow(() -> new WebApplicationException(Response .status(Response.Status.NOT_FOUND) .entity(new ErrorPayload(ErrorDictionary.COMPONENT_MISSING, "Didn't find component " + id)) .build())) .getMigrationHandler() .get() .migrate(version, config); } }
ComponentResourceImpl implements ComponentResource { @Override public Map<String, String> migrate(final String id, final int version, final Map<String, String> config) { if (virtualComponents.isExtensionEntity(id)) { return config; } return ofNullable(componentDao.findById(id)) .orElseThrow(() -> new WebApplicationException(Response .status(Response.Status.NOT_FOUND) .entity(new ErrorPayload(ErrorDictionary.COMPONENT_MISSING, "Didn't find component " + id)) .build())) .getMigrationHandler() .get() .migrate(version, config); }  }
ComponentResourceImpl implements ComponentResource { @Override public Map<String, String> migrate(final String id, final int version, final Map<String, String> config) { if (virtualComponents.isExtensionEntity(id)) { return config; } return ofNullable(componentDao.findById(id)) .orElseThrow(() -> new WebApplicationException(Response .status(Response.Status.NOT_FOUND) .entity(new ErrorPayload(ErrorDictionary.COMPONENT_MISSING, "Didn't find component " + id)) .build())) .getMigrationHandler() .get() .migrate(version, config); }  void clearCache(@Observes final DeployedComponent deployedComponent); @Override Dependencies getDependencies(final String[] ids); @Override StreamingOutput getDependency(final String id); @Override ComponentIndices getIndex(final String language, final boolean includeIconContent, final String query); @Override Response familyIcon(final String id); @Override Response icon(final String id); @Override Map<String, String> migrate(final String id, final int version, final Map<String, String> config); @Override // TODO: max ids.length ComponentDetailList getDetail(final String language, final String[] ids); }
ComponentResourceImpl implements ComponentResource { @Override public Map<String, String> migrate(final String id, final int version, final Map<String, String> config) { if (virtualComponents.isExtensionEntity(id)) { return config; } return ofNullable(componentDao.findById(id)) .orElseThrow(() -> new WebApplicationException(Response .status(Response.Status.NOT_FOUND) .entity(new ErrorPayload(ErrorDictionary.COMPONENT_MISSING, "Didn't find component " + id)) .build())) .getMigrationHandler() .get() .migrate(version, config); }  void clearCache(@Observes final DeployedComponent deployedComponent); @Override Dependencies getDependencies(final String[] ids); @Override StreamingOutput getDependency(final String id); @Override ComponentIndices getIndex(final String language, final boolean includeIconContent, final String query); @Override Response familyIcon(final String id); @Override Response icon(final String id); @Override Map<String, String> migrate(final String id, final int version, final Map<String, String> config); @Override // TODO: max ids.length ComponentDetailList getDetail(final String language, final String[] ids);  }