use of zipkin2.Component in project powerbot by powerbot.
the class BankPin method poll.
@Override
public void poll() {
if (!ctx.widgets.widget(Constants.BANKPIN_WIDGET).valid()) {
if (threshold.contains(this)) {
threshold.remove(this);
}
return;
}
if (!threshold.contains(this)) {
threshold.add(this);
}
final String pin = getPin();
if (pin == null) {
ctx.controller.stop();
return;
}
for (final Component c : ctx.widgets.widget(Constants.BANKPIN_WIDGET).components()) {
if (c.textColor() != 0 || c.width() != 64 || c.height() != 64 || c.componentCount() != 2 || !c.visible()) {
continue;
}
final Component child = c.component(1);
if (!child.visible()) {
continue;
}
// TODO: re-evaluate this to get rid of count; or fail out
final String text = child.text();
if (text.equals("" + pin.charAt(count % 4))) {
if (c.click()) {
count++;
Condition.wait(new Condition.Check() {
public boolean poll() {
return !child.text().equals(text);
}
}, 100, 20);
}
}
}
}
use of zipkin2.Component in project powerbot by powerbot.
the class TicketDestroy method poll.
@Override
public void poll() {
if (ctx.properties.getProperty("key.token.disable", "").equals("true")) {
// TODO: review this random event
return;
}
final Item item = ctx.backpack.select().id(Constants.TICKETDESTROY_ITEMS).poll();
if (!item.valid() || !ctx.hud.opened(Hud.Window.BACKPACK) || !ctx.players.local().idle()) {
priority.set(0);
return;
}
priority.set(3);
if (!ctx.backpack.scroll(item)) {
return;
}
if (((ctx.varpbits.varpbit(1448) & 0xFF00) >>> 8) < (item.id() == Constants.TICKETDESTROY_ITEMS[0] ? 10 : 9)) {
item.interact("Claim");
return;
}
if (!item.interact("Destroy")) {
return;
}
final Widget widget = ctx.widgets.widget(1183);
if (!Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return widget.valid();
}
})) {
return;
}
Component component = null;
for (final Component c : widget.components()) {
if (c.visible() && c.tooltip().trim().equalsIgnoreCase("destroy")) {
component = c;
break;
}
}
if (component != null && component.interact("Destroy")) {
Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return item.component().itemId() == -1;
}
}, 175);
}
}
use of zipkin2.Component in project libSBOLj by SynBioDex.
the class ComponentDefinitionOutput method createComponentDefinitionOutput.
public static SBOLDocument createComponentDefinitionOutput() throws SBOLValidationException {
String prURI = "http://partsregistry.org/";
String prPrefix = "pr";
SBOLDocument document = new SBOLDocument();
document.setTypesInURIs(true);
document.addNamespace(URI.create(prURI), prPrefix);
document.setDefaultURIprefix(prURI);
Sequence seqpTetR = document.createSequence("BBa_R0040", "", "tccctatcagtgatagagattgacatccctatcagtgatagagatactgagcac", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
Sequence seqRbs = document.createSequence("BBa_B0034", "", "aaagaggagaaa", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
Sequence seqCds = document.createSequence("BBa_C0062", "", "atgcttatctgatatgactaaaatggtacattgtgaatattatttactcgcgatcatttatcctcattctatggttaaatctgatatttcaatcctagataattaccctaaaaaatggaggcaatattatgatgacgctaatttaataaaatatgatcctatagtagattattctaactccaatcattcaccaattaattggaatatatttgaaaacaatgctgtaaataaaaaatctccaaatgtaattaaagaagcgaaaacatcaggtcttatcactgggtttagtttccctattcatacggctaacaatggcttcggaatgcttagttttgcacattcagaaaaagacaactatatagatagtttatttttacatgcgtgtatgaacataccattaattgttccttctctagttgataattatcgaaaaataaatatagcaaataataaatcaaacaacgatttaaccaaaagagaaaaagaatgtttagcgtgggcatgcgaaggaaaaagctcttgggatatttcaaaaatattaggttgcagtgagcgtactgtcactttccatttaaccaatgcgcaaatgaaactcaatacaacaaaccgctgccaaagtatttctaaagcaattttaacaggagcaattgattgcccatactttaaaaattaataacactgatagtgctagtgtagatcac", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
Sequence seqTer = document.createSequence("BBa_B0015", "", "ccaggcatcaaataaaacgaaaggctcagtcgaaagactgggcctttcgttttatctgttgtttgtcggtgaacgctctctactagagtcacactggctcaccttcgggtgggcctttctgcgtttata", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
Sequence seqPluxR = document.createSequence("BBa_R0062", "", "acctgtaggatcgtacaggtttacgcaagaaaatggtttgttatagtcgaataaa", URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html"));
ComponentDefinition pTetR = document.createComponentDefinition("BBa_R0040", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
pTetR.addRole(SequenceOntology.PROMOTER);
pTetR.setName("pTetR");
pTetR.setDescription("TetR repressible promoter");
pTetR.addSequence(seqpTetR.getIdentity());
ComponentDefinition rbs = document.createComponentDefinition("BBa_B0034", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
rbs.addRole(SequenceOntology.RIBOSOME_ENTRY_SITE);
rbs.setName("BBa_B0034");
rbs.setDescription("RBS based on Elowitz repressilator");
rbs.addSequence(seqRbs.getIdentity());
ComponentDefinition cds = document.createComponentDefinition("BBa_C0062", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
cds.addRole(SequenceOntology.CDS);
cds.setName("luxR");
cds.setDescription("luxR coding sequence");
cds.addSequence(seqCds.getIdentity());
ComponentDefinition ter = document.createComponentDefinition("BBa_B0015", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
ter.addRole(URI.create("http://identifiers.org/so/SO:0000141"));
ter.setName("BBa_B0015");
ter.setDescription("Double terminator");
ter.addSequence(seqTer.getIdentity());
ComponentDefinition pluxR = document.createComponentDefinition("BBa_R0062", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
//
pluxR.addRole(SequenceOntology.PROMOTER);
pluxR.setName("pLuxR");
pluxR.setDescription("LuxR inducible promoter");
pluxR.addSequence(seqPluxR.getIdentity());
ComponentDefinition device = document.createComponentDefinition("BBa_F2620", "", new HashSet<URI>(Arrays.asList(ComponentDefinition.DNA)));
// biological region
device.addRole(URI.create("http://identifiers.org/so/SO:00001411"));
device.setName("BBa_F2620");
device.setDescription("3OC6HSL -> PoPS Receiver");
Component comPtetR = device.createComponent("pTetR", AccessType.PUBLIC, pTetR.getIdentity());
Component comRbs = device.createComponent("rbs", AccessType.PUBLIC, rbs.getIdentity());
Component comCds = device.createComponent("luxR", AccessType.PUBLIC, cds.getIdentity());
Component comTer = device.createComponent("ter", AccessType.PUBLIC, ter.getIdentity());
Component comPluxR = device.createComponent("pLuxR", AccessType.PUBLIC, pluxR.getIdentity());
int start = 1;
int end = seqPluxR.getElements().length();
SequenceAnnotation anno = device.createSequenceAnnotation("anno1", "location1", start, end, OrientationType.INLINE);
anno.setComponent(comPtetR.getIdentity());
start = end + 1;
end = seqRbs.getElements().length() + end + 1;
SequenceAnnotation anno2 = device.createSequenceAnnotation("anno2", "location2", start, end, OrientationType.INLINE);
anno2.setComponent(comRbs.getIdentity());
start = end + 1;
end = seqCds.getElements().length() + end + 1;
SequenceAnnotation anno3 = device.createSequenceAnnotation("anno3", "location3", start, end, OrientationType.INLINE);
anno3.setComponent(comCds.getIdentity());
start = end + 1;
end = seqTer.getElements().length() + end + 1;
SequenceAnnotation anno4 = device.createSequenceAnnotation("anno4", "location4", start, end, OrientationType.INLINE);
anno4.setComponent(comTer.getIdentity());
start = end + 1;
end = seqPluxR.getElements().length() + end + 1;
SequenceAnnotation anno5 = device.createSequenceAnnotation("anno5", "location5", start, end, OrientationType.INLINE);
anno5.setComponent(comPluxR.getIdentity());
return document;
}
use of zipkin2.Component in project zipkin-gcp by openzipkin.
the class SpanTranslatorTest method translate_clientSpan.
/**
* This test is intentionally sensitive, so changing other parts makes obvious impact here
*/
@Test
public void translate_clientSpan() {
Span zipkinSpan = Span.newBuilder().traceId("7180c278b62e8f6a216a2aea45d08fc9").parentId("6b221d5bc9e6496c").id("5b4185666d50f68b").name("get").kind(Span.Kind.CLIENT).localEndpoint(Endpoint.newBuilder().serviceName("frontend").build()).remoteEndpoint(Endpoint.newBuilder().serviceName("backend").ip("192.168.99.101").port(9000).build()).timestamp(// 1 second after epoch
1_000_000L).duration(123_456L).addAnnotation(1_123_000L, "foo").putTag("http.path", "/api").putTag("clnt/finagle.version", "6.45.0").build();
TraceSpan translated = SpanTranslator.translate(TraceSpan.newBuilder(), zipkinSpan).build();
assertThat(translated).isEqualTo(TraceSpan.newBuilder().setSpanId(Long.parseUnsignedLong(zipkinSpan.id(), 16) ^ 0x3f6a2ec3c810c2abL).setParentSpanId(Long.parseUnsignedLong(zipkinSpan.parentId(), 16)).setKind(TraceSpan.SpanKind.RPC_CLIENT).setName("get").setStartTime(Timestamp.newBuilder().setSeconds(1).build()).setEndTime(Timestamp.newBuilder().setSeconds(1).setNanos(123_456_000).build()).putLabels("zipkin.io/clnt/finagle.version", "6.45.0").putLabels("zipkin.io/http.path", "/api").putLabels("/component", "frontend").putLabels("zipkin.io/foo", "1970-01-01 (00:00:01.123)").build());
}
use of zipkin2.Component in project zipkin-gcp by openzipkin.
the class LabelExtractorTest method testComponentLabelIsSet.
@Test
public void testComponentLabelIsSet() {
LabelExtractor extractor = new LabelExtractor(Collections.<String, String>emptyMap(), "test.prefix");
Span clientSpan = Span.newBuilder().traceId("4").name("test-span").id("5").localEndpoint(Endpoint.newBuilder().serviceName("service1").build()).build();
Span serverSpan = Span.newBuilder().traceId("4").name("child-span").id("6").localEndpoint(Endpoint.newBuilder().serviceName("service2").build()).parentId("5").build();
Map<String, String> clientLabels = extractor.extract(clientSpan);
assertEquals("service1", clientLabels.get("/component"));
Map<String, String> serverLabels = extractor.extract(serverSpan);
assertEquals("service2", serverLabels.get("/component"));
}
Aggregations