Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kieker-TeeTime-Stages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeeTime
Kieker-TeeTime-Stages
Commits
91d626b2
Commit
91d626b2
authored
8 years ago
by
Lars Erik Blümke
Browse files
Options
Downloads
Patches
Plain Diff
registry records can be detected
parent
fe022edc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/kieker/analysis/plugin/reader/amqp/AMQPReaderTest.java
+32
-24
32 additions, 24 deletions
...va/kieker/analysis/plugin/reader/amqp/AMQPReaderTest.java
with
32 additions
and
24 deletions
src/test/java/kieker/analysis/plugin/reader/amqp/AMQPReaderTest.java
+
32
−
24
View file @
91d626b2
...
...
@@ -5,14 +5,11 @@ import static teetime.framework.test.StageTester.test;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.ObjectOutputStream
;
import
java.net.URISyntaxException
;
import
java.nio.ByteBuffer
;
import
java.security.KeyManagementException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.concurrent.TimeoutException
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
@@ -40,6 +37,7 @@ public class AMQPReaderTest {
private
final
String
queueName
=
"testQueue"
;
private
final
int
heartbeat
=
60
;
private
final
Log
log
=
LogFactory
.
getLog
(
this
.
getClass
().
getName
());
ILookup
<
String
>
stringRegistry
=
new
Lookup
<
String
>();
// AMQP connection parts
private
Connection
connection
;
...
...
@@ -61,40 +59,50 @@ public class AMQPReaderTest {
public
void
initializeAMQPReader
()
{
amqpReader
=
new
AMQPReader
(
uri
,
queueName
,
heartbeat
,
log
);
record
=
new
CPUUtilizationRecord
(
timestamp
,
hostname
,
cpuID
,
user
,
system
,
wait
,
nice
,
irq
,
totalUtilisation
,
idle
);
registryRecord
=
new
RegistryRecord
(
0xFFFFFFFF
,
"holla"
);
}
registryRecord
=
new
RegistryRecord
(-
1
,
"holla"
);
@Test
public
void
simpleAMQPTest
()
{
new
ReaderThread
().
start
();
try
{
connection
=
createConnection
();
final
ConnectionFactory
connectionFactory
=
new
ConnectionFactory
();
connectionFactory
.
setUri
(
this
.
uri
);
connectionFactory
.
setRequestedHeartbeat
(
this
.
heartbeat
);
connection
=
connectionFactory
.
newConnection
();
channel
=
connection
.
createChannel
();
channel
.
queueDeclare
(
queueName
,
false
,
false
,
false
,
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
simpleAMQPTest
()
{
// Sending the test record as a byte array
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
1000
);
registryRecord
.
writeBytes
(
buffer
,
stringRegistry
);
ILookup
<
String
>
stringRegistry
=
new
Lookup
<
String
>();
// Sending the test record as a byte array
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
1000
);
registryRecord
.
writeBytes
(
buffer
,
stringRegistry
);
System
.
out
.
println
(
"RecordType before sending "
+
buffer
.
get
()
+
buffer
.
get
()
+
buffer
.
get
());
// channel.basicPublish("", queueName, null, buffer);
try
{
System
.
out
.
println
(
"RecordType before sending "
+
buffer
.
array
()[
0
]);
channel
.
basicPublish
(
""
,
queueName
,
null
,
buffer
.
array
());
System
.
out
.
println
(
"Sent record"
);
channel
.
close
();
connection
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
Connection
createConnection
()
throws
IOException
,
TimeoutException
,
KeyManagementException
,
NoSuchAlgorithmException
,
URISyntaxException
{
final
ConnectionFactory
connectionFactory
=
new
ConnectionFactory
();
connectionFactory
.
setUri
(
this
.
uri
);
connectionFactory
.
setRequestedHeartbeat
(
this
.
heartbeat
);
}
return
connectionFactory
.
newConnection
();
@After
public
void
closeConnection
()
{
try
{
channel
.
close
();
connection
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
byte
[]
serialize
(
final
Object
object
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment