cancel
Showing results for 
Search instead for 
Did you mean: 

No tenant active. if you do not want to use tenants - problem

Former Member
0 Kudos
 java.lang.IllegalStateException: no tenant active. if you do not want to use tenants, call Registry.activateMasterTenant() to assure the Master tenant is active.

This is what I get from the sample Junit TestCase below when startetd in ee. In this test I'm using an external Oracle database running on our integration server.

Can you please provide some info on how to do unit / integration testing in eclise or intellij. Thanks.

 public class CustomerRegistrationIntegrationTest extends HybrisJUnit4TransactionalTest {
 
     @Before
     public void setUp() {Registry.activateMasterTenant();    }
 
     @After
     public void tearDown(){}
 
     /**
      * This is a sample test method.
      */
     @Test
     public void testMe() {
         final boolean testTrue = true;
         assertTrue("true is not true", testTrue);
     }
     
 }








Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I tried Anshuls idea yesterday but it went horribly wrong. We had to completely re-build our integration database.

Former Member
0 Kudos

@Konrad Thanks, I guess the OP wanted to reduce overall start up time. So far, my tests don't even run.

@Anshul I like your idea. Their might a be problem though with loosing our test data. What we do is we first create a customized dump based on our production environment which then gets re-imported into integration. So, maybe there is a way to integrate the junit tenant activation process into the current work flow without loosing any data.

Former Member
0 Kudos

We had similar errors for JUNITS when initiated from Ee, but JUNITS used to work when started from hMC (http://localhost:9001/test). Also review the exceptions in log file, it sometimes goes beyond "No tenant active" issue. For initiating JUNITs from ee, please ensure that you are including all required extensions configured in localextensions.xml file in the project selection box for test configuration. Ensure that the JUNIT tenant is initialized either through hMC or ant target invocation.

Former Member
0 Kudos

I have cleaned all the extensions which are imported into ee and after that i ran the Junit testcase directly from ee it has worked actually for me. Just make sure that you have initialized your database by activating junit tenent. There is one more way by which test case can be executed open the URL **http://localhost:9001/test** select your test file and then click the run button.

Former Member
0 Kudos