@@ -0,0 +1,1982 @@
+package com.gentics.mesh.search.index;%0A%0Aimport static com.gentics.mesh.core.rest.MeshEvent.INDEX_SYNC_FINISHED;%0Aimport static com.gentics.mesh.test.ClientHelper.call;%0Aimport static com.gentics.mesh.test.context.ElasticsearchTestMode.CONTAINER;%0A%0Aimport org.junit.Test;%0A%0Aimport com.gentics.mesh.FieldUtil;%0Aimport com.gentics.mesh.core.rest.branch.BranchCreateRequest;%0Aimport com.gentics.mesh.core.rest.schema.impl.SchemaUpdateRequest;%0Aimport com.gentics.mesh.json.JsonUtil;%0Aimport com.gentics.mesh.parameter.client.SchemaUpdateParametersImpl;%0Aimport com.gentics.mesh.test.TestSize;%0Aimport com.gentics.mesh.test.context.AbstractMeshTest;%0Aimport com.gentics.mesh.test.context.MeshTestSetting;%0A%0A/**%0A * Test which will check how branch migrations and index sync work together.%0A */%0A@MeshTestSetting(elasticsearch = CONTAINER, testSize = TestSize.FULL, startServer = true)%0Apublic class BranchIndexSyncTest extends AbstractMeshTest %7B%0A%0A%09@Test%0A%09public void testSyncWithUnmigratedBranch() %7B%0A%09%09grantAdminRole();%0A%0A%09%09// 1. Create second branch%0A%09%09waitForJob(() -%3E %7B%0A%09%09%09BranchCreateRequest branchCreateRequest = new BranchCreateRequest();%0A%09%09%09branchCreateRequest.setLatest(true);%0A%09%09%09branchCreateRequest.setName(%22newBranch%22);%0A%09%09%09call(() -%3E client().createBranch(projectName(), branchCreateRequest));%0A%09%09%7D);%0A%0A%09%09// 2. Update the schema version without linking it to the branches%0A%09%09String contentSchemaUuid = tx(() -%3E schemaContainer(%22content%22).getUuid());%0A%09%09SchemaUpdateRequest request = JsonUtil.readValue(tx(() -%3E schemaContainer(%22content%22).getLatestVersion().getJson()),%0A%09%09%09SchemaUpdateRequest.class);%0A%09%09request.removeField(%22teaser%22);%0A%09%09request.addField(FieldUtil.createNumberFieldSchema(%22teaser%22));%0A%09%09call(() -%3E client().updateSchema(contentSchemaUuid, request, new SchemaUpdateParametersImpl().setUpdateAssignedBranches(false)));%0A%0A%09%09// 3. Invoke index sync%0A%09%09waitForEvent(INDEX_SYNC_FINISHED, () -%3E %7B%0A%09%09%09call(() -%3E client().invokeIndexClear());%0A%09%09%09call(() -%3E client().invokeIndexSync());%0A%09%09%7D);%0A%09%7D%0A%7D%0A

Add branch index sync test