Source:
<code>public void attachNodeFailAtPrepare() throws Exception { startNode(1, 1); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(1))); startNode(1, 2); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(1))); assertThat(configToolInvocation("attach", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 2)), is(successful())); activateCluster(); assertThat(configToolInvocation("set", "-s", "localhost:" + getNodePort(1, 1), "-c", "stripe.1.node.1.tc-properties.attachStatus=prepareAddition-failure"), is(successful())); startNode(1, 3); waitUntil(out.getLog(1, 3), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); assertThat( configToolInvocation("attach", "-f", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 3)), containsOutput("Two-Phase commit failed")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); <START> assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); <END> }</code><technical_language>verify 2 nodes activated, one: withTopologyService(1, 1, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 2, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 3, topologyService -> assertFalse(topologyService.isActivated()));</technical_language>

Target:
public void attachNodeFailAtPrepare() throws Exception { startNode(1, 1); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(1))); startNode(1, 2); waitUntil(out.getLog(1, 1), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(1))); assertThat(configToolInvocation("attach", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 2)), is(successful())); activateCluster(); assertThat(configToolInvocation("set", "-s", "localhost:" + getNodePort(1, 1), "-c", "stripe.1.node.1.tc-properties.attachStatus=prepareAddition-failure"), is(successful())); startNode(1, 3); waitUntil(out.getLog(1, 3), containsLog("Started the server in diagnostic mode")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); assertThat( configToolInvocation("attach", "-f", "-d", "localhost:" + getNodePort(1, 1), "-s", "localhost:" + getNodePort(1, 3)), containsOutput("Two-Phase commit failed")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); withTopologyService(1, 1, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 2, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 3, topologyService -> assertFalse(topologyService.isActivated())); }