de.flapdoodle.embed.process.distribution.Distribution Java Examples
The following examples show how to use
de.flapdoodle.embed.process.distribution.Distribution.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Mongo42xPaths.java From mongodb-aggregate-query-support with Apache License 2.0 | 6 votes |
private String getPlattformString(Distribution distribution) { String splatform; switch (distribution.getPlatform()) { case Linux: splatform = "linux"; break; case Windows: splatform = "win32"; break; case OS_X: splatform = "osx"; break; case Solaris: splatform = "sunos5"; break; case FreeBSD: splatform = "freebsd"; break; default: throw new IllegalArgumentException("Unknown Platform " + distribution.getPlatform()); } return splatform; }
Example #2
Source File: EmbeddedMongoHelper.java From edison-microservice with Apache License 2.0 | 6 votes |
public static void startMongoDB() throws IOException { if (!started.compareAndSet(false, true)) { throw new RuntimeException("Embedded mongo already running, call stopMongoDB before starting it again!"); } final String bindIp = "localhost"; try { final int port = Network.getFreeServerPort(); final IMongodConfig mongodConfig = new MongodConfigBuilder() .version(Version.Main.PRODUCTION) .net(new Net(bindIp, port, Network.localhostIsIPv6())) .build(); final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder() .defaultsWithLogger(Command.MongoD, LOG) .build()); mongodExecutable = runtime.prepare(mongodConfig, Distribution.detectFor(Version.Main.PRODUCTION)); mongodProcess = mongodExecutable.start(); mongoClient = new MongoClient(bindIp, port); } catch (final IOException e) { stopMongoDB(); throw e; } }
Example #3
Source File: StaticArtifactStore.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public IExtractedFileSet load(Distribution key) throws IOException { if (!store.checkDistribution(key)) { return SENTINEL; } return store.extractFileSet(key); }
Example #4
Source File: StaticArtifactStore.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public IExtractedFileSet extractFileSet(Distribution distribution) throws IOException { IExtractedFileSet fileSet = getFileSet(distribution); if (fileSet == SENTINEL) { throw new IllegalArgumentException("No file set found for distribution " + distribution); } return fileSet; }
Example #5
Source File: StaticArtifactStore.java From dremio-oss with Apache License 2.0 | 5 votes |
private IExtractedFileSet getFileSet(Distribution distribution) throws IOException { try { return distributions.get(distribution); } catch (ExecutionException e) { Throwables.propagateIfPossible(e.getCause(), IOException.class); throw new RuntimeException(e.getCause()); } }
Example #6
Source File: Mongo42xDownloadPath.java From mongodb-aggregate-query-support with Apache License 2.0 | 5 votes |
@Override public String getPath(Distribution distribution) { if (distribution.getPlatform() == Platform.Windows) { return "https://downloads.mongodb.org/"; } else if(distribution.getPlatform() == Platform.Linux) { // right now build this for travisci - won't work for other distributions. return "http://downloads.mongodb.org/"; } else { return "https://fastdl.mongodb.org/"; } }
Example #7
Source File: Mongo42xPaths.java From mongodb-aggregate-query-support with Apache License 2.0 | 5 votes |
@Override public String getPath(Distribution distribution) { String versionStr = getVersionPart(distribution.getVersion()); if (distribution.getPlatform() == Platform.Solaris && isFeatureEnabled(distribution, Feature.NO_SOLARIS_SUPPORT)) { throw new IllegalArgumentException("Mongodb for solaris is not available anymore"); } ArchiveType archiveType = getArchiveType(distribution); String archiveTypeStr = getArchiveString(archiveType); String platformStr = getPlattformString(distribution); String bitSizeStr = getBitSize(distribution); if ((distribution.getBitsize() == BitSize.B64) && (distribution.getPlatform() == Platform.Windows)) { versionStr = (useWindows2008PlusVersion(distribution) ? "2008plus-": "") + (withSsl(distribution) ? "ssl-": "") + versionStr; } if (distribution.getPlatform() == Platform.OS_X && withSsl(distribution) ) { return platformStr + "/mongodb-macos" + "-ssl-" + bitSizeStr + "-" + versionStr + "." + archiveTypeStr; } else if(distribution.getPlatform() == Platform.OS_X && !withSsl(distribution) ) { return platformStr + "/mongodb-macos" + "-" + bitSizeStr + "-" + versionStr + "." + archiveTypeStr; } else { String osDist = System.getenv("OS_DIST"); if(distribution.getPlatform() == Platform.Linux && "ubuntu1604".equalsIgnoreCase(osDist)) { // right now build this for travisci //http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.2.4.tgz log.error("Downloading Mongo 4.2.4 for Ubuntu 16.04"); return "linux/mongodb-linux-x86_64-ubuntu1604-4.2.4.tgz"; } } return super.getPath(distribution); }
Example #8
Source File: Mongo42xPaths.java From mongodb-aggregate-query-support with Apache License 2.0 | 5 votes |
private String getBitSize(Distribution distribution) { String sbitSize; switch (distribution.getBitsize()) { case B32: if (distribution.getVersion() instanceof IFeatureAwareVersion) { IFeatureAwareVersion featuredVersion = (IFeatureAwareVersion) distribution.getVersion(); if (featuredVersion.enabled(Feature.ONLY_64BIT)) { throw new IllegalArgumentException("this version does not support 32Bit: "+distribution); } } switch (distribution.getPlatform()) { case Linux: sbitSize = "i686"; break; case Windows: case OS_X: sbitSize = "i386"; break; default: throw new IllegalArgumentException("Platform " + distribution.getPlatform() + " not supported yet on 32Bit Platform"); } break; case B64: sbitSize = "x86_64"; break; default: throw new IllegalArgumentException("Unknown BitSize " + distribution.getBitsize()); } return sbitSize; }
Example #9
Source File: ExampleMongoConfiguration.java From edison-microservice with Apache License 2.0 | 5 votes |
@Bean public MongoClient mongoClient(final MongoProperties mongoProperties) throws IOException { String bindIp = mongoProperties.getHost()[0]; int port = Network.getFreeServerPort(); IMongodConfig mongodConfig = new MongodConfigBuilder() .version(Version.Main.PRODUCTION) .net(new Net(bindIp, port, Network.localhostIsIPv6())) .build(); final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder() .defaultsWithLogger(Command.MongoD, LOG) .build()); MongodExecutable mongodExecutable = runtime.prepare(mongodConfig, Distribution.detectFor(Version.Main.PRODUCTION)); mongodExecutable.start(); return new MongoClient(bindIp, port); }
Example #10
Source File: StaticArtifactStore.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public void onRemoval(RemovalNotification<Distribution, IExtractedFileSet> notification) { store.removeFileSet(notification.getKey(), notification.getValue()); }
Example #11
Source File: StaticArtifactStore.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public boolean checkDistribution(Distribution distribution) throws IOException { return getFileSet(distribution) != SENTINEL; }
Example #12
Source File: StaticArtifactStore.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public void removeFileSet(Distribution distribution, IExtractedFileSet files) { // do nothing }
Example #13
Source File: Mongo42xPaths.java From mongodb-aggregate-query-support with Apache License 2.0 | 4 votes |
@SuppressWarnings("SameParameterValue") private static boolean isFeatureEnabled(Distribution distribution, Feature feature) { return (distribution.getVersion() instanceof IFeatureAwareVersion && ((IFeatureAwareVersion) distribution.getVersion()).enabled(feature)); }