use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class ZooKeeperGroupTest method setUp.
@Before
public void setUp() throws Exception {
int port = findFreePort();
curator = CuratorFrameworkFactory.builder().connectString("localhost:" + port).retryPolicy(new RetryOneTime(1)).build();
// curator.start();
group = new ZooKeeperGroup<>(curator, PATH, NodeState.class);
// group.start();
// Starting curator and group is not necessary for the current tests.
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class GitDataStoreImplTestSupport method createGitDataStore.
protected GitDataStoreImpl createGitDataStore() throws Exception {
RuntimeProperties runtimeProperties = createMockRuntimeProperties();
CreateEnsembleOptions ensembleOptions = CreateEnsembleOptions.builder().zookeeperPassword("admin").build();
recursiveDelete(runtimeProperties.getDataPath().toFile());
BootstrapConfiguration.DataStoreOptions options = new BootstrapConfiguration.DataStoreOptions("root", new File("target/test-container"), zkURL, ensembleOptions);
runtimeProperties.putRuntimeAttribute(DataStoreTemplate.class, new DataStoreBootstrapTemplate(options));
FabricGitServiceImpl fabricGitService = new FabricGitServiceImpl();
fabricGitService.bindRuntimeProperties(runtimeProperties);
fabricGitService.activate();
ComponentConfigurer componentConfigurer = new ComponentConfigurer();
componentConfigurer.activate(null);
ZkDataStoreImpl zkDataStore = new ZkDataStoreImpl() {
@Override
public String getDefaultVersion() {
return "1.0";
}
};
zkDataStore.bindCurator(curator);
zkDataStore.bindRuntimeProperties(runtimeProperties);
zkDataStore.activateComponent();
final GitDataStoreImpl gitDataStore = new GitDataStoreImpl();
gitDataStore.bindConfigurer(componentConfigurer);
gitDataStore.bindGitService(fabricGitService);
gitDataStore.bindRuntimeProperties(runtimeProperties);
gitDataStore.bindGitProxyService(new GitProxyRegistrationHandler());
gitDataStore.bindCurator(curator);
gitDataStore.bindDataStore(zkDataStore);
gitDataStore.activate(new HashMap<String, Object>());
return gitDataStore;
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class FeatureResource method build.
public static FeatureResource build(Feature feature, String featureRange, Map<String, ? extends Resource> locToRes) throws BundleException {
FeatureResource resource = new FeatureResource(feature);
for (BundleInfo info : feature.getBundles()) {
if (!info.isDependency()) {
Resource res = locToRes.get(info.getLocation());
if (res == null) {
throw new IllegalStateException("Resource not found for url " + info.getLocation());
}
addIdentityRequirement(resource, res);
}
}
for (Dependency dep : feature.getDependencies()) {
if (!dep.isDependency()) {
addDependency(resource, dep, featureRange);
}
}
for (Capability cap : feature.getCapabilities()) {
resource.addCapabilities(ResourceBuilder.parseCapability(resource, cap.getValue()));
}
for (Requirement req : feature.getRequirements()) {
resource.addRequirements(ResourceBuilder.parseRequirement(resource, req.getValue()));
}
return resource;
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class FeatureResource method build.
public static FeatureResource build(Feature feature, Conditional conditional, String featureRange, Map<String, ? extends Resource> locToRes) throws BundleException {
Feature fcond = conditional.asFeature(feature.getName(), feature.getVersion());
FeatureResource resource = build(fcond, featureRange, locToRes);
for (String cond : conditional.getCondition()) {
if (cond.startsWith("req:")) {
cond = cond.substring("req:".length());
List<org.osgi.resource.Requirement> reqs = ResourceBuilder.parseRequirement(resource, cond);
resource.addRequirements(reqs);
} else {
Dependency dep = new Dependency();
String[] p = cond.split("/");
dep.setName(p[0]);
if (p.length > 1) {
dep.setVersion(p[1]);
}
addDependency(resource, dep, featureRange, true);
}
}
Dependency dep = new Dependency();
dep.setName(feature.getName());
dep.setVersion(feature.getVersion());
addDependency(resource, dep, featureRange, true);
return resource;
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class ZookeeperPortServiceTest method init.
@Before
public void init() throws Exception {
int port = findFreePort();
cnxnFactory = startZooKeeper(port);
curator1 = CuratorFrameworkFactory.builder().connectString("localhost:" + port).retryPolicy(new RetryOneTime(1000)).build();
curator1.start();
curator1.getZookeeperClient().blockUntilConnectedOrTimedOut();
curator1.create().creatingParentsIfNeeded().forPath("/fabric/registry/ports/ip/localhost", new byte[0]);
curator2 = CuratorFrameworkFactory.builder().connectString("localhost:" + port).retryPolicy(new RetryOneTime(1000)).build();
curator2.start();
curator2.getZookeeperClient().blockUntilConnectedOrTimedOut();
portService1 = new ZookeeperPortService();
portService1.bindCurator(curator1);
portService1.activate();
portService2 = new ZookeeperPortService();
portService2.bindCurator(curator2);
portService2.activate();
c1 = Mockito.mock(Container.class);
c2 = Mockito.mock(Container.class);
Mockito.when(c1.getIp()).thenReturn("localhost");
Mockito.when(c1.getId()).thenReturn("c1");
Mockito.when(c2.getIp()).thenReturn("localhost");
Mockito.when(c2.getId()).thenReturn("c2");
}
Aggregations