SdkComponents { public String registerPTransform( AppliedPTransform<?, ?, ?> appliedPTransform, List<AppliedPTransform<?, ?, ?>> children) throws IOException { String name = getApplicationName(appliedPTransform); if (componentsBuilder.getTransformsOrDefault(name, null) != null) { return name; } checkNotNull(children, "child nodes may not be null"); componentsBuilder.putTransforms( name, PTransformTranslation.toProto(appliedPTransform, children, this)); 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 registerTransformNullComponents() throws IOException { Create.Values<Integer> create = Create.of(1, 2, 3); PCollection<Integer> pt = pipeline.apply(create); String userName = "my_transform/my_nesting"; AppliedPTransform<?, ?, ?> transform = AppliedPTransform.of(userName, pipeline.begin().expand(), pt.expand(), create, pipeline); thrown.expect(NullPointerException.class); thrown.expectMessage("child nodes may not be null"); components.registerPTransform(transform, null); }
@Test public void registerTransformWithUnregisteredChildren() throws IOException { Create.Values<Long> create = Create.of(1L, 2L, 3L); GenerateSequence createChild = GenerateSequence.from(0); PCollection<Long> pt = pipeline.apply(create); String userName = "my_transform"; String childUserName = "my_transform/my_nesting"; AppliedPTransform<?, ?, ?> transform = AppliedPTransform.of(userName, pipeline.begin().expand(), pt.expand(), create, pipeline); AppliedPTransform<?, ?, ?> childTransform = AppliedPTransform.of( childUserName, pipeline.begin().expand(), pt.expand(), createChild, pipeline); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(childTransform.toString()); components.registerPTransform(transform, Collections.singletonList(childTransform)); }