@Override public ApplicationInfo getApplicationInfo( String applicationName ) throws Exception { if ( applicationName == null ) { return null; } UUID applicationId = emf.lookupApplication(applicationName); if ( applicationId == null ) { return null; } return new ApplicationInfo( applicationId, applicationName.toLowerCase() ); }
private void checkApplicationsBroken( List<Entity> deletedApps ) throws Exception { if (logger.isDebugEnabled()) { logger.debug("\n\nChecking applications broken\n"); } for ( Entity applicationInfo : deletedApps ) { String appName = applicationInfo.getName(); boolean isPresent = setup.getEmf().lookupApplication( appName ) != null; // missing application_info does not completely break applications, but we... assertFalse("Should not be able to lookup deleted application by name" + appName, isPresent); } }
@Test public void testCreateAndImmediateGet() throws Exception { String random = RandomStringUtils.randomAlphabetic(10); String orgName = "org_" + random; String appName = "app_" + random; String orgAppName = orgName + "/" + appName; UUID appId = setup.createApplication(orgName, appName); UUID lookedUpId = setup.getEmf().lookupApplication( orgAppName ); Assert.assertEquals(appId, lookedUpId); }
private void checkApplicationsOk( String orgName) throws Exception { if (logger.isDebugEnabled()) { logger.debug("\n\nChecking applications OK\n"); } for (int i=0; i<10; i++) { String appName = orgName + "/application" + i; UUID uuid = setup.getEmf().lookupApplication(appName); assertTrue ("Should be able to get application", uuid != null ); EntityManager em = setup.getEmf().getEntityManager( uuid ); Application app = em.getApplication(); assertEquals( appName, app.getName() ); Results results = em.searchCollection( em.getApplicationRef(), "things", Query.fromQL("select *")); assertEquals( "Should have 10 entities", 10, results.size() ); } }
if ( setup.getEmf().lookupApplication( orgName + "/" + appName ) != null ) { break; found = setup.getEmf().lookupApplication( orgName + "/" + appName ) != null; assertTrue(setup.getEmf().lookupApplication( orgName + "/" + appName ) != null );
if ( emf.lookupApplication( app.getName() ) != null ) { throw new ConflictException("Cannot restore application, one with that name already exists.");