Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3ef95ee64089e78588bdf1e4d99c2cf1a83aeb41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (c) 2012, 2013 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.tests.offline;

import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.tests.AbstractSyncingTest;
import org.eclipse.emf.cdo.tests.model1.Company;
import org.eclipse.emf.cdo.transaction.CDOTransaction;

import org.eclipse.net4j.util.lifecycle.LifecycleUtil;

/**
 * Clone Repository doesn't retry to init root resource
 * <p>
 * See bug 376566.
 *
 * @author Eike Stepper
 */
public class Bugzilla_376566_Test extends AbstractSyncingTest
{
  @Override
  protected boolean isHinderInitialReplication()
  {
    return true;
  }

  public void testInitCloneWithoutMaster() throws Exception
  {
    InternalRepository clone = getRepository();
    sleep(2000);

    LifecycleUtil.deactivate(clone);
    getOfflineConfig().startMasterTransport();

    clone = getRepository();
    waitForOnline(clone);

    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();
    CDOResource resource = transaction.createResource(getResourcePath("/res1"));

    Company company = getModel1Factory().createCompany();
    resource.getContents().add(company);
    transaction.commit();
  }
}

Back to the top