Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.microsoft.azure.springcloudplayground.generator.ProjectRequest;
import com.microsoft.azure.springcloudplayground.github.GithubOperator;
import com.microsoft.azure.springcloudplayground.metadata.GeneratorMetadataProvider;
import com.microsoft.azure.springcloudplayground.module.ModuleNames;
import com.microsoft.azure.springcloudplayground.util.PropertyLoader;
import com.microsoft.azure.springcloudplayground.util.TelemetryProxy;
import com.samskivert.mustache.Mustache;
Expand Down Expand Up @@ -39,6 +40,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;

Expand Down Expand Up @@ -88,7 +90,11 @@ private void addBuildInformation(@NonNull Map<String, Object> model) {
private void triggerGenerateEvent(@NonNull List<MicroService> services) {
final Map<String, String> properties = new HashMap<>();

services.forEach(s -> properties.put(s.getName(), "selected"));
final List<String> allModules = ModuleNames.getModuleNames();
final List<String> selectModules =
services.stream().map(MicroService::getModules).flatMap(List::stream).collect(Collectors.toList());

allModules.forEach(m -> properties.putIfAbsent(m, String.valueOf(selectModules.contains(m))));

this.telemetryProxy.trackEvent(TELEMETRY_EVENT_GENERATE, properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import lombok.NoArgsConstructor;
import org.springframework.lang.NonNull;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.*;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ModuleNames {
Expand Down Expand Up @@ -36,6 +34,10 @@ public class ModuleNames {

public static final String AZURE_KEY_VAULT = "azure-keyvault-secrets";

private static final List<String> MODULE_NAMES = Arrays.asList(CLOUD_GATEWAY, CLOUD_CONFIG_SERVER,
CLOUD_EUREKA_SERVER, CLOUD_HYSTRIX_DASHBOARD, AZURE_CACHE, AZURE_COSMOSDB,
AZURE_STORAGE, AZURE_EVENTHUB_BINDER, AZURE_ACTIVE_DIRECTORY, AZURE_KEY_VAULT);

private static final Map<String, Module> NAME_TO_MODULE;

static {
Expand All @@ -56,6 +58,10 @@ public class ModuleNames {
NAME_TO_MODULE = Collections.unmodifiableMap(map);
}

public static List<String> getModuleNames() {
return MODULE_NAMES;
}

public static Module toModule(@NonNull String moduleName) {
Module module = NAME_TO_MODULE.get(moduleName);

Expand Down
Loading