use of io.fabric8.annotations.Path 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.annotations.Path in project fabric8 by jboss-fuse.
the class FabricGitFacade method write.
@Override
public CommitInfo write(final String branch, final String path, final String commitMessage, final String authorName, final String authorEmail, final String contents) {
assertValid();
final PersonIdent personIdent = new PersonIdent(authorName, authorEmail);
return gitWriteOperation(personIdent, new GitOperation<CommitInfo>() {
public CommitInfo call(Git git, GitContext context) throws Exception {
checkoutBranch(git, branch);
File rootDir = getRootGitDirectory(git);
byte[] data = contents.getBytes();
CommitInfo answer = doWrite(git, rootDir, branch, path, data, personIdent, commitMessage);
context.commitMessage(commitMessage);
return answer;
}
});
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class FabricGitFacade method writeBase64.
@Override
public CommitInfo writeBase64(final String branch, final String path, final String commitMessage, final String authorName, final String authorEmail, final String contents) {
assertValid();
final PersonIdent personIdent = new PersonIdent(authorName, authorEmail);
return gitWriteOperation(personIdent, new GitOperation<CommitInfo>() {
public CommitInfo call(Git git, GitContext context) throws Exception {
checkoutBranch(git, branch);
File rootDir = getRootGitDirectory(git);
byte[] data = Base64.decode(contents);
CommitInfo answer = doWrite(git, rootDir, branch, path, data, personIdent, commitMessage);
context.commitMessage(commitMessage);
return answer;
}
});
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class AgentUtils method storeInDefaultKarafRepository.
/**
* Tries to store resource resolved by some {@link StreamProvider} into karaf default repository
* @param finalTargetLocation
* @param file
* @param uri
*/
private static void storeInDefaultKarafRepository(File finalTargetLocation, File file, String uri) {
if (finalTargetLocation != null && file != null && file.isFile()) {
try {
String path = Utils.mvnurlToPath(uri);
if (path != null) {
File target = new File(finalTargetLocation, path);
if (!target.isFile()) {
LOGGER.info("Copying resolved {} to {}", file, finalTargetLocation);
target.getParentFile().mkdirs();
Files.copy(file, target);
}
} else {
LOGGER.warn("Can't resolve Maven URI {} to path", uri);
}
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class FileWatcherDynamicCompiler method removeCompilePath.
protected void removeCompilePath(Path path) {
try {
String url = toUrlString(path);
Path old = urlMap.remove(url);
if (old != null) {
scheduleRecompile();
}
} catch (MalformedURLException e) {
LOG.warn("Ignored path " + path + " due to: " + e, e);
}
}
Aggregations