SdkComponents { public String registerWindowingStrategy(WindowingStrategy<?, ?> windowingStrategy) throws IOException { String existing = windowingStrategyIds.get(windowingStrategy); if (existing != null) { return existing; } String baseName = String.format( "%s(%s)", NameUtils.approximateSimpleName(windowingStrategy), NameUtils.approximateSimpleName(windowingStrategy.getWindowFn())); String name = uniqify(baseName, windowingStrategyIds.values()); windowingStrategyIds.put(windowingStrategy, name); RunnerApi.WindowingStrategy windowingStrategyProto = WindowingStrategyTranslation.toProto(windowingStrategy, this); componentsBuilder.putWindowingStrategies(name, windowingStrategyProto); return name; } private  SdkComponents(
      @Nullable Components components,
      @Nullable Collection<String> requirements,
      String newIdPrefix); static SdkComponents create(); static SdkComponents create(
      RunnerApi.Components components, Collection<String> requirements); static SdkComponents create(PipelineOptions options); void mergeFrom(
      RunnerApi.Components components, @Nullable Collection<String> requirements); SdkComponents withNewIdPrefix(String newIdPrefix); String registerPTransform(
      AppliedPTransform<?, ?, ?> appliedPTransform, List<AppliedPTransform<?, ?, ?>> children); String getPTransformIdOrThrow(AppliedPTransform<?, ?, ?> appliedPTransform); String registerPCollection(PCollection<?> pCollection); String registerWindowingStrategy(WindowingStrategy<?, ?> windowingStrategy); String registerCoder(Coder<?> coder); String registerEnvironment(Environment env); String getOnlyEnvironmentId(); void addRequirement(String urn); RunnerApi.Components toComponents(); Collection<String> requirements();  }
@Test public void registerWindowingStrategy() throws IOException { WindowingStrategy<?, ?> strategy = WindowingStrategy.globalDefault().withMode(AccumulationMode.ACCUMULATING_FIRED_PANES); String name = components.registerWindowingStrategy(strategy); assertThat(name, not(isEmptyOrNullString())); components.toComponents().getWindowingStrategiesOrThrow(name); }
@Test public void registerWindowingStrategyIdEqualStrategies() throws IOException { WindowingStrategy<?, ?> strategy = WindowingStrategy.globalDefault().withMode(AccumulationMode.ACCUMULATING_FIRED_PANES); String name = components.registerWindowingStrategy(strategy); String duplicateName = components.registerWindowingStrategy( WindowingStrategy.globalDefault().withMode(AccumulationMode.ACCUMULATING_FIRED_PANES)); assertThat(name, equalTo(duplicateName)); }