Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Fess Search engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
Fess Search engine
Commits
07ec5574
Commit
07ec5574
authored
2 years ago
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
remove noindex tests
parent
bc0eb2e6
No related branches found
Branches containing commit
No related tags found
1 merge request
!3
ignore meta tags
Pipeline
#8705
passed
2 years ago
Stage: build-package
Stage: build-container
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/codelibs/fess/crawler/transformer/FessXpathTransformerTest.java
+1
-255
1 addition, 255 deletions
...bs/fess/crawler/transformer/FessXpathTransformerTest.java
with
1 addition
and
255 deletions
src/test/java/org/codelibs/fess/crawler/transformer/FessXpathTransformerTest.java
+
1
−
255
View file @
07ec5574
...
...
@@ -273,261 +273,7 @@ public class FessXpathTransformerTest extends UnitFessTestCase {
final
String
output
=
getXmlString
(
pruneNode
).
replaceAll
(
".*<BODY>"
,
""
).
replaceAll
(
"</BODY>.*"
,
""
);
assertEquals
(
"foo1<!--googleoff: index--><A href=\"index.html\"></A><!--googleon: index-->foo5"
,
output
);
}
public
void
test_processXRobotsTags_no
()
throws
Exception
{
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
@Override
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
transformer
.
processXRobotsTag
(
responseData
,
new
ResultData
());
assertFalse
(
responseData
.
isNoFollow
());
}
public
void
test_processXRobotsTag_noindexnofollow
()
throws
Exception
{
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
responseData
.
addMetaData
(
"X-Robots-Tag"
,
"noindex,nofollow"
);
try
{
transformer
.
processXRobotsTag
(
responseData
,
new
ResultData
());
fail
();
}
catch
(
ChildUrlsException
e
)
{
assertTrue
(
e
.
getChildUrlList
().
isEmpty
());
}
catch
(
Exception
e
)
{
fail
();
}
}
public
void
test_processXRobotsTag_noindex
()
throws
Exception
{
final
String
data
=
"<meta name=\"robots\" content=\"noindex\" /><a href=\"index.html\">aaa</a>"
;
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
responseData
.
setResponseBody
(
data
.
getBytes
());
responseData
.
addMetaData
(
"X-Robots-Tag"
,
"noindex"
);
try
{
transformer
.
processXRobotsTag
(
responseData
,
new
ResultData
());
fail
();
}
catch
(
ChildUrlsException
e
)
{
assertTrue
(
e
.
getChildUrlList
().
isEmpty
());
}
catch
(
Exception
e
)
{
fail
();
}
}
public
void
test_processXRobotsTag_nofollow
()
throws
Exception
{
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
addMetaData
(
"X-Robots-Tag"
,
"nofollow"
);
transformer
.
processXRobotsTag
(
responseData
,
new
ResultData
());
assertTrue
(
responseData
.
isNoFollow
());
}
public
void
test_processMetaRobots_no
()
throws
Exception
{
final
String
data
=
"<html><body>foo</body></html>"
;
final
Document
document
=
getDocument
(
data
);
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
@Override
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
transformer
.
processMetaRobots
(
responseData
,
new
ResultData
(),
document
);
assertFalse
(
responseData
.
isNoFollow
());
}
public
void
test_processMetaRobots_none
()
throws
Exception
{
final
String
data
=
"<meta name=\"robots\" content=\"none\" />"
;
final
Document
document
=
getDocument
(
data
);
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
try
{
transformer
.
processMetaRobots
(
responseData
,
new
ResultData
(),
document
);
fail
();
}
catch
(
ChildUrlsException
e
)
{
assertTrue
(
e
.
getChildUrlList
().
isEmpty
());
}
catch
(
Exception
e
)
{
fail
();
}
}
public
void
test_processMetaRobots_noindexnofollow
()
throws
Exception
{
final
String
data
=
"<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW\" />"
;
final
Document
document
=
getDocument
(
data
);
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
try
{
transformer
.
processMetaRobots
(
responseData
,
new
ResultData
(),
document
);
fail
();
}
catch
(
ChildUrlsException
e
)
{
assertTrue
(
e
.
getChildUrlList
().
isEmpty
());
}
catch
(
Exception
e
)
{
fail
();
}
}
public
void
test_processMetaRobots_noindex
()
throws
Exception
{
final
String
data
=
"<meta name=\"robots\" content=\"noindex\" /><a href=\"index.html\">aaa</a>"
;
final
Document
document
=
getDocument
(
data
);
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
protected
PathMappingHelper
getPathMappingHelper
()
{
return
new
PathMappingHelper
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
responseData
.
setResponseBody
(
data
.
getBytes
());
try
{
transformer
.
processMetaRobots
(
responseData
,
new
ResultData
(),
document
);
fail
();
}
catch
(
ChildUrlsException
e
)
{
assertTrue
(
e
.
getChildUrlList
().
isEmpty
());
}
catch
(
Exception
e
)
{
fail
();
}
}
public
void
test_processMetaRobots_nofollow
()
throws
Exception
{
final
String
data
=
"<meta name=\"robots\" content=\"nofollow\" />"
;
final
Document
document
=
getDocument
(
data
);
final
FessXpathTransformer
transformer
=
new
FessXpathTransformer
()
{
protected
Map
<
String
,
String
>
getConfigPrameterMap
(
final
ResponseData
responseData
,
final
ConfigName
config
)
{
return
Collections
.
emptyMap
();
}
};
transformer
.
fessConfig
=
new
FessConfig
.
SimpleImpl
()
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
boolean
isCrawlerIgnoreRobotsTags
()
{
return
false
;
};
};
final
ResponseData
responseData
=
new
ResponseData
();
responseData
.
setUrl
(
"http://example.com/"
);
transformer
.
processMetaRobots
(
responseData
,
new
ResultData
(),
document
);
assertTrue
(
responseData
.
isNoFollow
());
}
private
Document
getDocument
(
final
String
data
)
throws
Exception
{
final
DOMParser
parser
=
new
DOMParser
();
...
...
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