ProActiveRuntimeImpl extends RuntimeRegistrationEventProducerImpl implements ProActiveRuntime, LocalProActiveRuntime { String guessProActiveHomeFromJarClassloader(String path) throws ProActiveException { int begin = path.indexOf("file:"); int end = path.indexOf(".jar!"); if (begin != 0 || end < 0) { throw new ProActiveException("Unable to find ProActive home. Bad jar url: " + path); } end = path.indexOf("dist/lib/ProActive.jar!"); if (end < 0) { end = path.indexOf("dist/lib/programming-core"); if (end < 0) { throw new ProActiveException("Unable to find ProActive home. Unexpected jar name: " + path); } } try { File padir = new File(new URI(path.substring(begin, end))); return padir.getCanonicalPath(); } catch (URISyntaxException e) { throw new ProActiveException(e); } catch (IOException e) { throw new ProActiveException(e); } } protected  ProActiveRuntimeImpl(); static ProActiveRuntimeImpl getProActiveRuntime(); void startJMXServerConnector(); @Override ProActiveRuntimeWrapperMBean getMBean(); @Override String getMBeanServerName(); @Override ServerConnector getJMXServerConnector(); @Override void registerLocalVirtualNode(VirtualNodeInternal vn, String vnName); @Override void setParent(ProActiveRuntime parentPARuntime); void registerDescriptor(String url, ProActiveDescriptorInternal pad); @Override ProActiveDescriptorInternal getDescriptor(String url, boolean isHierarchicalSearch); void removeDescriptor(String url); @Override Node createLocalNode(String nodeName, boolean replacePreviousBinding, String vnName); @Override Node createGCMNode(String vnName, List<TechnicalService> tsList); @Override void killAllNodes(); @Override void killNode(String nodeName); @Override void createVM(UniversalProcess remoteProcess); @Override String[] getLocalNodeNames(); Collection<LocalNode> getLocalNodes(); @Override VMInformation getVMInformation(); @Override void register(ProActiveRuntime proActiveRuntimeDist, String proActiveRuntimeName, String creatorID,
            String creationProtocol, String vmName); @Override void unregister(ProActiveRuntime proActiveRuntimeDist, String proActiveRuntimeUrl, String creatorID,
            String creationProtocol, String vmName); @Override ProActiveRuntime[] getProActiveRuntimes(); @Override ProActiveRuntime getProActiveRuntime(String proActiveRuntimeName); @Override synchronized void killRT(boolean softly); synchronized void cleanJvmFromPA(); @Override String getURL(); @Override List<UniversalBody> getActiveObjects(String nodeName); @Override VirtualNodeInternal getVirtualNode(String virtualNodeName); @Override void registerVirtualNode(String virtualNodeName, boolean replacePreviousBinding); @Override void unregisterVirtualNode(String virtualNodeName); @Override void unregisterAllVirtualNodes(); @Override @SuppressWarnings("unchecked") List<UniversalBody> getActiveObjects(String nodeName, String className); @Override UniversalBody createBody(String nodeName, ConstructorCall bodyConstructorCall, boolean isLocal); synchronized byte[] getClassData(String className); void launchMain(String className, String[] parameters); void newRemote(String className); String getVNName(String nodename); Object setLocalNodeProperty(String nodeName, String key, String value); String getLocalNodeProperty(String nodeName, String key); RemoteObjectExposer<ProActiveRuntime> getRemoteObjectExposer(); String[] getURLs(); void setCapacity(long capacity); void register(GCMRuntimeRegistrationNotificationData notification); FileTransferEngine getFileTransferEngine(); void addDeployment(long deploymentId); void setDeploymentId(long deploymentId); void setTopologyId(long toplogyId); void setVMName(String vmName); String getProActiveHome(); @Override String getThreadDump();  }
@Test public void testGetProActiveHome_Undefined_PAHOME_ProActiveJar() throws Exception { String proActiveHome = new ProActiveRuntimeImpl().guessProActiveHomeFromJarClassloader(new URL("jar:file:/tmp/dist/lib/ProActive.jar!/MyClass.class").getPath()); assertEquals(new File("/tmp").getCanonicalPath(), proActiveHome); }
@Test public void testGetProActiveHome_Undefined_PAHOME_GradleJars() throws Exception { String proActiveHome = new ProActiveRuntimeImpl().guessProActiveHomeFromJarClassloader(new URL("jar:file:/tmp/dist/lib/programming-core-2.4.2.jar!/MyClass.class").getPath()); assertEquals(new File("/tmp").getCanonicalPath(), proActiveHome); }